Skip to content
This repository was archived by the owner on Oct 11, 2018. It is now read-only.

Updated user info to include users activity - #64

Open
Ma-wa-re wants to merge 1 commit into
masterfrom
updated-user-info
Open

Ma-wa-re wants to merge 1 commit into
masterfrom
updated-user-info

Conversation

@Ma-wa-re

@Ma-wa-re Ma-wa-re commented Mar 8, 2018

Copy link
Copy Markdown
Member

Added a way to see the users activity in the user info command. This requires the latest version of discord.py rewrite branch. This will need to be tidied up and make to look nicer

This also add doc string to the reddit commands

Added a way to see the users activity in the user info command. This requires the lastest version of discord.py rewrite branch
@Ma-wa-re
Ma-wa-re requested a review from emmiegit March 8, 2018 01:05
@commands.command()
@check_reddit
async def headpat(self, ctx):
''' Gets a random headpat image from /headpats '''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be /r/headpats, not /headpats?

Comment thread mawabot/cogs/info/info.py
f'Duration: {str(activity.duration).split(".")[0]}',
]
embed.add_field(name='Listening to:', value='\n'.join(actitivty_info))
embed.color = 1947988

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of magic constant colors, they should be constants, like STREAMING_COLOR or something.

Comment thread mawabot/cogs/info/info.py
for member in guild.members:
if member.id == user_id:
return member

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see if you like the discord.utils.get() implementation instead:

def _get_member(self, user_id):
    for guild in self.bot.guilds:
        member = discord.utils.get(guild, id=user_id)
        if member is not None:
            return member
    return None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it should explicitly return None if no member is found.

Comment thread mawabot/cogs/info/info.py
CHANNEL_REGEX = re.compile(r'<#([0-9]+)>')
MENTION_REGEX = re.compile(r'<@!?([0-9]+)>')
EMOJI_REGEX = re.compile(r'<:([A-Za-z~\-0-9]+):([0-9]+)>')
SPOTIFY_OPEN_URL = 'http://open.spotify.com/track/'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should have an empty space between the "regex constants" and the "url constants".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, given that you have this constant, is it worth making the other profile links (e.g. facebook, twitch) also be *_URL constants?

Comment thread mawabot/cogs/info/info.py

member = self._get_member(user.id)
activity = member.activity

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand removing user.game stuff, but why was user.voice and similar code removed?

@commands.command()
@check_reddit
async def megane(self, ctx):
''' Gets a random megane image from /megane '''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@commands.command()
@check_reddit
async def hentai(self, ctx):
''' Gets a random image from /hentai '''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

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.

2 participants