2024-10-01 11:36:12 发布
网友
我做了一个不和.py不和谐的机器人名为JMKBot(4.0版)。 当我使用不,说吧()函数,例如,无论用户调用它,它都会显示它
@bot.command() async def example(): bot.say("example") print("example command run!")
会在我称之为>;example的同一频道中说。在
但是bot.send_消息()需要目标变量,我无法使其自动转到调用该命令的通道。在
如何使目标变量转到调用命令的通道?在
@bot.command(pass_context=True) async def example(ctx): await bot.send_message(ctx.message.channel, 'Example')
将上下文传递到命令中,然后从message属性获取通道。在
message
将上下文传递到命令中,然后从
message
属性获取通道。在相关问题 更多 >
编程相关推荐