push local changes and hope that nothing breaks

This commit is contained in:
Ave Ozkal 2019-02-22 04:10:52 +03:00
parent 4164786b40
commit e85ecd41e5
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 32 additions and 8 deletions

View file

@ -135,30 +135,34 @@ async def on_command_error(ctx, error):
await bot.botlog_channel.send(err_msg) await bot.botlog_channel.send(err_msg)
if isinstance(error, commands.NoPrivateMessage): if isinstance(error, commands.NoPrivateMessage):
return await ctx.send("This command doesn't work on DMs.") resp = await ctx.send("This command doesn't work on DMs.")
elif isinstance(error, commands.MissingPermissions): elif isinstance(error, commands.MissingPermissions):
roles_needed = '\n- '.join(error.missing_perms) roles_needed = '\n- '.join(error.missing_perms)
return await ctx.send(f"{ctx.author.mention}: You don't have the right" resp = await ctx.send(f"{ctx.author.mention}: You don't have the right"
" permissions to run this command. You need: " " permissions to run this command. You need: "
f"```- {roles_needed}```") f"```- {roles_needed}```")
await ctx.message.delete()
elif isinstance(error, commands.BotMissingPermissions): elif isinstance(error, commands.BotMissingPermissions):
roles_needed = '\n-'.join(error.missing_perms) roles_needed = '\n-'.join(error.missing_perms)
return await ctx.send(f"{ctx.author.mention}: Bot doesn't have " resp = await ctx.send(f"{ctx.author.mention}: Bot doesn't have "
"the right permissions to run this command. " "the right permissions to run this command. "
"Please add the following roles: " "Please add the following roles: "
f"```- {roles_needed}```") f"```- {roles_needed}```")
await ctx.message.delete()
elif isinstance(error, commands.CommandOnCooldown): elif isinstance(error, commands.CommandOnCooldown):
return await ctx.send(f"{ctx.author.mention}: You're being " resp = await ctx.send(f"{ctx.author.mention}: You're being "
"ratelimited. Try in " "ratelimited. Try in "
f"{error.retry_after:.1f} seconds.") f"{error.retry_after:.1f} seconds.")
await ctx.message.delete()
elif isinstance(error, commands.CheckFailure): elif isinstance(error, commands.CheckFailure):
return await ctx.send(f"{ctx.author.mention}: Check failed. " resp = await ctx.send(f"{ctx.author.mention}: Check failed. "
"You might not have the right permissions " "You might not have the right permissions "
"to run this command, or you may not be able " "to run this command, or you may not be able "
"to run this command in the current channel.") "to run this command in the current channel.")
await ctx.message.delete()
elif isinstance(error, commands.CommandInvokeError) and\ elif isinstance(error, commands.CommandInvokeError) and\
("Cannot send messages to this user" in error_text): ("Cannot send messages to this user" in error_text):
return await ctx.send(f"{ctx.author.mention}: I can't DM you.\n" resp = await ctx.send(f"{ctx.author.mention}: I can't DM you.\n"
"You might have me blocked or have DMs " "You might have me blocked or have DMs "
f"blocked globally or for {ctx.guild.name}.\n" f"blocked globally or for {ctx.guild.name}.\n"
"Please resolve that, then " "Please resolve that, then "
@ -167,6 +171,10 @@ async def on_command_error(ctx, error):
# Nothing to do when command is not found. # Nothing to do when command is not found.
return return
# Delete warn message after 5 seconds
await asyncio.sleep(5)
return await resp.delete()
help_text = f"Usage of this command is: ```{ctx.prefix}"\ help_text = f"Usage of this command is: ```{ctx.prefix}"\
f"{ctx.command.signature}```\nPlease see `{ctx.prefix}help "\ f"{ctx.command.signature}```\nPlease see `{ctx.prefix}help "\
f"{ctx.command.name}` for more info about this command." f"{ctx.command.name}` for more info about this command."

View file

@ -72,6 +72,8 @@ class Mod:
"it is recommended to use `.mute <user> [reason]`"\ "it is recommended to use `.mute <user> [reason]`"\
" as the reason is automatically sent to the user." " as the reason is automatically sent to the user."
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
await ctx.send(f"{target.mention} can no longer speak.") await ctx.send(f"{target.mention} can no longer speak.")
@ -91,6 +93,8 @@ class Mod:
f"{target.mention} | {safe_name}\n"\ f"{target.mention} | {safe_name}\n"\
f"🏷 __User ID__: {target.id}\n" f"🏷 __User ID__: {target.id}\n"
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
await ctx.send(f"{target.mention} can now speak again.") await ctx.send(f"{target.mention} can now speak again.")
@ -138,6 +142,8 @@ class Mod:
"`.kick <user> [reason]`"\ "`.kick <user> [reason]`"\
" as the reason is automatically sent to the user." " as the reason is automatically sent to the user."
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
@ -182,6 +188,8 @@ class Mod:
", it is recommended to use `.ban <user> [reason]`"\ ", it is recommended to use `.ban <user> [reason]`"\
" as the reason is automatically sent to the user." " as the reason is automatically sent to the user."
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
await ctx.send(f"{safe_name} is now b&. 👍") await ctx.send(f"{safe_name} is now b&. 👍")
@ -218,6 +226,8 @@ class Mod:
", it is recommended to use "\ ", it is recommended to use "\
"`.hackban <user> [reason]`." "`.hackban <user> [reason]`."
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
await ctx.send(f"{safe_name} is now b&. 👍") await ctx.send(f"{safe_name} is now b&. 👍")
@ -251,6 +261,8 @@ class Mod:
", it is recommended to use `.ban <user> [reason]`"\ ", it is recommended to use `.ban <user> [reason]`"\
" as the reason is automatically sent to the user." " as the reason is automatically sent to the user."
chan_message += f"\nJump: <{ctx.message.jump_url}>"
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
await log_channel.send(chan_message) await log_channel.send(chan_message)
@ -275,7 +287,8 @@ class Mod:
await ctx.send(f"Approved {target.mention} to `{role}` role.") await ctx.send(f"Approved {target.mention} to `{role}` role.")
await log_channel.send(f"✅ Approved: {ctx.author.mention} added" await log_channel.send(f"✅ Approved: {ctx.author.mention} added"
f" {role} to {target.mention}") f" {role} to {target.mention} | "
f"<{ctx.message.jump_url}>")
@commands.guild_only() @commands.guild_only()
@commands.check(check_if_staff) @commands.check(check_if_staff)
@ -298,7 +311,8 @@ class Mod:
await ctx.send(f"Un-approved {target.mention} from `{role}` role.") await ctx.send(f"Un-approved {target.mention} from `{role}` role.")
await log_channel.send(f"❌ Un-approved: {ctx.author.mention} removed" await log_channel.send(f"❌ Un-approved: {ctx.author.mention} removed"
f" {role} from {target.mention}") f" {role} from {target.mention} | "
f"<{ctx.message.jump_url}>")
@commands.guild_only() @commands.guild_only()
@commands.check(check_if_staff) @commands.check(check_if_staff)
@ -311,6 +325,7 @@ class Mod:
await channel.purge(limit=limit) await channel.purge(limit=limit)
msg = f"🗑 **Purged**: {ctx.author.mention} purged {limit} "\ msg = f"🗑 **Purged**: {ctx.author.mention} purged {limit} "\
f"messages in {channel.mention}." f"messages in {channel.mention}."
msg += f"\nJump: <{ctx.message.jump_url}>"
await log_channel.send(msg) await log_channel.send(msg)
@commands.guild_only() @commands.guild_only()
@ -371,6 +386,7 @@ class Mod:
msg += "Please add an explanation below. In the future"\ msg += "Please add an explanation below. In the future"\
", it is recommended to use `.ban <user> [reason]`"\ ", it is recommended to use `.ban <user> [reason]`"\
" as the reason is automatically sent to the user." " as the reason is automatically sent to the user."
msg += f"\nJump: <{ctx.message.jump_url}>"
await log_channel.send(msg) await log_channel.send(msg)
@commands.guild_only() @commands.guild_only()