📝 Cogs and utils

Improved code style and added comments and docstrings to cogs and utils.
This commit is contained in:
NikolajDanger
2021-04-15 15:16:56 +02:00
parent 35b2446a10
commit 43f26ec383
11 changed files with 725 additions and 255 deletions

View File

@ -1,24 +1,32 @@
from discord.ext import commands
from discord_slash import cog_ext
"""Contains the LookupCog, which deals with the lookup commands."""
from discord.ext import commands # Has the cog class
from discord_slash import cog_ext # Used for slash commands
from utils import getParams
from utils import getParams # pylint: disable=import-error
params = getParams()
class LookupCog(commands.Cog):
"""Contains the lookup commands."""
def __init__(self, bot):
"""Runs lookup commands."""
"""Initialize the cog."""
self.bot = bot
# Looks up a spell
@cog_ext.cog_slash(**params["spell"])
async def spell(self, ctx, query):
"""Look up a spell."""
await self.bot.lookupFuncs.spellFunc(ctx, query)
# Looks up a monster
@cog_ext.cog_slash(**params["monster"])
async def monster(self, ctx, query):
"""Look up a monster."""
await self.bot.lookupFuncs.monsterFunc(ctx, query)
def setup(bot):
bot.add_cog(LookupCog(bot))
"""Add the cog to the bot."""
bot.add_cog(LookupCog(bot))