Skip to content

Commit

Permalink
added command to retrieve username from id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ereiarrus committed Feb 4, 2024
1 parent bba062d commit 0641289
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ so if you did !ignoreme, I will still know that you don't want to be complemente
twitch username/user id will still be stored in my database. If you don't want this, then also do !unignore me -
this will remove any reference of you from my database
- !userid - returns the twitch user's ID from their username; if no name specified, returns ID of caller
- !username - returns the twitch user's name from their ID

- !ignoreme - I will stop complementing you
- !unignoreme - undo !ignoreme
Expand Down
16 changes: 16 additions & 0 deletions src/complements_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,22 @@ async def userid(self, ctx: commands.Context) -> None:
userid
)

@commands.command()
async def username(self, ctx: commands.Context) -> None:
"""
Get the twitch user's ID from their username
"""

username: str = str(await self.id_to_name(self.isolate_args(ctx.message.content)))

await ComplementsBot.cmd_body(
ctx,
self.is_in_bot_channel,
None,
None,
username
)

@commands.command()
async def unignoreme(self, ctx: commands.Context) -> None:
"""
Expand Down

0 comments on commit 0641289

Please sign in to comment.