viewing paste Unknown #29292 | Python

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
from functions import *
from settings import *
 
client = discord.Client()
 
print("Starting bot...\n")
 
 
@client.event
async def on_ready():
    print("## BOT IS RUNNING ##")
    print('Username: %s' % client.user.name)
    print('ID: %s' % client.user.id)
    print('------')
 
 
@client.event
async def on_message(message):
    if message.content.startswith('!lasteq'):
        await showLastEQ(client, message)
 
    elif message.content.startswith('!discord'):
        await client.send_message(message.channel, '`The Herd:` https://discord.gg/QX2yq2n')
 
    elif message.content.startswith('!servers'):
        servers = []
 
        for item in client.servers:
            servers.append('%s(%d)' % (item.name, item.member_count))
 
        string = ', '.join(servers)
        await client.send_message(message.channel, 'Servers: %s' % string)
 
    elif message.content.startswith('!game'):
        if message.author.id == ownerid:
            gamename = message.content.split(' ', 1)[1]
 
            game = discord.Game(name=gamename)
            await client.change_status(game, idle=False)
        else:
            await client.send_message(message.channel, 'Your ID:%s \nOwner ID:%s' % (message.author.id, ownerid))
 
 
    elif message.content.startswith('!eq'):
        admin = 'False'
 
        if message.content == '!eq enable':
            for item in message.author.roles:
                if item.name == "Broadcaster":
                    await addEQChannel(message, client)
                    admin = 'True'
            if admin == 'False':
                await client.send_message(message.channel, "You need the 'Broadcaster' role to do that.")
 
 
        elif message.content == '!eq disable':
            for item in message.author.roles:
                if item.name == "Broadcaster":
                    await removeEQChannel(message.channel.id)
                    await client.send_message(message.channel, 'EQ Alerts successfully disabled on this channel.')
                    admin = 'True'
            if admin == 'False':
                await client.send_message(message.channel, "You need the 'Broadcaster' role to do that.")
 
        else:
            await client.send_message(message.channel,
                                      "Welcome to Minuette's Emergency Quest Alert! To get started, please type !eq enable on the channel you want EQs to appear. Please keep in mind you need the 'Broadcaster' role to do that.")
 
 
@client.event
async def on_server_join(server):
    if test_channel:
        await client.send_message(discord.Object(test_channel), u':mega: **Joined:** {0:s}\n``Member Count:`` {1:s}\n``Icon URL:`` {2:s}'.format(
          server.name, server.member_count, server.icon_url))
 
 
loop = asyncio.get_event_loop()
 
try:
    loop.create_task(backgroundTask(client))
    loop.run_until_complete(client.login(token))
    loop.run_until_complete(client.connect())
except Exception:
    loop.run_until_complete(client.close())
finally:
    loop.close()
 
Viewed 785 times, submitted by Guest.