这是使用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)
在终端中查看它。