Uh oh!
There was an error while loading. Please reload this page.
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.
There should be a space after this line.
| # Getting the image | ||
| async with aiohttp.ClientSession() as session: |
There was a problem hiding this comment.
You could remove this with block and just use the one you already have above.
There was a problem hiding this comment.
Meaning put everything under 1 session?
| # 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.
Your data needs to be formatted and placed into an embed.
| :return: A dict containing information on a snake | ||
| """ | ||
| # Getting the summary |
There was a problem hiding this comment.
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.
This will remove all the roles, won't it? Maybe specify the roles that should be removed.
| # The snake moult command | ||
| @command() | ||
| async def moult(self, ctx: Context): |
There was a problem hiding this comment.
I would prefer if this just got the bot role and changed its colour, but this is a fun command either way!
| from typing import Any, Dict | ||
| import discord | ||
| import random |
There was a problem hiding this comment.
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.
ditto with the imports. Try having your imports in separate groups:
importloggingfromtypingimportAny, Dictimportrandomimportjsonimportaiohttpfrombs4importBeautifulSoupimportdiscordfromdiscord.ext.commandsimportAutoShardedBot, 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.
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.
Line lengths again. Try having the URL string defined on a previous line.
gdude2002
commented
Mar 25, 2018
You code is failing to lint. Please see Travis for more information. |
No description provided.