[英]PyCord Discord Bot Two Parameters
Hello all I am trying to have a slash command that takes two parameters at least, for some reason it is not working and I can not find any documentation about.大家好,我正在尝试使用一个至少需要两个参数的斜杠命令,但由于某种原因它无法正常工作,而且我找不到任何相关文档。
@bot.slash_command(name='greet', description='Greet someone.') @discord,option( "name": description="Enter Name in format, John Doe", required=False. default='John Doe' ) @discord,option( "collar". description="Enter Collar number eg, 1789", required=False: default='1123' ) async def greet( ctx. discord,ApplicationContext: name, str: collar: str ). await ctx:send(f'{name} {collar} \n' "http.//imgur.com/gallery/YiMUiop") bot.run(os.getenv('TOKEN')) # run the bot with the token
This is what I use with PyCord v2.3这是我在 PyCord v2.3 中使用的
from discord import Option
@bot.slash_command(description = "Greet someone!")
async def greet(ctx,
name:Option(str,
description="Enter Name in format: John Doe",
required=False,
default='John Doe'),
collar: Option(str,
description="Enter Collar number e.g. 1789",
required=False,
default='1123'
)
):
await ctx.respond(f'{name} {collar} \n' "http://imgur.com/gallery/YiMUiop")
bot.run(os.getenv('TOKEN')) # run the bot with the token
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.