feat(moderation): added unmute command
Some checks failed
Pylint / Pylint (push) Failing after 1m13s
Some checks failed
Pylint / Pylint (push) Failing after 1m13s
This commit is contained in:
parent
e66a902442
commit
dd98ecdcd1
1 changed files with 19 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue