1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Formatting changes, changed to errext, caught CheckFailure

This commit is contained in:
Myned 2017-10-14 23:41:42 -04:00
parent 3c55f9bb05
commit a346dfca7e
3 changed files with 12 additions and 7 deletions

View file

@ -37,7 +37,7 @@ class MsG:
for tag in tag_request.get('wolf', []): for tag in tag_request.get('wolf', []):
tags.append(tag[0]) tags.append(tag[0])
await ctx.send('✅ ``{}` **tags:**\n```\n{}```'.format(tag, formatter.tostring(tags))) await ctx.send('✅ `{}` **related tags:**\n```\n{}```'.format(tag, formatter.tostring(tags)))
@tags.error @tags.error
async def tags_error(self, ctx, error): async def tags_error(self, ctx, error):

View file

@ -27,8 +27,8 @@ class Bot:
@commands.is_owner() @commands.is_owner()
@checks.del_ctx() @checks.del_ctx()
async def die(self, ctx): async def die(self, ctx):
if isinstance(self.bot.get_channel(u.config['startup_channel']), d.TextChannel): if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down...** 🌙') await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down. . .** 🌙')
# loop = self.bot.loop.all_tasks() # loop = self.bot.loop.all_tasks()
# for task in loop: # for task in loop:
# task.cancel() # task.cancel()
@ -43,8 +43,8 @@ class Bot:
@checks.del_ctx() @checks.del_ctx()
async def restart(self, ctx): async def restart(self, ctx):
print('\n| | | | | | | | | |\nR E S T A R T I N G\n| | | | | | | | | |\n') print('\n| | | | | | | | | |\nR E S T A R T I N G\n| | | | | | | | | |\n')
if isinstance(self.bot.get_channel(u.config['startup_channel']), d.TextChannel): if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting...** 💤') await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting. . .** 💤')
# u.notify('R E S T A R T I N G') # u.notify('R E S T A R T I N G')
# loop = self.bot.loop.all_tasks() # loop = self.bot.loop.all_tasks()
# for task in loop: # for task in loop:

View file

@ -9,6 +9,7 @@ import traceback as tb
import discord as d import discord as d
from discord import utils from discord import utils
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import errors as errext
from misc import exceptions as exc from misc import exceptions as exc
from misc import checks from misc import checks
@ -40,7 +41,9 @@ async def on_ready():
@bot.event @bot.event
async def on_error(error): async def on_error(error, *args, **kwargs):
if isinstance(bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
await bot.get_channel(u.config['shutdown_channel']).send('**__ERROR__** ⚠️ {}\n**Exiting. . .**'.format(error))
u.close() u.close()
await bot.logout() await bot.logout()
await bot.close() await bot.close()
@ -51,7 +54,9 @@ async def on_error(error):
@bot.event @bot.event
async def on_command_error(ctx, error): async def on_command_error(ctx, error):
if not isinstance(error, commands.errors.CommandNotFound): if isinstance(error, errext.CheckFailure):
await ctx.send('❌ **Insufficient permissions.**', delete_after=10)
elif not isinstance(error, errext.CommandNotFound):
print('\n! ! ! ! ! ! ! ! ! ! ! !\nC O M M A N D E R R O R : {}\n! ! ! ! ! ! ! ! ! ! ! !\n'.format( print('\n! ! ! ! ! ! ! ! ! ! ! !\nC O M M A N D E R R O R : {}\n! ! ! ! ! ! ! ! ! ! ! !\n'.format(
error), file=sys.stderr) error), file=sys.stderr)
tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr) tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr)