如何使用自己的前缀创建命令?

问题描述 投票:0回答:1

我需要

help
命令有自己的前缀。

例如,机器人的标准前缀是

!
,对于
help
命令,我想使用前缀
.
。除了 brige 命令之外,我在文档中没有找到任何内容,但这不是我需要的。

我的代码:

import discord
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="!", intents=intents, help_command=None)

@bot.command()
async def help(ctx):
    #long embed
    await ctx.send(embed=embed, view=view)

bot.run(token)
python discord.py pycord
1个回答
0
投票

只需将命令前缀从

!
更改为
.
,如下所示:

import discord
intents = discord.Intents.all()
bot = commands.Bot(command_prefix=".", intents=intents, help_command=None)

@bot.command()
async def help(ctx):
    #long embed
    await ctx.send(embed=embed, view=view)

bot.run(token)
© www.soinside.com 2019 - 2024. All rights reserved.