【发布时间】:2021-03-30 04:42:10
【问题描述】:
我最近开始改进我的不和谐机器人,不使用 on_message 函数加上一长串 if 语句,但现在我已经开始使用 @bot.command(name=" ") 如果我尝试使用 message.author 它没有'没有要检查作者的消息。我该如何解决这个问题?
@bot.command(name="start")
async def some_crazy_function_name(ctx):
if not currentcreator == 0:
await message.channel.send("Someone is already making a profile,
please wait")
currentcreater = message.author
dir = r'C:\\Users\\User\Desktop\DiscordMMO\User-Profiles'
MessageAuthor = str(message.author)
ProfileDIR = os.path.join(dir,MessageAuthor)
doesExist = os.path.exists(ProfileDIR)
if doesExist == False:
embed=discord.Embed(title="Creating Profile", url="", description=MessageAuthor+", your profile is being create
【问题讨论】:
-
您能提供您正在使用的代码的 sn-p 吗?
-
编辑到帖子中
-
如果我在这里错了,请纠正我,但您还没有定义
message变量?您也可以使用ctx.author来获取作者。也可以直接使用ctx.send()回复。文档中的更多信息here
标签: python discord discord.py