寻找消息的作者 [英] Finding author of a message
本文介绍了寻找消息的作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果有人写出?name(arg),我希望我的机器人说出消息的作者 +,您的名字就是 + arg。 我找不到邮件的作者。
If someone writes "?name (arg)" I want my bot to say the author of the message + ", your name is" + arg. I can't find of the author of the message though.
@client.command()
async def name(their_name):
await client.say("{0}, your name is {1}.".format("""author of the message goes here""", their_name))
推荐答案
以获取作者的姓名消息,则需要使用上下文
To get the name of the author of the message, you will need to use context
@client.command(pass_context=True)
async def name(ctx):
username = ctx.message.author.name
...
这篇关于寻找消息的作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文