viewing paste Unknown #29230 | Python

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
        for item in eq_channels['channels']: #reads every channel on eq_channels.json
            if client.get_channel(item): #checks if the channel exists
                channel = client.get_channel(item)
 
                await client.send_message(discord.Object(item), message) #sends message to channel if it does
                
                if client.get_channel(test_channel): #checks if test_channel exists (logging channel)
                    await client.send_message(discord.Object(test_channel), 'EQ Alert sent to: ``%s`` (%s)' % (
                        channel.server.name, channel.server.id)) #sends 'EQ Alert sent to: (servername)' to logging channel
            
            else: #if eq channel doesn't exist, removes it
                msg = ':mega: **Alert!**\n Channel %s does not exist. Removing...' % item
                if client.get_channel(test_channel):
                    await client.send_message(discord.Object(test_channel), msg)
                await removeEQChannel(item)
Viewed 814 times, submitted by Guest.