【发布时间】:2021-05-11 05:37:42
【问题描述】:
我的机器人有代码可以让你跟它打招呼。目前,它看起来像这样
if message.content.startswith('$hello'):
await message.channel.send('Hello (message.author.name)!')
当您键入消息 "$hello" 很明显,它会以 “Hello (message.author.name)!”响应! 我如何让机器人实际上用用户名来响应。我可以使用:
if message.content.startswith('$hello'):
if message.author.name= myname
await message.channel.send(myname 'Hello!')
但是我必须为服务器中的每个用户都这样做,这会花费太长时间。还有其他方法吗?谢谢!
【问题讨论】:
标签: python discord discord.py