不和谐的机器人没有回应

时间:2018-11-09 19:36:33

标签: python python-3.5 discord discord.py

所以我正在写一个不和谐的机器人。我知道python,但不久之后我就再也没有弄乱它了。无论如何,我试图设置一个机器人只是为了扩展我的代码知识。

现在,我只是想让它响应!ping。当我不和谐地发送!ping消息时,漫游器不会响应。下面是代码片段。脚本启动时IDLE中没有任何问题。

@client.event
async def on_message(message):
    if message.content.startswith('!ping'):
            userID = message.author.id
            await client.send_message(message.channel, "<@%s> Pong!" % (userID))

1 个答案:

答案 0 :(得分:0)

试试这个来发送消息:

await message.send(f"{message.author.name} pong!")
相关问题