-
-
Notifications
You must be signed in to change notification settings - Fork 16
Team 17 #8
base: master
Are you sure you want to change the base?
Team 17 #8
Conversation
Fix Pipfile dependencies
bot/cogs/snakes.py
Outdated
@@ -28,6 +29,7 @@ def __init__(self, bot: AutoShardedBot): | |||
: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass
is not required if there's a docstring.
bot/cogs/snakes.py
Outdated
@@ -40,6 +42,7 @@ def __init__(self, bot: AutoShardedBot): | |||
: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this should be a comment.
bot/cogs/logging.py
Outdated
log.info("Bot connected!") | ||
|
||
self.bot.session = ClientSession(loop=self.bot.loop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make two on_ready
events in two different files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sure can!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what order will the bot perform the actions in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea. You shouldn't rely on that.
bot/cogs/snakes.py
Outdated
@@ -28,9 +83,56 @@ def __init__(self, bot: AutoShardedBot): | |||
: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 | |||
""" | |||
if name: | |||
if name not in self.bot.sneks: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, again, should be an attribute on your cog, not the bot.
run.py
Outdated
@@ -35,6 +35,6 @@ | |||
# Commands, etc | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, come on, no need to change the quote marks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -16,7 +16,7 @@ | |||
">>> ", ">> ", "> ", | |||
">>>", ">>", ">" | |||
), # 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a bit user-unfriendly, but it's fine in this case. :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still mentionable /shrug
- 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
@@ -15,6 +30,62 @@ class Snakes: | |||
def __init__(self, bot: AutoShardedBot): | |||
self.bot = bot | |||
|
|||
PYTHON_INFO = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""
are preferred in docstrings over '''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): | ||
''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, """
are preferred over '''
Teammate: @Volcyy