Update run.py
This commit is contained in:
parent
83cee5c1a6
commit
88d94529ad
14
run.py
14
run.py
@ -12,6 +12,7 @@ import random
|
|||||||
|
|
||||||
# Import custom files
|
# Import custom files
|
||||||
from src.config.config import LoadConfig
|
from src.config.config import LoadConfig
|
||||||
|
from src.shared_libs.loggable import Loggable
|
||||||
|
|
||||||
logging.basicConfig(level='INFO')
|
logging.basicConfig(level='INFO')
|
||||||
|
|
||||||
@ -23,9 +24,9 @@ try:
|
|||||||
del uvloop
|
del uvloop
|
||||||
except BaseException as ex:
|
except BaseException as ex:
|
||||||
logging.warning(f'Could not load uvloop. {type(ex).__name__}: {ex};',
|
logging.warning(f'Could not load uvloop. {type(ex).__name__}: {ex};',
|
||||||
'reverting to default impl.'))
|
'reverting to default impl.')
|
||||||
else:
|
else:
|
||||||
logging.info(print(f'Using uvloop for asyncio event loop policy.'))
|
logging.info(f'Using uvloop for asyncio event loop policy.')
|
||||||
|
|
||||||
|
|
||||||
# Bot Class
|
# Bot Class
|
||||||
@ -47,11 +48,9 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable):
|
|||||||
self.load_extension(f'src.cogs.{cog}')
|
self.load_extension(f'src.cogs.{cog}')
|
||||||
self.logger.info(f'Loaded: {cog}')
|
self.logger.info(f'Loaded: {cog}')
|
||||||
|
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
"""On ready function"""
|
"""On ready function"""
|
||||||
if self.maintenance:
|
self.maintenance and self.logger.warning('MAINTENANCE ACTIVE')
|
||||||
self.logger.warning('MAINTENANCE ACTIVE')
|
|
||||||
|
|
||||||
async def on_command_error(self, ctx, error):
|
async def on_command_error(self, ctx, error):
|
||||||
"""
|
"""
|
||||||
@ -76,7 +75,12 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable):
|
|||||||
joke = random.choice(jokes)
|
joke = random.choice(jokes)
|
||||||
fmt = f'**`{self.defaultprefix}{ctx.command}`**\n{joke}\n\n**{type(error).__name__}:**:\n```py\n{tb}\n```'
|
fmt = f'**`{self.defaultprefix}{ctx.command}`**\n{joke}\n\n**{type(error).__name__}:**:\n```py\n{tb}\n```'
|
||||||
simple_fmt = f'**`{self.defaultprefix}{ctx.command}`**\n{joke}\n\n**{type(error).__name__}:**:\n**`{error}`**'
|
simple_fmt = f'**`{self.defaultprefix}{ctx.command}`**\n{joke}\n\n**{type(error).__name__}:**:\n**`{error}`**'
|
||||||
|
|
||||||
|
# Stops the error handler erroring.
|
||||||
|
try:
|
||||||
await ctx.send(fmt)
|
await ctx.send(fmt)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user