2011-01-06 23:25:46 -06:00
|
|
|
"""
|
|
|
|
IrcAdmin - handle normal IRC functions one would expect
|
|
|
|
Copyright (C) 2010 Brian S. Stephan
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
2010-07-28 23:47:29 -05:00
|
|
|
|
2010-07-27 20:35:01 -05:00
|
|
|
from ConfigParser import NoOptionError
|
2010-07-29 23:51:43 -05:00
|
|
|
import signal
|
2010-07-29 23:19:17 -05:00
|
|
|
import sys
|
2010-07-29 00:18:20 -05:00
|
|
|
|
2010-07-30 18:34:10 -05:00
|
|
|
from extlib import irclib
|
2010-07-29 00:18:20 -05:00
|
|
|
|
|
|
|
from Module import Module
|
2010-07-27 20:35:01 -05:00
|
|
|
|
|
|
|
class IrcAdmin(Module):
|
|
|
|
|
2011-01-06 23:25:46 -06:00
|
|
|
"""Support miscellaneous IRC stuff --- joining channels, changing the nick, etc."""
|
|
|
|
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
def register_handlers(self):
|
|
|
|
self.server.add_global_handler('pubmsg', self.on_pub_or_privmsg, self.priority())
|
|
|
|
self.server.add_global_handler('privmsg', self.on_pub_or_privmsg, self.priority())
|
|
|
|
self.server.add_global_handler('welcome', self.on_connect, self.priority())
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2010-07-29 22:36:08 -05:00
|
|
|
def unregister_handlers(self):
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
self.server.remove_global_handler('pubmsg', self.on_pub_or_privmsg)
|
|
|
|
self.server.remove_global_handler('privmsg', self.on_pub_or_privmsg)
|
2010-07-29 22:36:08 -05:00
|
|
|
self.server.remove_global_handler('welcome', self.on_connect)
|
|
|
|
|
2010-07-27 20:35:01 -05:00
|
|
|
def on_connect(self, connection, event):
|
2011-01-06 23:25:46 -06:00
|
|
|
"""Set up handlers when the bot has connected to IRC."""
|
2010-07-27 20:35:01 -05:00
|
|
|
|
|
|
|
# user modes
|
|
|
|
try:
|
2010-08-01 11:41:26 -05:00
|
|
|
nick = self.config.get('dr.botzo', 'nick')
|
|
|
|
usermode = self.config.get('dr.botzo', 'usermode')
|
2010-07-29 19:45:02 -05:00
|
|
|
connection.mode(nick, usermode)
|
2010-07-27 20:35:01 -05:00
|
|
|
except NoOptionError: pass
|
|
|
|
|
|
|
|
# join the specified channels
|
|
|
|
try:
|
2010-08-01 11:41:26 -05:00
|
|
|
autojoins = self.config.get(self.__class__.__name__, 'autojoin').split(',')
|
2010-07-27 20:35:01 -05:00
|
|
|
for channel in autojoins:
|
|
|
|
if irclib.is_channel(channel):
|
|
|
|
connection.join(channel)
|
|
|
|
except NoOptionError: pass
|
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def do(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-04 12:26:50 -05:00
|
|
|
"""Try all the admin methods."""
|
|
|
|
|
2010-07-27 20:35:01 -05:00
|
|
|
# TODO: sophisticate. also, document all of these
|
|
|
|
|
|
|
|
whats = what.split(' ')
|
2010-09-04 12:26:50 -05:00
|
|
|
|
2011-01-07 20:37:24 -06:00
|
|
|
if whats[0] == '!join' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_join_channel(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!part' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_part_channel(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!quit' and admin_unlocked:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_quit_irc(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!autojoin' and admin_unlocked and len(whats) >= 3:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_autojoin_manipulate(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-08 09:16:37 -06:00
|
|
|
elif whats[0] == '!save' and admin_unlocked:
|
2011-01-08 00:49:10 -06:00
|
|
|
self.irc.save_modules()
|
2011-01-08 09:16:37 -06:00
|
|
|
self.irc.save_config()
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, 'Saved.')
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!nick' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_change_nick(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!load' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_load_module(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!reload' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_reload_module(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-07 20:37:24 -06:00
|
|
|
elif whats[0] == '!unload' and admin_unlocked and len(whats) >= 2:
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_unload_module(connection, event, nick, userhost, what, admin_unlocked))
|
2011-01-08 01:22:31 -06:00
|
|
|
elif whats[0] == '!modules':
|
rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.
with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.
to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.
that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
|
|
|
return self.reply(connection, event, self.sub_list_modules(connection, event, nick, userhost, what, admin_unlocked))
|
2010-09-04 12:26:50 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_join_channel(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-08 19:24:26 -05:00
|
|
|
whats = what.split(' ')
|
|
|
|
|
2010-09-04 12:26:50 -05:00
|
|
|
channel = whats[1]
|
|
|
|
if irclib.is_channel(channel):
|
|
|
|
connection.join(channel)
|
2010-12-15 20:58:13 -06:00
|
|
|
replystr = 'Joined ' + channel + '.'
|
2011-01-07 23:09:07 -06:00
|
|
|
return replystr
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_part_channel(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-08 19:24:26 -05:00
|
|
|
whats = what.split(' ')
|
|
|
|
|
2010-09-04 12:26:50 -05:00
|
|
|
channel = whats[1]
|
|
|
|
if irclib.is_channel(channel):
|
|
|
|
connection.part(channel, ' '.join(whats[2:]))
|
2010-12-15 20:58:13 -06:00
|
|
|
replystr = 'Parted ' + channel + '.'
|
2011-01-07 23:09:07 -06:00
|
|
|
return replystr
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_quit_irc(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-08 19:24:26 -05:00
|
|
|
whats = what.split(' ')
|
migrate some code that became pivotal to the bot into DrBotIRC.
this is a big change. DrBotIrc is now in charge of module loading
and unloading, aliases, and recursion. the Alias module is no more,
and a bunch of functionality was moved out of IrcAdmin, including
also config file saving, the sigint handler, and quitting the bot.
additionally, a lot of stuff got caught in the wake. dr.botzo.py
is simpler now, and lets DrBotIRC do the dynamic loading stuff.
Module.__init__ changed, modules no longer get modlist and instead
get a reference to the DrBotIRC object. IrcAdmin still has the same
exposed methods, but now calls out to DrBotIRC to achieve some of
them.
naturally, a recursion/alias rewrite was included with this change.
it is clearer now (i think), but probably brittle somewhere.
additionally, currently any module that has registered a pubmsg
handler can potentially fire more than once on one input (without
recursion). this may be the next thing to fix. do() may need to
be split, or maybe it's time to stop having modules deal with
pubmsg/privmsg entirely. need to decide.
WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
2011-01-07 17:38:26 -06:00
|
|
|
self.irc.quit_irc(connection, ' '.join(whats[1:]))
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_autojoin_manipulate(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-08 19:24:26 -05:00
|
|
|
whats = what.split(' ')
|
|
|
|
|
2010-09-04 12:26:50 -05:00
|
|
|
if whats[1] == 'add':
|
|
|
|
try:
|
|
|
|
# get existing list
|
|
|
|
channel = whats[2]
|
|
|
|
if irclib.is_channel(channel):
|
|
|
|
channelset = set(self.config.get(self.__class__.__name__, 'autojoin').split(','))
|
|
|
|
channelset.add(channel)
|
|
|
|
self.config.set(self.__class__.__name__, 'autojoin', ','.join(channelset))
|
2010-12-15 20:58:13 -06:00
|
|
|
replystr = 'Added ' + channel + ' to autojoin.'
|
2011-01-07 23:09:07 -06:00
|
|
|
return replystr
|
2010-09-04 12:26:50 -05:00
|
|
|
except NoOptionError: pass
|
|
|
|
elif whats[1] == 'remove':
|
|
|
|
try:
|
|
|
|
# get existing list
|
|
|
|
channel = whats[2]
|
|
|
|
if irclib.is_channel(channel):
|
|
|
|
channelset = set(self.config.get(self.__class__.__name__, 'autojoin').split(','))
|
|
|
|
channelset.discard(channel)
|
|
|
|
self.config.set(self.__class__.__name__, 'autojoin', ','.join(channelset))
|
2010-12-15 20:58:13 -06:00
|
|
|
replystr = 'Removed ' + channel + ' from autojoin.'
|
2011-01-07 23:09:07 -06:00
|
|
|
return replystr
|
2010-09-04 12:26:50 -05:00
|
|
|
except NoOptionError: pass
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_change_nick(self, connection, event, nick, userhost, what, admin_unlocked):
|
2010-09-08 19:24:26 -05:00
|
|
|
whats = what.split(' ')
|
|
|
|
|
2010-09-04 12:26:50 -05:00
|
|
|
newnick = whats[1]
|
|
|
|
connection.nick(newnick)
|
|
|
|
self.config.set('dr.botzo', 'nick', newnick)
|
|
|
|
replystr = 'changed nickname'
|
2011-01-07 23:09:07 -06:00
|
|
|
return replystr
|
2010-07-27 20:35:01 -05:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_load_module(self, connection, event, nick, userhost, what, admin_unlocked):
|
2011-01-06 23:25:46 -06:00
|
|
|
"""Load a module (in both the python and dr.botzo sense) if not
|
|
|
|
already loaded.
|
2010-12-15 21:17:24 -06:00
|
|
|
"""
|
|
|
|
|
|
|
|
whats = what.split(' ')
|
2011-01-07 23:09:07 -06:00
|
|
|
return self.irc.load_module(whats[1])
|
2010-12-15 21:17:24 -06:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_unload_module(self, connection, event, nick, userhost, what, admin_unlocked):
|
2011-01-06 23:25:46 -06:00
|
|
|
"""Attempt to unload and del a module if it's loaded."""
|
2010-12-15 21:28:57 -06:00
|
|
|
|
|
|
|
whats = what.split(' ')
|
2011-01-07 23:09:07 -06:00
|
|
|
return self.irc.unload_module(whats[1])
|
2011-01-06 19:54:16 -06:00
|
|
|
|
2011-01-07 23:09:07 -06:00
|
|
|
def sub_reload_module(self, connection, event, nick, userhost, what, admin_unlocked):
|
2011-01-06 23:25:46 -06:00
|
|
|
"""Attempt to reload a module, by removing it from memory and then
|
|
|
|
re-initializing it.
|
2011-01-06 19:54:16 -06:00
|
|
|
"""
|
|
|
|
|
|
|
|
whats = what.split(' ')
|
2011-01-07 23:09:07 -06:00
|
|
|
return self.irc.reload_module(whats[1])
|
2010-07-29 23:51:43 -05:00
|
|
|
|
2011-01-08 01:22:31 -06:00
|
|
|
def sub_list_modules(self, connection, event, nick, userhost, what, admin_unlocked):
|
|
|
|
"""Get the list of loaded modules from DrBotIRC and display it."""
|
|
|
|
|
|
|
|
return ', '.join(self.irc.list_modules())
|
|
|
|
|
2011-01-08 23:41:41 -06:00
|
|
|
def help_description(self):
|
|
|
|
"""Return a quick list of commands or other summary, should be
|
|
|
|
less than two lines. If you want the module hidden from "!help",
|
|
|
|
return None here"""
|
|
|
|
return "Perform admin-related functions."
|
|
|
|
|
|
|
|
def help_summary(self):
|
|
|
|
"""Return a command summary or longer description of this module.
|
|
|
|
If this returns None, the summary will be
|
|
|
|
"no help available for module foo"
|
|
|
|
"""
|
2011-01-20 14:15:10 -06:00
|
|
|
return """Bot admin commands (do '!help IrcAdmin [cmd] for details):
|
2011-01-08 23:41:41 -06:00
|
|
|
!join, !part, !quit, !autojoin, !save, !nick, !load, !reload, !unload, !modules"""
|
|
|
|
|
|
|
|
def help_detail(self, command):
|
|
|
|
"""Return detailed help for the given command. Return None if there
|
|
|
|
is no suitable help available"""
|
|
|
|
key = command.strip()
|
|
|
|
if key[0] == '!':
|
|
|
|
key = key[1:]
|
|
|
|
words = key.split()
|
|
|
|
if len(words) == 0:
|
|
|
|
return None
|
|
|
|
elif words[0] == 'join':
|
|
|
|
return "!join [channel] - cause the bot to /join [channel]"
|
|
|
|
elif words[0] == 'part':
|
|
|
|
return "!part [channel] - cause the bot to /part from [channel]"
|
|
|
|
elif words[0] == 'quit':
|
|
|
|
return "!quit - cause the bot to save itself and quit"
|
|
|
|
elif words[0] == 'autojoin':
|
|
|
|
return "!autojoin [channel] - cause the bot to join [channel] on startup"
|
|
|
|
elif words[0] == 'save':
|
|
|
|
return "!save - cause the bot to save config data to the config file"
|
|
|
|
elif words[0] == 'nick':
|
|
|
|
return "!nick - cause the bot to change its nick"
|
|
|
|
elif words[0] == 'load':
|
|
|
|
return "!load - make the bot load a module dynamically"
|
|
|
|
elif words[0] == 'reload':
|
|
|
|
return "!reload - reload an already-loaded module"
|
|
|
|
elif words[0] == 'unload':
|
|
|
|
return "!unload - unload a loaded module, removing its functionality"
|
|
|
|
elif words[0] == 'modules':
|
|
|
|
return "!modules - list the currently loaded modules"
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
2010-07-28 23:48:47 -05:00
|
|
|
# vi:tabstop=4:expandtab:autoindent
|
2010-07-28 00:11:58 -05:00
|
|
|
# kate: indent-mode python;indent-width 4;replace-tabs on;
|