-
-
Notifications
You must be signed in to change notification settings - Fork 16
Team 11 #11
base: master
Are you sure you want to change the base?
Team 11 #11
Conversation
Pipfile
Outdated
@@ -8,6 +8,9 @@ name = "pypi" | |||
aiodns = "*" | |||
aiohttp = "<2.3.0,>=2.0.0" | |||
websockets = ">=4.0,<5.0" | |||
"beautifulsoup4" = "*" | |||
requests-html = "*" |
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.
It looks like you've edited this file by hand. This is bad practise, but at least you've updated the lockfile as well.
Please be careful about using requests
- it's not asynchronous.
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 am 100% sure that I did not update the Pipfile by hand. I used pipenv install requests-html
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.
Okay. Either way, we've made a statement about the wikipedia module on Discord, and the same applies to Requests. Requests does not support asyncio, and you're going to want to avoid any solution that doesn't.
[UPDATE] Ignored a silly rule from flake8.
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. Adding random snakes
Added Python bot message
Adding W503 and E226 to flake8 ignore list.
.gitignore
Outdated
@@ -9,6 +9,8 @@ __pycache__/ | |||
# Distribution / packaging | |||
.Python | |||
env/ | |||
.idea/ | |||
.env |
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.
Aren't these both already in the gitignore?
Pipfile
Outdated
@@ -8,6 +8,8 @@ name = "pypi" | |||
aiodns = "*" | |||
aiohttp = "<2.3.0,>=2.0.0" | |||
websockets = ">=4.0,<5.0" | |||
"beautifulsoup4" = "*" | |||
wikipedia = "*" |
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.
If you're not using this, you should pipenv uninstall
it.
bot/cogs/snakes.py
Outdated
@@ -1,8 +1,10 @@ | |||
# coding=utf-8 | |||
import logging | |||
import logging, aiohttp, random, wikipedia |
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, you should be using separate lines, and they should be in alphabetical order.
bot/cogs/snakes.py
Outdated
@@ -11,8 +13,22 @@ class Snakes: | |||
""" | |||
Snake-related commands | |||
""" | |||
python_info = ''' | |||
Python (Programming Language) |
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 should probably remove all these huge indents.
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 also don't need the \n
s in here. Those are taken from how you've formatted the string.
bot/cogs/snakes.py
Outdated
@@ -28,9 +44,23 @@ 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 | |||
""" | |||
name = str(name) |
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, don't do this. If there's no snake name passed, this will now be "None"
, which is annoying to check for.
bot/cogs/snakes.py
Outdated
if name.lower() == 'python': | ||
name = self.python_info | ||
|
||
return name |
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 method doesn't work at all. Return name? Are you still working on this?
bot/cogs/snakes.py
Outdated
@@ -40,8 +70,93 @@ 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 | |||
""" | |||
# await ctx.send(BeautifulSoup(text, 'lxml').find("title")) | |||
name = str(name) |
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, why are you doing this?
bot/cogs/snakes.py
Outdated
title = soup.find('h1').text | ||
description = soup.find('table').text | ||
|
||
em = discord.Embed(title=title, description=description) |
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.
While you should be creating the embed in this method, you should be retrieving the information over in get_snek()
.
bot/cogs/snakes.py
Outdated
|
||
# Any additional commands can be placed here. Be creative, but keep it to a reasonable amount! | ||
@command() | ||
async def snake(self, ctx: Context, x=50, y=30): |
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.
Really fun idea. But maybe a little ambitious for you guys.
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 super hard to read, I'm going to have to test it to really see what it does. Maybe you could comment it?
Also, perhaps you could use reactions via wait_for_reactions()
instead of a list of inputs?
converted all dict types apart from head to tuples added snake tail
Delete unnecessary code
Adding snake description
improved message deletion, mentions, Python is now Open-Source
You code is failing to lint. Please see Travis for more information. |
No description provided.