Tazgirl
Tazgirl

Reputation: 83

Python/Discord Username changes prevents my bot from recognizing players

I am setting up a discord game which uses folders as profiles, how do I fix the problem that if someone changes their username the bot can no longer access their profile?

Upvotes: 0

Views: 102

Answers (2)

creed
creed

Reputation: 1427

Usernames can be changed however User ID's cannot so you should use those instead, here's an example:

@client.command()
async def getUserID(ctx):
    userID = ctx.author.id
    await ctx.send(f"Your User ID is {userID}")

Upvotes: 0

Swinsor
Swinsor

Reputation: 11

Use the UserID instead of the Username.

This never changes unless they change to a different account, so you won’t have to worry about usernames changing.

Upvotes: 1

Related Questions