Team 17 #8
Team 17 #8
Conversation
Fix Pipfile dependencies
| @@ -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 | |||
gdude2002
Mar 23, 2018
Contributor
pass is not required if there's a docstring.
pass is not required if there's a docstring.
| @@ -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 | |||
gdude2002
Mar 23, 2018
Contributor
pass is not required if there's a docstring.
pass is not required if there's a docstring.
| except FileNotFoundError: | ||
| print('No token found.') | ||
| else: | ||
| bot.run(token) |
gdude2002
Mar 23, 2018
Contributor
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.
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`
| @@ -1,4 +1,4 @@ | |||
| # Byte-compiled / optimized / DLL files | |||
| Byte-compiled / optimized / DLL files | |||
gdude2002
Mar 25, 2018
Contributor
No, this should be a comment.
No, this should be a comment.
| log.info("Bot connected!") | ||
|
|
||
| self.bot.session = ClientSession(loop=self.bot.loop) |
gdude2002
Mar 25, 2018
Contributor
Don't do that, this should be done in the cog itself and set on self.
Don't do that, this should be done in the cog itself and set on self.
| for i, snek in enumerate(self.bot.sneks): | ||
| self.bot.sneks[i] = snek.replace('\u200b', '').replace('\ufeff', '') | ||
|
|
||
| log.info('Snakes loaded.') |
gdude2002
Mar 25, 2018
Contributor
This is the logging cog. If you need to do stuff on_ready, do it in your cog.
This is the logging cog. If you need to do stuff on_ready, do it in your cog.
SharpBit
Mar 25, 2018
Author
you can make two on_ready events in two different files?
you can make two on_ready events in two different files?
gdude2002
Mar 25, 2018
Contributor
You sure can!
You sure can!
SharpBit
Mar 25, 2018
Author
what order will the bot perform the actions in?
what order will the bot perform the actions in?
gdude2002
Mar 25, 2018
Contributor
No idea. You shouldn't rely on that.
No idea. You shouldn't rely on that.
| @@ -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: | |||
gdude2002
Mar 25, 2018
Contributor
This, again, should be an attribute on your cog, not the bot.
This, again, should be an attribute on your cog, not the bot.
| @@ -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')) | |||
gdude2002
Mar 25, 2018
Contributor
Haha, come on, no need to change the quote marks.
Haha, come on, no need to change the quote marks.
SharpBit
Mar 25, 2018
Author
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
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"), | |||
gdude2002
Mar 25, 2018
Contributor
Probably a bit user-unfriendly, but it's fine in this case. :P
Probably a bit user-unfriendly, but it's fine in this case. :P
SharpBit
Mar 25, 2018
Author
still mentionable /shrug
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
| @@ -15,6 +30,62 @@ class Snakes: | |||
| def __init__(self, bot: AutoShardedBot): | |||
| self.bot = bot | |||
|
|
|||
| PYTHON_INFO = { | |||
jb3
Mar 25, 2018
Member
This probably shouldn't be a class variable, but a module variable declared above class declaration.
This probably shouldn't be a class variable, but a module variable declared above class declaration.
| return em | ||
|
|
||
| def format_info(self, data, color=discord.Color.green()): | ||
| '''Formats the info with the given data.''' |
jb3
Mar 25, 2018
Member
""" are preferred in docstrings over '''
""" are preferred in docstrings over '''
jb3
Mar 25, 2018
Member
Not required, but some documentation for the parameters would be nice, maybe some type annotations at the least to say what data should be.
Not required, but some documentation for the parameters would be nice, maybe some type annotations at the least to say what data should be.
| # 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): | ||
| ''' |
jb3
Mar 25, 2018
Member
Again, """ are preferred over '''
Again, """ are preferred over '''
Teammate: @Volcyy