feat(moderation): added unmute command
Some checks failed
Pylint / Pylint (push) Failing after 1m13s

This commit is contained in:
Seaswimmer 2023-10-04 16:43:15 -04:00
parent e66a902442
commit dd98ecdcd1
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -209,6 +209,25 @@ class Moderation(commands.Cog):
await response.edit(content=f"{response.content}\n*Failed to send DM, user likely has the bot blocked.*")
await self.mysql_log(ctx.guild.id, ctx.author.id, 'MUTE', target.id, parsed_time, reason)
@commands.hybrid_command(name="unmute", aliases=['untimeout', 'utm'])
@commands.mod()
async def unmute(self, ctx: commands.Context, target: discord.Member, *, reason: str = None):
"""Unmute a user."""
if target.is_timed_out() is False:
await ctx.send(f"{target.mention} is not muted!", allowed_mentions=discord.AllowedMentions(users=False))
return
await target.timeout(None)
if reason is None:
reason = "No reason given."
response = await ctx.send(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`")
try:
embed = discord.Embed(title="Unmuted", description=f"You have been unmuted in [{ctx.guild.name}]({response.jump_url}).", color=await self.bot.get_embed_color(None))
embed.add_field(name='Reason', value=f"`{reason}`")
await target.send(embed=embed)
except discord.errors.HTTPException:
await response.edit(content=f"{response.content}\n*Failed to send DM, user likely has the bot blocked.*")
await self.mysql_log(ctx.guild.id, ctx.author.id, 'UNMUTE', target.id, 'NULL', reason)
@commands.group(autohelp=True)
@checks.admin()
async def moderationset(self, ctx: commands.Context):