forked from FailedSave/enhanced-discord-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
37 lines (28 loc) · 1.05 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
import discord
import game
import character
import json
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content.startswith('!join'):
await game.join_game(message)
if message.content.startswith('!char'):
await character.handle_char(message)
if message.content == '!quit':
if message.author.id != 261495649327906816:
return
await message.channel.send('shutting down')
await self.close()
if message.content == '!roll':
await game.player_roll(message)
if message.content == '!pass' or message.content == '!bank':
await game.player_pass(message)
with open('.connections.json') as json_data:
connections = json.load(json_data)
client = MyClient()
client.run(connections["PROD"])