繁体   English   中英

discord.py中的关键字

[英]Keywords in discord.py

我正在尝试制作一个响应某些关键字的机器人,但由于某种原因,我似乎无法让它工作。 例如,如果我说“这游戏太难了”,它会回复“呵呵:难”。 (我知道孩子气)。 我将如何编辑此代码以使其工作,因为目前它拒绝工作。 谢谢你

@client.event
async def on_message(message):
    if "hard" in message.content.lower():
        await message.channel.send('Hehe "Hard"')
        return

这应该在哪里发生? 在服务器中? 其他功能是否有效,您的机器人是否正常运行? 这段代码似乎对我有用:

@client.event
async def on_message(message):
    if not message.author.bot and "hard" in message.content.lower():
            await message.channel.send('Hehe "Hard"')

您是否可以发送您当前拥有的所有代码?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM