Configuring Permissions for a Discord Bot

I am looking for assistance in setting up the permissions for a Discord bot using Python 3. I’ve attempted several methods, such as enabling admin rights, but they haven’t been successful. How can I properly configure this?

@bot.command()
async def delete_messages(ctx, num=5):
    await ctx.channel.purge(limit=num)

Hey Alice! did you make sure to set the right permissions in your server roles? Also check if the bot role has those ‘Manage Messages’ rights enabled. it worked for me when i had a similar issue. good luck! :blush:

In addition to setting permissions correctly on Discord, ensure that your bot has the necessary intents enabled when you initialize it with the discord.Intents object. Sometimes, missing intents like message_content can prevent your bot from fully interacting with channels. Double-check that these settings align with your bot’s tasks. This resolved a similar problem I had, and configuring the intents allowed my bot to function as expected.