forked from wardellbagby/HangoutsBot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.py
44 lines (40 loc) · 1.46 KB
/
Main.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
44
import argparse
import os
from Core.Bot import HangoutsBot
base_config = '''{
"admins": ["YOUR-USER-ID-HERE"],
"autoreplies_enabled": true,
"autoreplies": [
[["bot", "robot", "Yo"], "/think {}"]
],
"development_mode": false,
"commands_admin": ["hangouts", "reload", "quit", "restart", "config", "restart", "block"],
"commands_enabled": true,
"forwarding_enabled": false,
"rename_watching_enabled": true,
"conversations": {
"CONV-ID-HERE": {
"autoreplies": [
[["whistle", "bot", "whistlebot"], "/think {}"],
[["trash"], "You're trash"]
],
"forward_to": [
"CONV1_ID"
]
}
}
}'''
# TODO Factor in an arg parser.
if __name__ == "__main__":
# This commands auto updates the project. Please have Git installed and in your PATH variable on Windows.
os.system("git pull")
if os.path.isfile("config.json"):
HangoutsBot("cookies.txt", "config.json", command_char='/').run()
elif os.path.isfile("Core" + os.sep + "config.json"):
HangoutsBot("Core" + os.sep + "cookies.txt", "Core" + os.sep + "config.json", command_char='/').run()
else:
print("Error finding config.json file. Creating default config file in at Core/config.json")
config_file = open("Core" + os.sep + "config.json", 'w+')
config_file.writelines(base_config)
config_file.close()
HangoutsBot("Core" + os.sep + "cookies.txt", "Core" + os.sep + "config.json", command_char='/').run()