title: How to change the permission of all text channels with discord.py and Python?
body: <p>I would like to make a command that allows to modify the permissions of all text channels with discord.py. For example, disable sending messages in all text channels.</p>
  
  <p>I looked at the documentation for discord.py, and I saw that there is a PermissionOverwrite class (<a href="https://discordpy.readthedocs.io/en/latest/api.html?highlight=app#permissionoverwrite" rel="nofollow noreferrer">https://discordpy.readthedocs.io/en/latest/api.html?highlight=app#permissionoverwrite</a>) allowing to do some things at the level of the permissions (notably with the function update).</p>
  
  <pre class="lang-py prettyprint-override"><code>@client.command()
  async def lock(ctx):
          ctx.channel.set_permissions(ctx.guild.default_role, send_messages=False)
  </code></pre>