-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBot.py
43 lines (32 loc) · 1.29 KB
/
Bot.py
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
import os
import discord
from Glitcher import Glitcher
class Bot(discord.Client):
def __init__(self, *args, **kwargs):
print('Initializing bot...')
super().__init__(*args, **kwargs)
self.shouldUpdate = 0
async def on_ready(self):
print('Successfully loaded bot. Currently online.')
async def on_message(self, message):
# Ignore messages from self
if message.author.id == self.user.id:
return
elif message.content == '!gb':
if len(message.attachments) > 0:
glitcher = Glitcher(message.attachments[0].url)
glitch = glitcher.glitch()
await message.channel.send(file=discord.File(glitch.name))
elif message.content.startswith('!gb update'):
await message.channel.send('Requesting update...')
self.shouldUpdate = 1
await self.close()
elif message.content.startswith('!gb stop'):
await self.close()
elif message.content.startswith('!gb help'):
msg = 'GlitchBot v2.0 Commands\n' + \
'========================\n' + \
'!gb: glitch attached image\n' + \
'!gb update: request update from server\n' + \
'!gb stop: shut down bot'
await message.channel.send(msg)