Conversation
Fix Pipfile dependencies
bot/cogs/snakes.py
Outdated
| :param name: Optional, the name of the snake to get information for - omit for a random snake | ||
| :return: A dict containing information on a snake | ||
| """ | ||
| pass |
There was a problem hiding this comment.
pass is not required if there's a docstring.
bot/cogs/snakes.py
Outdated
| :param ctx: Context object passed from discord.py | ||
| :param name: Optional, the name of the snake to get information for - omit for a random snake | ||
| """ | ||
| pass |
There was a problem hiding this comment.
pass is not required if there's a docstring.
run.py
Outdated
| except FileNotFoundError: | ||
| print('No token found.') | ||
| else: | ||
| bot.run(token) |
There was a problem hiding this comment.
No, this whole block is incorrect. Don't run the bot this way. Read over the doc/ folder in the repository again, it explains exactly how you should be doing this.
|
Your build is currently failing. |
- Fix the way the bot is run to match with the docs (including removing `config.json` from the `.gitignore` file - Create the bot's session and response from the info source - update the info source and functions to easily get info - add dependencies (bs4 and lxml)
- still have to remove html tags - fix image url to actually work - move image to the embed's image function - region picture to thumbnail - more info
[UPDATE] Ignored a silly rule from flake8.
So far these don't return an image: - bullsnake - ringneck snake - puff adder
- still ussues with the snek map image url - see the comments in L14-16 in bot/cogs/snakes.py - add command aliases
- until we get a fix - proper css selector - correct link
- if apostrophe: remove it # used in `children's python`
.gitignore
Outdated
| @@ -1,4 +1,4 @@ | |||
| # Byte-compiled / optimized / DLL files | |||
| Byte-compiled / optimized / DLL files | |||
There was a problem hiding this comment.
No, this should be a comment.
bot/cogs/logging.py
Outdated
| log.info('--------------') | ||
| log.info("Bot connected!") | ||
|
|
||
| self.bot.session = ClientSession(loop=self.bot.loop) |
There was a problem hiding this comment.
Don't do that, this should be done in the cog itself and set on self.
bot/cogs/logging.py
Outdated
| for i, snek in enumerate(self.bot.sneks): | ||
| self.bot.sneks[i] = snek.replace('\u200b', '').replace('\ufeff', '') | ||
|
|
||
| log.info('Snakes loaded.') |
There was a problem hiding this comment.
This is the logging cog. If you need to do stuff on_ready, do it in your cog.
There was a problem hiding this comment.
you can make two on_ready events in two different files?
There was a problem hiding this comment.
what order will the bot perform the actions in?
There was a problem hiding this comment.
No idea. You shouldn't rely on that.
bot/cogs/snakes.py
Outdated
| :return: A dict containing information on a snake | ||
| """ | ||
| if name: | ||
| if name not in self.bot.sneks: |
There was a problem hiding this comment.
This, again, should be an attribute on your cog, not the bot.
run.py
Outdated
| bot.load_extension("bot.cogs.snakes") | ||
|
|
||
| bot.run(os.environ.get("BOT_TOKEN")) | ||
| bot.run(os.environ.get('BOT_TOKEN')) |
There was a problem hiding this comment.
Haha, come on, no need to change the quote marks.
There was a problem hiding this comment.
i use single quotes, just that i accidentally did the config.json stuff before so when i changed it back i naturally used single quotes
| ">>>", ">>", ">" | ||
| ), # Order matters (and so do commas) | ||
| activity=Game(name="Help: bot.help()"), | ||
| activity=Game(name="with snekky sneks"), |
There was a problem hiding this comment.
Probably a bit user-unfriendly, but it's fine in this case. :P
- the stupid image that changes divs - that causes some commands for snakes to be broken (IndexError) - some snakes still don't show with an image (cut-off html?)
- remove unnecessary import - added it to on_ready in seperate cog - cog attribute, not bot attribute - fix accidental `.gitignore` change - tic tac toe uses python emoji - update tic tac toe board
less clutter in the actual command
This reverts commit 9edf8c9.
loops through the possible divs
- this site's html is like anti-webscrape - no one cares about the eastern brown snake - i put `for x in range(1, 7)`, but for some reason it's not doing the 1? - only 1 issue so far but as i already said, no one cares about the eastern brown snake so screw that
bot/cogs/snakes.py
Outdated
| def __init__(self, bot: AutoShardedBot): | ||
| self.bot = bot | ||
|
|
||
| PYTHON_INFO = { |
There was a problem hiding this comment.
This probably shouldn't be a class variable, but a module variable declared above class declaration.
bot/cogs/snakes.py
Outdated
| return em | ||
|
|
||
| def format_info(self, data, color=discord.Color.green()): | ||
| '''Formats the info with the given data.''' |
There was a problem hiding this comment.
""" are preferred in docstrings over '''
There was a problem hiding this comment.
Not required, but some documentation for the parameters would be nice, maybe some type annotations at the least to say what data should be.
bot/cogs/snakes.py
Outdated
| # Any additional commands can be placed here. Be creative, but keep it to a reasonable amount! | ||
| @command(aliases=['getsnekfact', 'snekfact()', 'get_snek_fact()']) | ||
| async def snekfact(self, ctx: Context): | ||
| ''' |
Teammate: @Volcyy