I haven't touched anything in my code it was working before now it isn't what do I do?
My Code:
@commands.command(aliases=['Purge', "Clear", "clear"])
@commands.has_permissions(manage_messages = True)
async def purge(self,message,ctx,amount=2):
LOG_CHANNEL = self.client.get_channel(898771125482455041)
await ctx.channel.purge(limit=amount)
await ctx.message.delete()
await ctx.send(f":white_check_mark: Cleared `{amount}` Messages!")
embed=nextcord.Embed(title="Messages Cleared", color=0xf2ec00)
embed.add_field(name="Responsible Mod:", value=f"{ctx.author.name}", inline=False)
embed.add_field(name="Channel:", value=f"{ctx.channel.mention}", inline=False)
embed.add_field(name="Amount:", value=f"{amount}", inline=False)
await LOG_CHANNEL.send(embed=embed)
The Error:
AttributeError: 'str' object has no attribute 'channel'
Your arguments are switched around,
ctxneeds to be the first argument, except in a class where it needs to be the second, afterself. If you swapmessageandctxaround it should work.However, I'm not sure why you have a
messageargument in the first place, since you do not seem to use it anywhere. You can just delete it if you are not using it to avoid a missing argument error.