我正在尝试创建一个将消息发送到通道的报告命令。例如* report username#1234推理放在这里等等等
频道由{作者}报告的{用户}收到{原因}。 并向作者发送了一条私人消息,告诉他们报告通过了。
但是,如果所报告的用户具有“踢”权限,则其也会发送到第二个频道。 并私下发送给我所有者的消息。与{作者}为{原因}报告的{用户}的结构相同。
但是...我不断收到一些奇怪的错误,例如未定义的bot(即使已定义)。
async def report(self,ctx,user,*,reason=None):
logger = bot.get_channel(644966241835941898)
channel = bot.get_channel(641639710183129113)
if reason is None:
await ctx.author.send('Hey I get that you are trying to report someone but I need a reason. Please try again.')
elif ctx.message.author.guild_permissions.read_messages:
await ctx.channel.send(f'{user} reported by {author} for {reason}')
elif user.guild_permissions.kick_members:
await ctx.logger.send(f'{user},reported by {author} for {reason}')
await ctx.channel.send(author,reason)
await ctx.author.send("""Im going to put this in a safe spot for the wizard himself to review.""")```