-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
executable file
·75 lines (58 loc) · 2.09 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/python
import time
from optparse import OptionParser
from lib.command_executor import process_event
from lib.irc_connector import connect_to_twitch
from lib.irc_bot import run_bot
from lib.character import Character
from lib.kinesis import send_chat_to_stream
def main():
parser = OptionParser()
# Where to find the Morgue File
parser.add_option("-c", "--char", action="store", type="string", dest="character")
parser.add_option("-l", "--local", action="store_true", dest="local_mode")
parser.add_option(
"-m", "--morgue-file", action="store", type="string", dest="morgue_filepath"
)
parser.add_option(
"-u", "--morgue-url", action="store", type="string", dest="morgue_url"
)
parser.add_option("-s", "--search", action="store", type="string", dest="search")
parser.add_option(
"-b", "--level-barrier", action="store", type="string", dest="level_barrier"
)
# Run in Different Modes
parser.add_option(
"-e", "--exec-cmd", action="store", type="string", dest="exec_command"
)
# Whether to have the bot post back to Twitch
parser.add_option(
"-d", "--disable-twitch", action="store_true", dest="disable_twitch"
)
(options, args) = parser.parse_args()
server = connect_to_twitch()
character = Character(
morgue_filepath=options.morgue_filepath,
morgue_url=options.morgue_url,
name=options.character,
local_mode=options.local_mode,
)
# Create a MorgueEvent
# LOCAL
# CommandLineParser.from_options(options)
# MorgueEvent(command=, character= args=f])
if options.exec_command:
# send_chat_to_stream(f"pastaThat Character: {character.name} pastaThat")
process_event(
{
"character": options.character,
"command": f"!{options.exec_command}",
"level_barrier": options.level_barrier,
"search": options.search,
}
)
else:
# TWITCH CHAT
run_bot(server, character=character)
if __name__ == "__main__":
exit(main())