繁体   English   中英

响应前缀(discord.py)

[英]Responding to prefix (discord.py)

我试图让我的机器人响应前缀。 我只是无法让它这样做。 我已经尝试了我(目前)知道的所有内容。 我的代码:

@client.event
async def on_ready(ctx):
client.when_mentioned(ctx.send='My prefix is `ja`')

您可以编写一个on_message事件来检查机器人用户是否在消息的提及中

@bot.event
async def on_message(message):
    if message.author.bot:
        return
    if bot.user in message.mentions: 
        await message.channel.send("My prefix is `ja`")
    await bot.process_commands(message)

暂无
暂无

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

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