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

Updated user info to include users activity #64

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

Conversation

Ma-wa-re
Copy link
Member

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

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
@@ -152,14 +152,17 @@ def get_image(item, channel):
@commands.command()
@check_reddit
async def headpat(self, ctx):
''' Gets a random headpat image from /headpats '''
Copy link
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?

f'Duration: {str(activity.duration).split(".")[0]}',
]
embed.add_field(name='Listening to:', value='\n'.join(actitivty_info))
embed.color = 1947988
Copy link
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.

for member in guild.members:
if member.id == user_id:
return member

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

@@ -28,6 +28,7 @@
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
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
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?


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

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

await self.safe_or_react(ctx, '/r/headpats/random')

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

Choose a reason for hiding this comment

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

Ditto.

await self.safe_or_react(ctx, '/r/megane/random')

@commands.command()
@check_reddit
async def hentai(self, ctx):
''' Gets a random image from /hentai '''
Copy link
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