我如何从作者那里获取文本作为在他们执行命令时触发某些响应的方式?
How do I take in text from an author as a way to trigger certain responses when they've executed a command?
假设我创建了一条用户用来触发短信的命令。
@client.command()
async def hello(ctx) :
await ctx.send (f'Hey there {ctx.author.name}! Say 1 to access the moderation module and 2 to access the fun module')
如果他们输入1,我会引导他们进行一系列与输入2不同的动作。
您可以在函数中添加一个变量来取值。
破解以下代码:
async def hello(ctx,input:int = None):
输入是一个变量。
:int用于指定你想要的值。它可以是 :str :int 或空白。
= None用于保持值None直到用户输入值。
@client.command()
async def hello(ctx,input:int = None):
if input == None:
await ctx.send (f'Hey there {ctx.author.name}! Say 1 to access the moderation module and 2 to access the fun module')
elif input == 1:
#ACCESS THE MODERATION MODULE
pass
elif input == 2:
#ACCCESS THE FUN MODULE
pass
假设我创建了一条用户用来触发短信的命令。
@client.command()
async def hello(ctx) :
await ctx.send (f'Hey there {ctx.author.name}! Say 1 to access the moderation module and 2 to access the fun module')
如果他们输入1,我会引导他们进行一系列与输入2不同的动作。
您可以在函数中添加一个变量来取值。
破解以下代码:
async def hello(ctx,input:int = None):
输入是一个变量。
:int用于指定你想要的值。它可以是 :str :int 或空白。
= None用于保持值None直到用户输入值。
@client.command()
async def hello(ctx,input:int = None):
if input == None:
await ctx.send (f'Hey there {ctx.author.name}! Say 1 to access the moderation module and 2 to access the fun module')
elif input == 1:
#ACCESS THE MODERATION MODULE
pass
elif input == 2:
#ACCCESS THE FUN MODULE
pass