aboutsummaryrefslogtreecommitdiffstats
path: root/bot/bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/bot.py')
-rw-r--r--bot/bot.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/bot/bot.py b/bot/bot.py
index 3cc57c3f..f3b1acbb 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -6,7 +6,6 @@ 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
from bot import constants
@@ -15,20 +14,17 @@ log = logging.getLogger(__name__)
__all__ = ('SeasonalBot',)
-class SeasonalBot(Bot):
+class SeasonalBot(commands.Bot):
+ """Base bot instance."""
+
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]):
- """
- Unload all current cogs, then load in the ones passed into `cogs`
- """
+ """Unload all current extensions, then load the given extensions."""
# Unload all cogs
extensions = list(self.extensions.keys())
@@ -46,9 +42,8 @@ class SeasonalBot(Bot):
log.error(f'Failed to load extension {cog}: {repr(e)} {format_exc()}')
async def send_log(self, title: str, details: str = None, *, icon: str = None):
- """
- Send an embed message to the devlog channel
- """
+ """Send an embed message to the devlog channel."""
+
devlog = self.get_channel(constants.Channels.devlog)
if not devlog:
@@ -64,7 +59,8 @@ class SeasonalBot(Bot):
await devlog.send(embed=embed)
async def on_command_error(self, context, exception):
- # Don't punish the user for getting the arguments wrong
+ """Check command errors for UserInputError and reset the cooldown if thrown."""
+
if isinstance(exception, commands.UserInputError):
context.command.reset_cooldown(context)
else: