From 79b16232c62c6381c1669718a718bba6acddc958 Mon Sep 17 00:00:00 2001 From: Scragly <29337040+scragly@users.noreply.github.com> Date: Tue, 26 Mar 2019 13:53:54 +1000 Subject: Recombine error handlers into the main listener. Fix cooldown revert. --- bot/bot.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index c1198957..d60390c3 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -5,8 +5,7 @@ from typing import List from aiohttp import AsyncResolver, ClientSession, TCPConnector from discord import Embed -from discord.ext import commands -from discord.ext.commands import Bot, Cog +from discord.ext.commands import Bot from bot import constants @@ -19,10 +18,7 @@ class SeasonalBot(Bot): def __init__(self, **kwargs): super().__init__(**kwargs) self.http_session = ClientSession( - connector=TCPConnector( - resolver=AsyncResolver(), - family=socket.AF_INET, - ) + connector=TCPConnector(resolver=AsyncResolver(), family=socket.AF_INET) ) def load_extensions(self, exts: List[str]): @@ -49,6 +45,7 @@ class SeasonalBot(Bot): """ Send an embed message to the devlog channel """ + devlog = self.get_channel(constants.Channels.devlog) if not devlog: @@ -62,11 +59,3 @@ class SeasonalBot(Bot): embed.set_author(name=title, icon_url=icon) await devlog.send(embed=embed) - - @Cog.listener() - async def on_command_error(self, context, exception): - # Don't punish the user for getting the arguments wrong - if isinstance(exception, commands.UserInputError): - context.command.reset_cooldown(context) - else: - await super().on_command_error(context, exception) -- cgit v1.2.3