-
-
Notifications
You must be signed in to change notification settings - Fork 16
Team 6 #20
base: master
Are you sure you want to change the base?
Team 6 #20
Conversation
image = json.loads(image_data) | ||
url = image["thumbnail"]["source"] | ||
|
||
return {'summary': summary, 'url': url} |
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.
There should be a space after this line.
|
||
# Getting the image | ||
|
||
async with aiohttp.ClientSession() as session: |
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 could remove this with
block and just use the one you already have above.
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.
Meaning put everything under 1 session?
@@ -41,8 +65,20 @@ def __init__(self, bot: AutoShardedBot): | |||
:param name: Optional, the name of the snake to get information for - omit for a random snake | |||
""" | |||
|
|||
# Any additional commands can be placed here. Be creative, but keep it to a reasonable amount! | |||
data = await self.get_snek(name) | |||
await ctx.send(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.
Your data needs to be formatted and placed into an embed.
@@ -29,6 +34,25 @@ def __init__(self, bot: AutoShardedBot): | |||
:return: A dict containing information on a snake | |||
""" | |||
|
|||
# Getting the summary |
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 function still needs to give a random snake when name is None
, and also it needs to special-case Python and return information about the programming language.
Additionally, this method is case-sensitive.
green = discord.utils.get(ctx.guild.roles, name="Green Skin") | ||
black = discord.utils.get(ctx.guild.roles, name="Black Skin") | ||
yellow = discord.utils.get(ctx.guild.roles, name="Yellow Skin") | ||
await ctx.guild.me.remove_roles() |
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 will remove all the roles, won't it? Maybe specify the roles that should be removed.
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.
Ill get right on fixing. :)
|
||
@command() | ||
async def moult(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.
I would prefer if this just got the bot role and changed its colour, but this is a fun command either way!
@@ -2,6 +2,11 @@ | |||
import logging | |||
from typing import Any, Dict | |||
|
|||
import discord | |||
import random |
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 import should be two lines before import discord
, since it's a standard library module.
import discord | ||
import random | ||
import aiohttp | ||
import json |
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.
ditto with the imports. Try having your imports in separate groups:
import logging
from typing import Any, Dict
import random
import json
import aiohttp
from bs4 import BeautifulSoup
import discord
from discord.ext.commands import AutoShardedBot, Context, command
# Getting the summary | ||
|
||
async with aiohttp.ClientSession() as session: | ||
async with session.get('https://en.wikipedia.org/w/api.php?action=parse&format=json&page=' + name + '§ion=1') as resp: |
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 line is too long. Try defining your URL on a separate line, and passing that into session.get
.
# Getting the image | ||
|
||
async with aiohttp.ClientSession() as session: | ||
async with session.get('https://en.wikipedia.org/w/api.php?format=json&action=query&titles=' + name + '&prop=pageimages&pithumbsize=300') as resp: |
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.
Line lengths again. Try having the URL string defined on a previous line.
You code is failing to lint. Please see Travis for more information. |
No description provided.