Python/Discord当我试图让Python获得Discord用户的userID时,它什么都不做,没有错误消息,也



这是使用userID:的代码

if message.content == "MMO start":
dir = r'C:\Users\UserDesktopMMOProfiles'
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")

这就是定义用户ID的函数:

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

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

最新更新