Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Discord.py 我如何在这里定义ctx? @client.event 异步def on_消息(消息): 如果(消息)中提到client.user.\u: embed=discord.embed(title='imhereboss',description='Prefix:'n!help`',color=discord.color.from_rgb(249,35142)) 嵌入.set_图像(url=)https://i.pinimg.com/originals/fe/1d/60/fe1d606ca0bcaf954a78cae3ed9c628b.gif') embed.set_footer(icon_url=ctx.author.avatar_url,text=f'由{ctx.author.name}'带到这里) 等待message.channel.send(嵌入=嵌入)_Discord.py - Fatal编程技术网

Discord.py 我如何在这里定义ctx? @client.event 异步def on_消息(消息): 如果(消息)中提到client.user.\u: embed=discord.embed(title='imhereboss',description='Prefix:'n!help`',color=discord.color.from_rgb(249,35142)) 嵌入.set_图像(url=)https://i.pinimg.com/originals/fe/1d/60/fe1d606ca0bcaf954a78cae3ed9c628b.gif') embed.set_footer(icon_url=ctx.author.avatar_url,text=f'由{ctx.author.name}'带到这里) 等待message.channel.send(嵌入=嵌入)

Discord.py 我如何在这里定义ctx? @client.event 异步def on_消息(消息): 如果(消息)中提到client.user.\u: embed=discord.embed(title='imhereboss',description='Prefix:'n!help`',color=discord.color.from_rgb(249,35142)) 嵌入.set_图像(url=)https://i.pinimg.com/originals/fe/1d/60/fe1d606ca0bcaf954a78cae3ed9c628b.gif') embed.set_footer(icon_url=ctx.author.avatar_url,text=f'由{ctx.author.name}'带到这里) 等待message.channel.send(嵌入=嵌入),discord.py,Discord.py,如果我在async def中添加ctx,它会显示一个错误,并且它没有定义,在页脚中也没有定义。在这里如何定义ctx?您可以使用该方法。 在需要获取ctx变量的地方,添加如下内容: ctx=等待客户端。获取上下文(消息) 您还可以输入自定义上下文作为第二个参数(cls=MyCustomCtx)您可以使用该方法。 在需要获取ctx变量的地方,添加如下内容: ctx=等待客户端。获取上下文(消息) 您还可以输入自定义上下文作为第二个参数(cls=MyCustomCtx)而不是使用ctx.autho

如果我在async def中添加ctx,它会显示一个错误,并且它没有定义,在页脚中也没有定义。在这里如何定义ctx?

您可以使用该方法。
在需要获取ctx变量的地方,添加如下内容:

ctx=等待客户端。获取上下文(消息)
您还可以输入自定义上下文作为第二个参数(
cls=MyCustomCtx

您可以使用该方法。
在需要获取ctx变量的地方,添加如下内容:

ctx=等待客户端。获取上下文(消息)

您还可以输入自定义上下文作为第二个参数(
cls=MyCustomCtx

而不是使用
ctx.author.*
使用
message.author.*
,但如果您确实想获得
上下文(
ctx
),请使用以下命令:

ctx=等待客户端。获取上下文(消息)

不要使用
ctx.author.*
使用
message.author.*
,但是如果您确实想获得
上下文(
ctx
),请使用以下命令:

ctx=等待客户端。获取上下文(消息)