Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使discord.py bot读取和回复带有特定关键字的邮件_Python_Discord_Discord.py - Fatal编程技术网

Python 如何使discord.py bot读取和回复带有特定关键字的邮件

Python 如何使discord.py bot读取和回复带有特定关键字的邮件,python,discord,discord.py,Python,Discord,Discord.py,因此,我正在制作一个discord.py bot,我希望它扫描服务器上发送的消息,并回复具有我想要的特定关键字的消息 我试过这个: @gameBot.event async def on_message(ctx, message): if "Hello" in message.content.lower: await ctx.send("Hi") else: pass 但是,当我使用其他命令时,它只是简单地

因此,我正在制作一个discord.py bot,我希望它扫描服务器上发送的消息,并回复具有我想要的特定关键字的消息

我试过这个:

@gameBot.event
async def on_message(ctx, message):
    if "Hello" in message.content.lower:
        await ctx.send("Hi")
    else:
        pass

但是,当我使用其他命令时,它只是简单地传递它们,而且它也有一些错误。

on\u消息采用
self
消息
<如果您使用cog,则使用“代码>自我”,发送的是
消息

@gameBot.event
异步def on_消息(消息):
如果message.content.lower()中的“hello”:
等待消息。频道。发送(“Hi”)
等待gameBot.process_命令(消息)

Lower是一个函数,因此您必须在它的末尾使用
()

您的
“Hello”
仍然是大写,这将导致这种情况总是跳到大写;)好了@PascalStockert