tempmute discord py

Solutions on MaxInterview for tempmute discord py by the best coders in the world

showing results for - "tempmute discord py"
Madeleine
21 Mar 2018
1@client.command()
2async def tempmute(ctx, member: discord.Member, time: int, d, *, reason=None):
3    guild = ctx.guild
4
5    for role in guild.roles:
6        if role.name == "Muted":
7            await member.add_roles(role)
8
9            embed = discord.Embed(title="muted!", description=f"{member.mention} has been tempmuted ", colour=discord.Colour.light_gray())
10            embed.add_field(name="reason:", value=reason, inline=False)
11            embed.add_field(name="time left for the mute:", value=f"{time}{d}", inline=False)
12            await ctx.send(embed=embed)
13
14            if d == "s":
15                await asyncio.sleep(time)
16
17            if d == "m":
18                await asyncio.sleep(time*60)
19
20            if d == "h":
21                await asyncio.sleep(time*60*60)
22
23            if d == "d":
24                await asyncio.sleep(time*60*60*24)
25
26            await member.remove_roles(role)
27
28            embed = discord.Embed(title="unmute (temp) ", description=f"unmuted -{member.mention} ", colour=discord.Colour.light_gray())
29            await ctx.send(embed=embed)
30
31            return
32