您如何定义齿轮内的变量?

时间:2020-04-30 19:56:27

标签: python-3.x discord.py discord.py-rewrite

我目前正在尝试将大多数代码迁移到齿轮中,并且我具有记录命令的功能。

    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。我是刚开始使用齿轮的人,会为您提供任何帮助。

0 个答案:

没有答案