我目前正在尝试将大多数代码迁移到齿轮中,并且我具有记录命令的功能。
async def logging(self, ctx, command):
output = client.get_channel(channel_id_here)
embed = discord.Embed(title = "{} command used.".format(command), color = 0x40558a)
embed.add_field(name = "User:", value = "{}".format(ctx.message.author.mention))
embed.add_field(name = "Server:", value = "{}".format(ctx.message.guild))
embed.add_field(name = "Channel:", value = "<#{}>".format(ctx.message.channel.id))
embed.add_field(name = "Full Command:", value = "{}".format(ctx.message.content))
await output.send(embed = embed)
但是,当我尝试使用以下命令在命令中调用该函数时:
await logging(self = self, ctx = ctx, command = "whatever")
我收到一条错误消息,指出未定义的变量:logging
。我是刚开始使用齿轮的人,会为您提供任何帮助。