🧹 PEP updating
This commit is contained in:
@ -1,40 +0,0 @@
|
||||
"""Contains the StarWarsCog, which deals with Star Wars commands."""
|
||||
from discord.ext import commands
|
||||
from discord_slash import cog_ext
|
||||
|
||||
from utils import getParams # pylint: disable=import-error
|
||||
|
||||
params = getParams()
|
||||
|
||||
|
||||
class StarWarsCog(commands.Cog):
|
||||
"""Contains the Star Wars commands."""
|
||||
|
||||
def __init__(self, bot):
|
||||
"""Initialize the cog."""
|
||||
self.bot = bot
|
||||
|
||||
@cog_ext.cog_slash(**params["starWarsRoll"])
|
||||
async def starWarsRoll(self, ctx, dice=""):
|
||||
"""Roll Star Wars dice."""
|
||||
await self.bot.starWars.roll.parseRoll(ctx, dice)
|
||||
|
||||
@cog_ext.cog_slash(**params["starWarsDestiny"])
|
||||
async def starWarsDestiny(self, ctx, parameters=""):
|
||||
"""Control Star Wars destiny points."""
|
||||
await self.bot.starWars.destiny.parseDestiny(ctx, parameters)
|
||||
|
||||
@cog_ext.cog_slash(**params["starWarsCrit"])
|
||||
async def starWarsCrit(self, ctx, severity: int = 0):
|
||||
"""Roll for critical injuries."""
|
||||
await self.bot.starWars.roll.critRoll(ctx, severity)
|
||||
|
||||
@cog_ext.cog_slash(**params["starWarsCharacter"])
|
||||
async def starWarsCharacter(self, ctx, parameters=""):
|
||||
"""Access and change Star Wars character sheet data."""
|
||||
await self.bot.starWars.character.parseChar(ctx, parameters)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
"""Add the cog to the bot."""
|
||||
bot.add_cog(StarWarsCog(bot))
|
@ -13,26 +13,26 @@ class EventCog(commands.Cog):
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
"""Log and set bot status when bot logs in."""
|
||||
await self.bot.eventHandler.on_ready()
|
||||
await self.bot.event_handler.on_ready()
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_slash_command(self, ctx):
|
||||
"""Log when a slash command is run."""
|
||||
await self.bot.eventHandler.on_slash_command(ctx)
|
||||
await self.bot.event_handler.on_slash_command(ctx)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_slash_command_error(self, ctx, error):
|
||||
"""Log when a slash error occurs."""
|
||||
await self.bot.errorHandler.on_slash_command_error(ctx, error)
|
||||
await self.bot.error_handler.on_slash_command_error(ctx, error)
|
||||
|
||||
async def on_error(self, method, *args, **kwargs):
|
||||
async def on_error(self, method):
|
||||
"""Log when an error occurs."""
|
||||
await self.bot.errorHandler.on_error(method)
|
||||
await self.bot.error_handler.on_error(method)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_reaction_add(self, reaction, user):
|
||||
"""Handle when someone reacts to a message."""
|
||||
await self.bot.eventHandler.on_reaction_add(reaction, user)
|
||||
await self.bot.event_handler.on_reaction_add(reaction, user)
|
||||
|
||||
|
||||
def setup(bot):
|
@ -95,20 +95,20 @@ class ConnectFourCog(commands.Cog):
|
||||
"""Initialize the cog."""
|
||||
self.bot = bot
|
||||
|
||||
@cog_ext.cog_subcommand(**params["connectFourStartUser"])
|
||||
async def connectFourStartUser(self, ctx, user):
|
||||
@cog_ext.cog_subcommand(**params["connect_fourStartUser"])
|
||||
async def connect_fourStartUser(self, ctx, user):
|
||||
"""Start a game of connect four against another user."""
|
||||
await self.bot.games.connectFour.start(ctx, user)
|
||||
await self.bot.games.connect_four.start(ctx, user)
|
||||
|
||||
@cog_ext.cog_subcommand(**params["connectFourStartGwendolyn"])
|
||||
async def connectFourStartGwendolyn(self, ctx, difficulty=3):
|
||||
@cog_ext.cog_subcommand(**params["connect_fourStartGwendolyn"])
|
||||
async def connect_fourStartGwendolyn(self, ctx, difficulty=3):
|
||||
"""Start a game of connect four against Gwendolyn."""
|
||||
await self.bot.games.connectFour.start(ctx, difficulty)
|
||||
await self.bot.games.connect_four.start(ctx, difficulty)
|
||||
|
||||
@cog_ext.cog_subcommand(**params["connectFourSurrender"])
|
||||
async def connectFourSurrender(self, ctx):
|
||||
@cog_ext.cog_subcommand(**params["connect_fourSurrender"])
|
||||
async def connect_fourSurrender(self, ctx):
|
||||
"""Surrender the game of connect four."""
|
||||
await self.bot.games.connectFour.surrender(ctx)
|
||||
await self.bot.games.connect_four.surrender(ctx)
|
||||
|
||||
|
||||
class HangmanCog(commands.Cog):
|
@ -18,13 +18,13 @@ class LookupCog(commands.Cog):
|
||||
@cog_ext.cog_slash(**params["spell"])
|
||||
async def spell(self, ctx, query):
|
||||
"""Look up a spell."""
|
||||
await self.bot.lookupFuncs.spellFunc(ctx, query)
|
||||
await self.bot.lookup_funcs.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)
|
||||
await self.bot.lookup_funcs.monsterFunc(ctx, query)
|
||||
|
||||
|
||||
def setup(bot):
|
40
cogs/star_wars_cog.py
Normal file
40
cogs/star_wars_cog.py
Normal file
@ -0,0 +1,40 @@
|
||||
"""Contains the StarWarsCog, which deals with Star Wars commands."""
|
||||
from discord.ext import commands
|
||||
from discord_slash import cog_ext
|
||||
|
||||
from utils import getParams # pylint: disable=import-error
|
||||
|
||||
params = getParams()
|
||||
|
||||
|
||||
class StarWarsCog(commands.Cog):
|
||||
"""Contains the Star Wars commands."""
|
||||
|
||||
def __init__(self, bot):
|
||||
"""Initialize the cog."""
|
||||
self.bot = bot
|
||||
|
||||
@cog_ext.cog_slash(**params["star_wars_roll"])
|
||||
async def star_wars_roll(self, ctx, dice=""):
|
||||
"""Roll Star Wars dice."""
|
||||
await self.bot.star_wars.roll.parseRoll(ctx, dice)
|
||||
|
||||
@cog_ext.cog_slash(**params["star_wars_destiny"])
|
||||
async def star_wars_destiny(self, ctx, parameters=""):
|
||||
"""Control Star Wars destiny points."""
|
||||
await self.bot.star_wars.destiny.parseDestiny(ctx, parameters)
|
||||
|
||||
@cog_ext.cog_slash(**params["star_wars_crit"])
|
||||
async def star_wars_crit(self, ctx, severity: int = 0):
|
||||
"""Roll for critical injuries."""
|
||||
await self.bot.star_wars.roll.critRoll(ctx, severity)
|
||||
|
||||
@cog_ext.cog_slash(**params["star_wars_character"])
|
||||
async def star_wars_character(self, ctx, parameters=""):
|
||||
"""Access and change Star Wars character sheet data."""
|
||||
await self.bot.star_wars.character.parseChar(ctx, parameters)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
"""Add the cog to the bot."""
|
||||
bot.add_cog(StarWarsCog(bot))
|
Reference in New Issue
Block a user