4 from plugins
import Plugins
5 import configuration
as conf
6 from debug
import Debug
9 if conf
.LIBS_PATH
not in sys
.path
:
10 sys
.path
.append(conf
.LIBS_PATH
)
14 class PyIRCBot(Plugins
, Debug
):
16 Plugins
.__init
__(self
, conf
.PLUGIN_PATH
)
19 """Connect to host. Set name. Identify"""
20 self
.irc
= irclib
.IRC()
21 self
.server
= self
.irc
.server()
22 self
.server
.connect(conf
.CONNECT_HOST
, 6667, conf
.IRC_NAME
,
23 conf
.IRC_PASSWORD
, conf
.IRC_IDENT
, conf
.IRC_REALNAME
)
24 self
.server
.join(conf
.CONNECT_CHANNEL
)
26 def run_plugins(self
):
28 # get the message and save it.
29 self
.server
.msg_data
= self
.server
.process_data()
30 # save msg dict as msg_data['msg_list']
31 # no more message split needed ;)
33 self
.server
.msg_data
['msg_list'] = \
34 self
.server
.msg_data
['args'][0].split()
35 except (IndexError, TypeError):
36 self
.server
.msg_data
['msg_list'] = ''
37 for plugin
in self
.plugins
:
41 """Start the main loop."""
42 while self
.server
.connected
:
47 if __name__
== "__main__":
56 except KeyboardInterrupt: