1@client.command(description="Unmutes a specified user.")
2@commands.has_permissions(manage_messages=True)
3async def unmute(ctx, member: discord.Member):
4 mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
5
6 await member.remove_roles(mutedRole)
7 await member.send(f" you have unmutedd from: - {ctx.guild.name}")
8 embed = discord.Embed(title="unmute", description=f" unmuted-{member.mention}",colour=discord.Colour.light_gray())
9 await ctx.send(embed=embed)
1@client.command(description="Mutes the specified user.")
2@commands.has_permissions(manage_messages=True)
3async def mute(ctx, member: discord.Member, *, reason=None):
4 guild = ctx.guild
5 mutedRole = discord.utils.get(guild.roles, name="Muted")
6
7 if not mutedRole:
8 mutedRole = await guild.create_role(name="Muted")
9
10 for channel in guild.channels:
11 await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
12 embed = discord.Embed(title="muted", description=f"{member.mention} was muted ", colour=discord.Colour.light_gray())
13 embed.add_field(name="reason:", value=reason, inline=False)
14 await ctx.send(embed=embed)
15 await member.add_roles(mutedRole, reason=reason)
16 await member.send(f" you have been muted from: {guild.name} reason: {reason}")
17
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