我的目标是让我的机器人总是在discord.py中监听特定的消息。在这个例子中,它应该听到的消息是$greet,它应该用“Say hello”响应它,并在文本对语音中大声朗读。
这工作很好,但它禁用常规命令,我有设置喜欢!玩吧!救命啊。有没有办法绕过这个限制?
示例代码:
@my_bot.event
async def on_message(message, timeout=10,):
if message.content.startswith('$greet'):
await my_bot.send_message(message.channel, 'Say hello', tts=True)
msg = await my_bot.wait_for_message(author=message.author, content='hello')
await my_bot.send_message(message.channel, 'Hello.')
预期产量:
User: !play
Bot: Now playing...
User: $greet
Bot: Say hello
实际产量:
User: !play
User: $greet
Bot: Say hello
目前没有回答
相关问题 更多 >
编程相关推荐