Skip to content
This repository was archived by the owner on Mar 14, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ ENV/

# PyCharm
.idea/
.vscode/settings.json
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name = "pypi"
aiodns = "*"
aiohttp = "<2.3.0,>=2.0.0"
websockets = ">=4.0,<5.0"
wikipedia = "*"

[dev-packages]
"flake8" = "*"
Expand Down
38 changes: 37 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions bot/cogs/snakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from discord.ext.commands import AutoShardedBot, Context, command

from .snakegame import SnakeGame
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative imports are discouraged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also seem to be missing this file


log = logging.getLogger(__name__)


Expand All @@ -12,8 +14,9 @@ class Snakes:
Snake-related commands
"""

def __init__(self, bot: AutoShardedBot):
def __init__(self, bot: AutoShardedBot, game: SnakeGame):
self.bot = bot
self.game = game

async def get_snek(self, name: str = None) -> Dict[str, Any]:
"""
Expand Down Expand Up @@ -42,8 +45,12 @@ async def get(self, ctx: Context, name: str = None):
"""

# Any additional commands can be placed here. Be creative, but keep it to a reasonable amount!
@command()
async def play(self, ctx: Context, order):
if order == "left":
await ctx.send(self.game)


def setup(bot):
bot.add_cog(Snakes(bot))
bot.add_cog(Snakes(bot, SnakeGame((5, 5))))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite weird - maybe you should instantiate it in the __init__ instead?

log.info("Cog loaded: Snakes")