Skip to content

Instantly share code, notes, and snippets.

@SkyLeite
Created July 18, 2016 05:04
Show Gist options
  • Select an option

  • Save SkyLeite/9317efa5c3b494ca9bb76bef1fe5c66d to your computer and use it in GitHub Desktop.

Select an option

Save SkyLeite/9317efa5c3b494ca9bb76bef1fe5c66d to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment