forked from cybits/cybot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
25 lines (24 loc) · 719 Bytes
/
Copy pathconfig.py
File metadata and controls
25 lines (24 loc) · 719 Bytes
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
import sys
import json
import random
class Config:
with open(sys.argv[1], 'r') as data_file:
try:
config = json.loads(data_file.read())
except ValueError:
print('Please provide valid config')
exit(1)
try:
server = config["server"]
port = config["port"]
channels = config["channels"]
if config["bot_nick"]:
bot_nick = config["bot_nick"]
else:
bot_nick = "BOT" + str(random.randint(1, 9999))
password = config["password"]
prefix = config["prefix"]
untappd_cookie = config["untappd_cookie"]
except KeyError:
print('Please provide valid config')
exit(1)