📝 Cogs and utils
Improved code style and added comments and docstrings to cogs and utils.
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user