Search code examples
pythondiscorddiscord.py

Get all text channels and change permissions in Discord.py


I would like to be able to change the send_messages permission to off to be able to lock all channels, like "lockdown" command.

The command : await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)


Solution

  • for channel in guild.channels:
           if isinstance(channel, discord.TextChannel):
               await channel.set_permissions(guild.default_role, send_messages=False)
    

    Try this out :D