-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpluginLauncher.py
More file actions
71 lines (65 loc) · 2.49 KB
/
Copy pathpluginLauncher.py
File metadata and controls
71 lines (65 loc) · 2.49 KB
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
"""
Created on 19.09.2010
Last edit on 17.07.2013
Author: crasbe
"""
import imp
from classes.plugins import statistics
from classes.plugins import questionAndAnswer
from classes.plugins import users
#from classes.plugins import maths
from classes.plugins import house
from classes.plugins import net
class PluginLauncher:
""" Plugin-Class:
This class manages the plugins.
Variables:
none
"""
def __init__(self):
""" __init__:
Sets the class attributes.
Nothing fancy here.
Class-Attributes:
self.food - object for food-plugins - type: object
self.stats - object for statistical-plugins - type: object
self.users - object for user-handling plugins - type: object
self.qaa - object for question&answer plugins - type: object
"""
imp.reload(statistics)
imp.reload(questionAndAnswer)
imp.reload(users)
#imp.reload(maths)
imp.reload(house)
imp.reload(net)
self.stats = statistics.Statistics()
self.users = users.Users()
self.qaa = questionAndAnswer.QuestionAndAnswer()
self.house = house.Haus()
#self.maths = maths.Maths()
self.net = net.Net()
def __call__(self, command, channel, username, message):
""" __call__:
This method updates the information needed for the individual plugins.
It also executes the plugins.
Variables:
command - contains the command - type: str
channel - contains the channelname - type: str
username - contains the username of the sender - type: str
message - contains the sended message - type: str
"""
comm = command.strip("!")
if(comm in self.stats.pluginlist):
return self.stats(command, channel, username, message)
elif(comm in self.users.pluginlist):
return self.users(command, channel, username, message)
elif(comm in self.qaa.pluginlist):
return self.qaa(command, channel, username, message)
#elif(command in self.maths.pluginlist):
# return self.maths(command, channel, username, message)
elif(comm in self.house.pluginlist):
return self.house(command, channel, username, message)
#elif(command in self.net.pluginlist):
# return self.net(command, channel, username, message)
else:
return ""