简体   繁体   中英

Python/Discord When I try to make python get the userID of a discord user it just does nothing, no error message and no output

This is the code using the userID:

if message.content == "MMO start":
    dir = r'C:\\Users\\User\Desktop\MMOProfiles'
    MessageAuthor = str(userID)
    newpath = os.path.join(dir,MessageAuthor)
    doesExist = os.path.exists(newpath)
    if doesExist == False:
        await message.channel.send("Creating profile")
        os.makedirs(newpath)
    if doesExist == True:
        await message.channel.send("You already have a profile")

And this is the function which is defining the userID:

async def UserID(ctx):
    userID = ctx.author.id

用户 ID 已经在userID您可以键入print(userID)以在终端中查看它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM