-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
58 lines (45 loc) · 1.57 KB
/
Copy pathbot.py
File metadata and controls
58 lines (45 loc) · 1.57 KB
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
import discord
import asyncio
import logging as log
import xml.etree.ElementTree as ET
from functions.Class import Class
from functions.Help import Help
from functions.config import prefix, game
logger = log.getLogger('discord')
logger.setLevel(log.DEBUG)
handler = log.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(log.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
await client.change_presence(game=game)
@client.event
async def on_message(message):
if message.content.startswith(prefix+'ping'):
await client.send_message(message.channel, 'Pong!')
elif message.content.startswith(prefix+'kill'):
if message.author.id == '90455370073391104':
await client.send_message(message.channel, 'Goodbye!')
await client.logout()
elif message.content.startswith(prefix+'sleep'):
await asyncio.sleep(5)
await client.send_message(message.channel, 'Done sleeping')
elif message.content.startswith(prefix+'class'):
text = message.content.split()
search = text[1]
level = text[2]
output = Class(search, level)
await client.send_message(message.channel, output)
elif message.content.startswith(prefix+'help'):
text = message.content.split()
if len(text) == 1:
output = Help()
else:
output = Help(text[1])
await client.send_message(message.channel, output)
client.run('Mjc5NzA3MTI4NDQ3MzY5MjI1.C4A0ew.imNroIewdBK6uDysddZu-pmY-48')