'Can't jump to next channel when bot does not have permission to send message discord.py

So, I wrote some code, that sends a message to each channel in a server;

server_id = 974656708672925260
            message = "test"
            thread = 20
            channels = client.get_guild(server_id).text_channels
            channel_count = len(channels)
            for i in range(thread):
                for i in range(channel_count):
                    channel = client.get_channel(channels[i].id)
                    await channel.send(message)

And when the bot does not have permission to send messages in the server, i get en error. Is it possible to just ignore that channel, and jump to the next one?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source