当我提到discord bot时,如何让它显示其前缀(python)

2024-05-16 00:52:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望能够键入“@Hu Tao bot prefix”,bot将使用当前前缀进行响应,由于某些原因,它无法工作,并且它也不会显示错误消息,我当前的前缀是: client = commands.Bot(command_prefix = '-')


Tags: client消息prefix键入bot错误原因command
1条回答
网友
1楼 · 发布于 2024-05-16 00:52:04

您可以在事件中使用message.mentions:-

@client.event
async def on_message(message):
  if client.user in message.mentions:
    await message.channel.send("You can type `tnj.help` for help")
  await client.process_commands(message)

相关问题 更多 >