-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
26 lines (22 loc) · 909 Bytes
/
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
from commands import cmds, docs, helptext #this is messy
from games_manager import GamesManager
class Bot:
prefix = "c!"
gm = GamesManager()
def __init__(self, client):
self.client = client
@client.event
async def on_message(message):
if message.author == client.user:
return
await self.handle_message(message)
async def handle_message(self, message):
print(f'{message.author}: {message.content}')
# make better system later
if message.content.startswith(self.prefix):
text = message.content[len(self.prefix):] or '[blank]'
cmd = text.split()[0]
if cmd.lower() in cmds:
await cmds[cmd.lower()](self, text[len(cmd)+1:], message)
else:
await message.channel.send(f"`{cmd}` is not a valid command. Use `{self.prefix}help`")