Discord.py-在ping bot消息时如何发出bot消息? [英] Discord.py- How to make a bot message when its pinged?

查看:99
本文介绍了Discord.py-在ping bot消息时如何发出bot消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想当我们对机器人进行ping操作时会发送一条消息是吗?"或类似的表情符号,但我不知道怎么做.那么有人可以告诉我命令pls吗?

I want like when we ping the bot it sends a message 'Yes?' or something like that with an emoji but i can't figure out how. So can anyone tell me the command pls?

Discord.py

Discord.py

推荐答案

如果您不使用齿轮,请执行此操作.

if you're not using cogs then do this.

@client.event
async def on_message(message):
    if client.user.mentioned_in(message):
        await message.channel.send("Hmmm?")

docs:提及_in

这篇关于Discord.py-在ping bot消息时如何发出bot消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆