Compare commits
No commits in common. "9f1d864b3135ea56a870bd053717ad83a14ca25a" and "854a1f14e5205bdff42e86ebb96ad28cc6a4e16f" have entirely different histories.
9f1d864b31
...
854a1f14e5
1 changed files with 4 additions and 24 deletions
|
@ -60,9 +60,8 @@ class Moderation(commands.Cog):
|
|||
@commands.Cog.listener('on_audit_log_entry_create')
|
||||
async def autologger(self, entry: discord.AuditLogEntry):
|
||||
"""This method automatically logs moderations done by users manually ("right clicks")."""
|
||||
if await self.config.ignore_other_bots() is True:
|
||||
if entry.user.bot or entry.target.bot:
|
||||
return
|
||||
if entry.user.bot or entry.target.bot and await self.config.ignore_other_bots() is True:
|
||||
return
|
||||
duration = "NULL"
|
||||
if entry.reason:
|
||||
reason = entry.reason + " (This action was performed without the bot.)"
|
||||
|
@ -80,9 +79,9 @@ class Moderation(commands.Cog):
|
|||
duration_datetime = timed_out_until_aware - datetime.now(tz=timezone.utc)
|
||||
minutes = round(duration_datetime.total_seconds() / 60)
|
||||
duration = timedelta(minutes=minutes)
|
||||
moderation_type = 'MUTE'
|
||||
moderation_type = 'TIMEOUT'
|
||||
else:
|
||||
moderation_type = 'UNMUTE'
|
||||
moderation_type = 'UNTIMEOUT'
|
||||
else:
|
||||
return
|
||||
await self.mysql_log(entry.guild.id, entry.user.id, moderation_type, entry.target.id, duration, reason)
|
||||
|
@ -172,25 +171,6 @@ class Moderation(commands.Cog):
|
|||
database.close()
|
||||
logging.debug("MySQL row inserted into %s_moderation!\n%s, %s, %s, %s, %s, %s, %s, %s, 0, NULL", guild_id, moderation_id, timestamp, moderation_type, target_id, author_id, duration, end_timestamp, reason)
|
||||
|
||||
@commands.hybrid_command(name="mute", aliases=['timeout'])
|
||||
@commands.mod_or_permissions(discord.Permissions.moderate_members)
|
||||
async def mute(self, ctx: commands.Context, target: discord.Member, duration: str, reason: str):
|
||||
"""Mute a user."""
|
||||
try:
|
||||
parsed_time = parse(sval=duration, as_timedelta=True, raise_exception=True)
|
||||
except ValueError:
|
||||
await ctx.message.reply(f"Please provide a valid duration!\nSee `{ctx.prefix}tdc`")
|
||||
return
|
||||
await target.timeout(parsed_time)
|
||||
response = await ctx.send(content=f"{target.mention} has been muted for {str(parsed_time)}!\n**Reason** - `{reason}`")
|
||||
try:
|
||||
embed = discord.Embed(title="Muted", description=f"You have been muted for `{str(parsed_time)}` in {ctx.guild.name}.", 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.*")
|
||||
self.mysql_log(ctx.guild.id, ctx.author.id, 'MUTE', target.id, parsed_time, reason)
|
||||
|
||||
@commands.group(autohelp=True)
|
||||
@checks.admin()
|
||||
async def moderationset(self, ctx: commands.Context):
|
||||
|
|
Loading…
Reference in a new issue