Skip to content
This repository was archived by the owner on Mar 14, 2021. It is now read-only.

Team 6 #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Team 6 #20

wants to merge 1 commit into from

Conversation

kvcvc
Copy link

@kvcvc kvcvc commented Mar 25, 2018

No description provided.

image = json.loads(image_data)
url = image["thumbnail"]["source"]

return {'summary': summary, 'url': url}
Copy link
Contributor

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:
Copy link
Contributor

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.

Copy link
Author

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)
Copy link
Contributor

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
Copy link
Contributor

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()
Copy link
Contributor

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.

Copy link
Author

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):
Copy link
Contributor

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
Copy link

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
Copy link

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 + '&section=1') as resp:
Copy link

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:
Copy link

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.

@gdude2002
Copy link
Contributor

You code is failing to lint. Please see Travis for more information.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants