【发布时间】:2021-10-24 06:19:11
【问题描述】:
if message.content.startswith('!highfive'):
channel = message.channel
await channel.send('{0.author.mention} wants to high-five you'.format(message))
def check(m):
return m.content == 'yes' and m.channel == channel
try:
message = await client.wait_for('message', timeout=10.0, check=check)
await channel.send('you accepted the highfive {0.author.mention}'.format(message))
except asyncio.TimeoutError:
await channel.send('you took too long to answer')
嗨,我对此很陌生,正在尝试创建一个简单的不和谐机器人
我可以让机器人提及作者,但是,我花了很长时间寻找,仍然无法弄清楚如何提及用户。我想使用命令'!highfive @(提到的用户)'并获得机器人的响应'@(作者提到的)想要高五你@(提到的用户)'
此外,如果超时错误不起作用,我无法生成对“是”和理想情况下的“否”的单独响应。
提前感谢您的任何帮助
【问题讨论】:
-
也许this线程可以帮助你
标签: python discord bots member mention