-
Notifications
You must be signed in to change notification settings - Fork 1
/
CommandFactory.py
30 lines (27 loc) · 967 Bytes
/
CommandFactory.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
from FAQ_Command import FAQ_Command
from LastQuote_Command import LastQuote_Command
from Quote_Command import Quote_Command
from Stats_Command import Stats_Command
from Xkcd_Command import Xkcd_Command
from Ballot_Command import Ballot_Command
class CommandFactory():
def factory(cmd, conn, event, channel, start_time): # last, quote, faq, stats, relevant, ballot
cfg = {
'connection': conn,
'event': event,
'channel': channel,
'start': start_time
}
if "!last" == cmd:
return LastQuote_Command(cfg)
elif "!quote" == cmd:
return Quote_Command(cfg)
elif "!faq" == cmd:
return FAQ_Command(cfg)
elif "!stats" == cmd:
return Stats_Command(cfg)
elif "!relevant" == cmd:
return Xkcd_Command(cfg)
elif "!ballot" == cmd:
return Ballot_Command(cfg)
factory = staticmethod(factory)