Made the bot type when muting/unmuting command

pull/8/head
sgoudham 4 years ago
parent da65bf75e0
commit 3b332a4851

@ -274,32 +274,32 @@ class Moderation(Cog):
Mute Member(s) from Server Mute Member(s) from Server
Multiple Members can be Muted At Once Multiple Members can be Muted At Once
""" """
with ctx.typing():
# When no members are entered. Throw an error # When no members are entered. Throw an error
if not len(members): if not len(members):
embed = Embed(description="Not Correct Syntax!" embed = Embed(description="Not Correct Syntax!"
"\nUse **{}help** to find how to use **{}**".format(ctx.prefix, ctx.command), "\nUse **{}help** to find how to use **{}**".format(ctx.prefix, ctx.command),
colour=enso_embedmod_colours) colour=enso_embedmod_colours)
await ctx.send(embed=embed) await ctx.send(embed=embed)
# Throw error when user tries to mute themselves # Throw error when user tries to mute themselves
elif ctx.author in members: elif ctx.author in members:
embed = Embed(description="**❌ You Can't Mute Yourself Baka! ❌**", embed = Embed(description="**❌ You Can't Mute Yourself Baka! ❌**",
colour=enso_embedmod_colours) colour=enso_embedmod_colours)
await ctx.send(embed=embed) await ctx.send(embed=embed)
else:
role = discord.utils.get(ctx.guild.roles, name="Muted")
if role is None:
# Setting up the role permissions for the Muted Role
muted = await ctx.guild.create_role(name="Muted")
# Removes permission to send messages in all channels
for channel in ctx.guild.channels:
await channel.set_permissions(muted, send_messages=False, read_messages=True)
# Send embed of the kicked member
await mute_members(ctx.message, members, reason, muted)
else: else:
# Send embed of the kicked member role = discord.utils.get(ctx.guild.roles, name="Muted")
await mute_members(ctx.message, members, reason, role) if role is None:
# Setting up the role permissions for the Muted Role
muted = await ctx.guild.create_role(name="Muted")
# Removes permission to send messages in all channels
for channel in ctx.guild.channels:
await channel.set_permissions(muted, send_messages=False, read_messages=True)
# Send embed of the kicked member
await mute_members(ctx.message, members, reason, muted)
else:
# Send embed of the kicked member
await mute_members(ctx.message, members, reason, role)
@command(name="unmute", aliases=["Unmute"]) @command(name="unmute", aliases=["Unmute"])
@has_guild_permissions(manage_roles=True) @has_guild_permissions(manage_roles=True)
@ -311,34 +311,36 @@ class Moderation(Cog):
""" """
unmute = False unmute = False
# When no members are entered. Throw an error with ctx.typing():
if not len(members):
embed = Embed(description="Not Correct Syntax!"
"\nUse **{}help** to find how to use **{}**".format(ctx.prefix, ctx.command),
colour=enso_embedmod_colours)
await ctx.send(embed=embed)
# Throw error when user tries to unmute themselves # When no members are entered. Throw an error
elif ctx.author in members: if not len(members):
embed = Embed(description="**❌ You Can't Unmute Yourself Baka! ❌**", embed = Embed(description="Not Correct Syntax!"
colour=enso_embedmod_colours) "\nUse **{}help** to find how to use **{}**".format(ctx.prefix, ctx.command),
await ctx.send(embed=embed) colour=enso_embedmod_colours)
await ctx.send(embed=embed)
role = discord.utils.get(ctx.guild.roles, name="Muted") # Throw error when user tries to unmute themselves
if role is None: elif ctx.author in members:
embed = Embed(description="**❌ No Muted Role Was Found! ❌**", embed = Embed(description="**❌ You Can't Unmute Yourself Baka! ❌**",
colour=enso_embedmod_colours) colour=enso_embedmod_colours)
await ctx.send(embed=embed) await ctx.send(embed=embed)
else:
await ctx.message.delete() role = discord.utils.get(ctx.guild.roles, name="Muted")
for member in members: if role is None:
if role in member.roles: embed = Embed(description="**❌ No Muted Role Was Found! ❌**",
await ummute_members(ctx.message, members, reason) colour=enso_embedmod_colours)
unmute = True await ctx.send(embed=embed)
if role not in member.roles and unmute is False: else:
embed = Embed(description=f"**❌ {member.mention} Is Not Muted! ❌**", await ctx.message.delete()
colour=enso_embedmod_colours) for member in members:
await ctx.send(embed=embed) if role in member.roles:
await ummute_members(ctx.message, members, reason)
unmute = True
if role not in member.roles and unmute is False:
embed = Embed(description=f"**❌ {member.mention} Is Not Muted! ❌**",
colour=enso_embedmod_colours)
await ctx.send(embed=embed)
@command(name="ban", aliases=["Ban"], usage="`<member>...` `[reason]`") @command(name="ban", aliases=["Ban"], usage="`<member>...` `[reason]`")
@guild_only() @guild_only()

Loading…
Cancel
Save