2003-03-27 07:34:48 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
###
|
|
|
|
# Copyright (c) 2002, Jeremiah Fincher
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the author of this software nor the name of
|
|
|
|
# contributors to this software may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written consent.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
###
|
|
|
|
|
|
|
|
"""
|
|
|
|
Miscellaneous commands.
|
|
|
|
"""
|
|
|
|
|
2003-10-05 14:47:19 +02:00
|
|
|
import fix
|
2003-09-07 07:26:18 +02:00
|
|
|
|
2003-03-27 07:34:48 +01:00
|
|
|
import os
|
2003-09-25 10:14:46 +02:00
|
|
|
import sys
|
2003-09-07 07:26:18 +02:00
|
|
|
import getopt
|
2003-09-17 10:07:24 +02:00
|
|
|
from itertools import ifilter
|
2003-03-27 07:34:48 +01:00
|
|
|
|
|
|
|
import conf
|
|
|
|
import debug
|
2003-09-07 07:26:18 +02:00
|
|
|
import utils
|
|
|
|
import ircmsgs
|
|
|
|
import ircutils
|
2003-03-27 07:34:48 +01:00
|
|
|
import privmsgs
|
|
|
|
import callbacks
|
|
|
|
|
2003-09-25 10:22:16 +02:00
|
|
|
def replyWhenNotCommand(irc, msg, notCommands):
|
|
|
|
"""This is called when supybot thinks he has received a command but the
|
|
|
|
apparent command actually isn't a command. Replace it with something that
|
|
|
|
suits your purposes more, if you want.
|
|
|
|
"""
|
2003-10-21 07:02:48 +02:00
|
|
|
def isCtcpCommand(s):
|
|
|
|
return s.startswith('\x01')
|
|
|
|
if not any(isCtcpCommand, notCommands):
|
|
|
|
notCommands = map(repr, notCommands)
|
|
|
|
if len(notCommands) == 1:
|
|
|
|
s = '%s is not a command.' % notCommands[0]
|
|
|
|
else:
|
|
|
|
s = '%s are not commands' % \
|
|
|
|
utils.commaAndify(notCommands)
|
|
|
|
irc.reply(msg, s)
|
2003-10-22 00:24:13 +02:00
|
|
|
|
|
|
|
def reload(x=None):
|
|
|
|
"""Called when this plugin is reloaded."""
|
|
|
|
global replyWhenNotCommand
|
|
|
|
if x is None:
|
|
|
|
return replyWhenNotCommand
|
|
|
|
else:
|
|
|
|
replyWhenNotCommand = x
|
2003-09-25 10:22:16 +02:00
|
|
|
|
2003-10-21 08:03:57 +02:00
|
|
|
class Misc(callbacks.Privmsg):
|
2003-09-10 10:32:20 +02:00
|
|
|
def doPrivmsg(self, irc, msg):
|
|
|
|
# This exists to be able to respond to attempts to command the bot
|
|
|
|
# with a "That's not a command!" if the proper conf.variable is set.
|
|
|
|
callbacks.Privmsg.doPrivmsg(self, irc, msg)
|
2003-10-21 19:14:28 +02:00
|
|
|
notCommands = []
|
|
|
|
ambiguousCommands = {}
|
|
|
|
s = callbacks.addressed(irc.nick, msg)
|
|
|
|
if s:
|
|
|
|
tokens = callbacks.tokenize(s)
|
|
|
|
commands = callbacks.getCommands(tokens)
|
|
|
|
for command in commands:
|
|
|
|
command = callbacks.canonicalName(command)
|
|
|
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
|
|
|
if not cbs:
|
|
|
|
notCommands.append(command)
|
|
|
|
elif len(cbs) > 1:
|
|
|
|
ambiguousCommands[command] = [cb.name() for cb in cbs]
|
|
|
|
if ambiguousCommands:
|
|
|
|
if len(ambiguousCommands) == 1: # Common case.
|
|
|
|
(command, cbs) = ambiguousCommands.popitem()
|
2003-10-21 19:57:16 +02:00
|
|
|
s = 'The command %r is available in the %s plugins. '\
|
2003-10-21 19:14:28 +02:00
|
|
|
'Please specify the plugin whose command you ' \
|
|
|
|
'wish to call by using its name as a command ' \
|
|
|
|
'before %r' % \
|
|
|
|
(command, utils.commaAndify(cbs), command)
|
|
|
|
else:
|
|
|
|
L = []
|
|
|
|
while ambiguousCommands:
|
|
|
|
(command, cbs) = ambiguousCommands.popitem()
|
2003-10-21 21:00:12 +02:00
|
|
|
L.append('The command %r is available in the %s '
|
|
|
|
'plugins' % (command, utils.commaAndify(cbs)))
|
2003-10-21 19:14:28 +02:00
|
|
|
s = '%s; please specify from which plugins to ' \
|
|
|
|
'call these commands.' % '; '.join(L)
|
|
|
|
irc.queueMsg(callbacks.reply(msg, 'Error: ' + s))
|
|
|
|
return
|
|
|
|
if conf.replyWhenNotCommand and msg.nick!=irc.nick and notCommands:
|
2003-09-11 07:31:01 +02:00
|
|
|
for cb in irc.callbacks:
|
|
|
|
if isinstance(cb, callbacks.PrivmsgRegexp) or \
|
|
|
|
isinstance(cb, callbacks.PrivmsgCommandAndRegexp):
|
|
|
|
for (r, _) in cb.res:
|
|
|
|
if r.search(msg.args[1]):
|
|
|
|
return
|
2003-10-09 06:29:37 +02:00
|
|
|
if hasattr(cb, 'addressedRes'):
|
|
|
|
for (r, _) in cb.addressedRes:
|
|
|
|
if r.search(s):
|
|
|
|
return
|
2003-10-21 19:14:28 +02:00
|
|
|
irc = callbacks.IrcObjectProxyRegexp(irc)
|
|
|
|
replyWhenNotCommand(irc, msg, notCommands)
|
2003-09-10 10:32:20 +02:00
|
|
|
|
2003-03-27 07:34:48 +01:00
|
|
|
def list(self, irc, msg, args):
|
2003-09-22 12:22:06 +02:00
|
|
|
"""[--private] [<module name>]
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-09-07 06:05:34 +02:00
|
|
|
Lists the commands available in the given plugin. If no plugin is
|
2003-09-22 12:22:06 +02:00
|
|
|
given, lists the public plugins available. If --private is given,
|
|
|
|
lists all commands, not just the public ones.
|
2003-03-27 07:34:48 +01:00
|
|
|
"""
|
2003-09-22 12:22:06 +02:00
|
|
|
(optlist, rest) = getopt.getopt(args, '', ['private'])
|
2003-09-22 13:43:35 +02:00
|
|
|
evenPrivate = False
|
2003-09-22 12:22:06 +02:00
|
|
|
for (option, argument) in optlist:
|
|
|
|
if option == '--private':
|
|
|
|
evenPrivate = True
|
|
|
|
name = privmsgs.getArgs(rest, needed=0, optional=1)
|
2003-03-27 07:34:48 +01:00
|
|
|
name = name.lower()
|
|
|
|
if not name:
|
2003-04-19 23:41:23 +02:00
|
|
|
names = [cb.name() for cb in irc.callbacks
|
2003-09-22 13:43:35 +02:00
|
|
|
if evenPrivate or (hasattr(cb, 'public') and cb.public)]
|
2003-03-28 08:23:12 +01:00
|
|
|
names.sort()
|
2003-03-27 07:34:48 +01:00
|
|
|
irc.reply(msg, ', '.join(names))
|
|
|
|
else:
|
|
|
|
for cb in irc.callbacks:
|
|
|
|
cls = cb.__class__
|
2003-10-20 07:56:14 +02:00
|
|
|
if cb.name().lower() == name and \
|
2003-03-27 07:34:48 +01:00
|
|
|
not issubclass(cls, callbacks.PrivmsgRegexp) and \
|
|
|
|
issubclass(cls, callbacks.Privmsg):
|
2003-05-29 18:36:34 +02:00
|
|
|
commands = [x for x in dir(cls)
|
2003-10-09 20:06:46 +02:00
|
|
|
if cb.isCommand(x) and
|
|
|
|
hasattr(getattr(cb, x), '__doc__') and
|
|
|
|
callbacks.canonicalName(x) == x]
|
2003-03-28 08:23:12 +01:00
|
|
|
commands.sort()
|
2003-03-27 07:34:48 +01:00
|
|
|
irc.reply(msg, ', '.join(commands))
|
|
|
|
return
|
2003-09-07 06:05:34 +02:00
|
|
|
irc.error(msg, 'There is no plugin named %s, ' \
|
2003-09-22 12:22:06 +02:00
|
|
|
'or that plugin has no commands.' % name)
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-10-20 12:25:13 +02:00
|
|
|
def help(self, irc, msg, args):
|
|
|
|
"""[<plugin>] <command>
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-10-20 12:25:13 +02:00
|
|
|
This command gives a much more useful description than the simple
|
|
|
|
argument list given by the command 'syntax'. <plugin> is only
|
|
|
|
necessary if the command is in more than one plugin.
|
2003-03-27 07:34:48 +01:00
|
|
|
"""
|
2003-10-20 12:25:13 +02:00
|
|
|
def helpFor(method):
|
|
|
|
doclines = method.__doc__.splitlines()
|
|
|
|
simplehelp = '(%s %s)' % (method.__name__, doclines.pop(0))
|
|
|
|
if doclines:
|
|
|
|
doclines = filter(None, doclines)
|
|
|
|
doclines = map(str.strip, doclines)
|
|
|
|
help = ' '.join(doclines)
|
|
|
|
s = '%s -- %s' % (ircutils.bold(simplehelp), help)
|
|
|
|
return s
|
2003-03-27 07:34:48 +01:00
|
|
|
else:
|
2003-10-20 12:25:13 +02:00
|
|
|
return 'That command has no help. The syntax is: %s' % \
|
|
|
|
simplehelp[1:-1]
|
|
|
|
if len(args) > 1:
|
|
|
|
cb = irc.getCallback(args[0])
|
|
|
|
if cb is not None:
|
|
|
|
command = callbacks.canonicalName(privmsgs.getArgs(args[1:]))
|
|
|
|
if hasattr(cb, 'isCommand') and cb.isCommand(command):
|
|
|
|
method = getattr(cb, command)
|
|
|
|
if hasattr(method, '__doc__') and method.__doc__ != None:
|
|
|
|
irc.reply(msg, helpFor(method))
|
|
|
|
else:
|
|
|
|
irc.error(msg, 'That command has no help.')
|
2003-09-25 10:14:46 +02:00
|
|
|
else:
|
2003-10-20 12:25:13 +02:00
|
|
|
irc.error(msg, 'There is no such command %s %s.' %
|
|
|
|
(args[0], command))
|
2003-03-27 07:34:48 +01:00
|
|
|
else:
|
2003-10-20 12:25:13 +02:00
|
|
|
irc.error(msg, 'There is no such plugin %s' % args[0])
|
|
|
|
return
|
2003-03-27 07:34:48 +01:00
|
|
|
command = callbacks.canonicalName(privmsgs.getArgs(args))
|
2003-10-19 21:19:47 +02:00
|
|
|
# Users might expect "@help @list" to work.
|
|
|
|
command = command.lstrip(conf.prefixChars)
|
2003-10-20 12:25:13 +02:00
|
|
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
|
|
|
if len(cbs) > 1:
|
|
|
|
irc.error(msg, 'That command exists in the %s %s. Please specify '
|
|
|
|
'exactly which plugin command you want help with.'%\
|
|
|
|
(utils.commaAndify([cb.name() for cb in cbs]),
|
|
|
|
utils.nItems(len(cbs), 'plugin')))
|
|
|
|
return
|
|
|
|
elif not cbs:
|
|
|
|
irc.error(msg, 'There is no such command %s.' % command)
|
|
|
|
else:
|
|
|
|
cb = cbs[0]
|
2003-03-27 07:34:48 +01:00
|
|
|
method = getattr(cb, command)
|
2003-08-22 09:00:07 +02:00
|
|
|
if hasattr(method, '__doc__') and method.__doc__ is not None:
|
2003-10-20 12:25:13 +02:00
|
|
|
irc.reply(msg, helpFor(method))
|
2003-03-27 07:34:48 +01:00
|
|
|
else:
|
2003-09-25 10:14:46 +02:00
|
|
|
irc.error(msg, '%s has no help or syntax description.'%command)
|
2003-08-20 18:26:23 +02:00
|
|
|
|
2003-09-12 23:16:59 +02:00
|
|
|
def hostmask(self, irc, msg, args):
|
2003-10-21 23:33:27 +02:00
|
|
|
"""[<nick>]
|
2003-09-12 23:16:59 +02:00
|
|
|
|
2003-10-21 23:33:27 +02:00
|
|
|
Returns the hostmask of <nick>. If <nick> isn't given, return the
|
|
|
|
hostmask of the person giving the command.
|
2003-09-12 23:16:59 +02:00
|
|
|
"""
|
2003-10-21 23:33:27 +02:00
|
|
|
nick = privmsgs.getArgs(args, needed=0, optional=1)
|
2003-09-12 23:16:59 +02:00
|
|
|
try:
|
2003-10-21 23:33:27 +02:00
|
|
|
if nick:
|
|
|
|
irc.reply(msg, irc.state.nickToHostmask(nick))
|
|
|
|
else:
|
|
|
|
irc.reply(msg, msg.prefix)
|
2003-09-12 23:16:59 +02:00
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, 'I haven\'t seen anyone named %r' % nick)
|
|
|
|
|
2003-03-27 07:34:48 +01:00
|
|
|
def version(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Returns the version of the current bot.
|
|
|
|
"""
|
2003-08-28 15:59:07 +02:00
|
|
|
irc.reply(msg, conf.version)
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-03-28 09:41:11 +01:00
|
|
|
def source(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Returns a URL saying where to get SupyBot.
|
|
|
|
"""
|
2003-04-08 09:20:42 +02:00
|
|
|
irc.reply(msg, 'My source is at http://www.sf.net/projects/supybot/')
|
2003-03-28 09:41:11 +01:00
|
|
|
|
2003-03-27 07:34:48 +01:00
|
|
|
def logfilesize(self, irc, msg, args):
|
2003-04-14 16:53:58 +02:00
|
|
|
"""[<logfile>]
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-04-14 16:53:58 +02:00
|
|
|
Returns the size of the various logfiles in use. If given a specific
|
|
|
|
logfile, returns only the size of that logfile.
|
2003-03-27 07:34:48 +01:00
|
|
|
"""
|
2003-04-14 16:54:40 +02:00
|
|
|
filename = privmsgs.getArgs(args, needed=0, optional=1)
|
2003-04-14 16:53:58 +02:00
|
|
|
if filename:
|
2003-04-14 16:55:28 +02:00
|
|
|
if not filename.endswith('.log'):
|
2003-04-14 16:53:58 +02:00
|
|
|
irc.error(msg, 'That filename doesn\'t appear to be a log.')
|
|
|
|
return
|
|
|
|
filenames = [filename]
|
|
|
|
else:
|
|
|
|
filenames = os.listdir(conf.logDir)
|
2003-03-27 07:34:48 +01:00
|
|
|
result = []
|
2003-04-14 16:56:59 +02:00
|
|
|
for file in filenames:
|
2003-03-27 07:34:48 +01:00
|
|
|
if file.endswith('.log'):
|
|
|
|
stats = os.stat(os.path.join(conf.logDir, file))
|
|
|
|
result.append((file, str(stats.st_size)))
|
|
|
|
irc.reply(msg, ', '.join(map(': '.join, result)))
|
|
|
|
|
2003-03-27 22:34:50 +01:00
|
|
|
def getprefixchar(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Returns the prefix character(s) the bot is currently using.
|
|
|
|
"""
|
|
|
|
irc.reply(msg, repr(conf.prefixChars))
|
|
|
|
|
2003-09-07 06:05:34 +02:00
|
|
|
def plugin(self, irc, msg, args):
|
2003-04-14 07:54:33 +02:00
|
|
|
"""<command>
|
|
|
|
|
2003-09-07 06:05:34 +02:00
|
|
|
Returns the plugin <command> is in.
|
2003-04-14 07:54:33 +02:00
|
|
|
"""
|
2003-06-18 08:05:33 +02:00
|
|
|
command = callbacks.canonicalName(privmsgs.getArgs(args))
|
2003-10-20 12:25:13 +02:00
|
|
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
|
|
|
if cbs:
|
|
|
|
irc.reply(msg, utils.commaAndify([cb.name() for cb in cbs]))
|
2003-04-14 07:54:33 +02:00
|
|
|
else:
|
|
|
|
irc.error(msg, 'There is no such command %s' % command)
|
|
|
|
|
2003-09-07 06:05:34 +02:00
|
|
|
def more(self, irc, msg, args):
|
2003-09-07 08:42:17 +02:00
|
|
|
"""[<nick>]
|
2003-09-07 06:05:34 +02:00
|
|
|
|
|
|
|
If the last command was truncated due to IRC message length
|
|
|
|
limitations, returns the next chunk of the result of the last command.
|
2003-09-12 00:21:56 +02:00
|
|
|
If <nick> is given, it takes the continuation of the last command from
|
2003-09-07 08:42:17 +02:00
|
|
|
<nick> instead of the person sending this message.
|
2003-09-07 06:05:34 +02:00
|
|
|
"""
|
2003-09-07 08:42:17 +02:00
|
|
|
nick = privmsgs.getArgs(args, needed=0, optional=1)
|
2003-09-07 08:48:42 +02:00
|
|
|
userHostmask = msg.prefix.split('!', 1)[1]
|
2003-09-07 08:42:17 +02:00
|
|
|
if nick:
|
|
|
|
try:
|
2003-09-22 15:07:20 +02:00
|
|
|
(private, L) = self._mores[nick]
|
|
|
|
if not private:
|
2003-09-08 21:43:33 +02:00
|
|
|
self._mores[userHostmask] = L[:]
|
|
|
|
else:
|
|
|
|
irc.error(msg, '%s has no public mores.' % nick)
|
|
|
|
return
|
2003-09-07 08:42:17 +02:00
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, 'Sorry, I can\'t find a hostmask for %s' % nick)
|
|
|
|
return
|
2003-09-07 06:05:34 +02:00
|
|
|
try:
|
2003-09-07 07:13:58 +02:00
|
|
|
L = self._mores[userHostmask]
|
|
|
|
chunk = L.pop()
|
|
|
|
if L:
|
|
|
|
chunk += ' \x02(%s)\x0F' % \
|
|
|
|
utils.nItems(len(L), 'message', 'more')
|
2003-09-07 06:56:26 +02:00
|
|
|
irc.reply(msg, chunk, True)
|
2003-09-07 06:05:34 +02:00
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, 'You haven\'t asked me a command!')
|
|
|
|
except IndexError:
|
|
|
|
irc.error(msg, 'That\'s all, there is no more.')
|
|
|
|
|
2003-09-17 10:07:24 +02:00
|
|
|
def _validLastMsg(self, msg):
|
|
|
|
return msg.prefix and \
|
|
|
|
msg.command == 'PRIVMSG' and \
|
|
|
|
ircutils.isChannel(msg.args[0])
|
|
|
|
|
2003-09-07 07:26:18 +02:00
|
|
|
def last(self, irc, msg, args):
|
|
|
|
"""[--{from,in,to,with,regexp,fancy}] <args>
|
|
|
|
|
|
|
|
Returns the last message matching the given criteria. --from requires
|
|
|
|
a nick from whom the message came; --in and --to require a channel the
|
|
|
|
message was sent to; --with requires some string that had to be in the
|
|
|
|
message; --regexp requires a regular expression the message must match
|
|
|
|
--fancy determines whether or not to show the nick; the default is not
|
|
|
|
"""
|
|
|
|
(optlist, rest) = getopt.getopt(args, '', ['from=', 'in=', 'to=',
|
|
|
|
'with=', 'regexp=',
|
|
|
|
'fancy'])
|
|
|
|
fancy = False
|
|
|
|
predicates = []
|
|
|
|
for (option, arg) in optlist:
|
|
|
|
option = option.strip('-')
|
|
|
|
if option == 'fancy':
|
|
|
|
fancy = True
|
|
|
|
elif option == 'from':
|
|
|
|
predicates.append(lambda m, arg=arg: m.nick == arg)
|
|
|
|
elif option == 'in' or option == 'to':
|
|
|
|
if not ircutils.isChannel(arg):
|
|
|
|
irc.error(msg, 'Argument to --%s must be a channel.' % arg)
|
|
|
|
return
|
|
|
|
predicates.append(lambda m, arg=arg: m.args[0] == arg)
|
|
|
|
elif option == 'with':
|
|
|
|
predicates.append(lambda m, arg=arg: arg in m.args[1])
|
|
|
|
elif option == 'regexp':
|
|
|
|
try:
|
|
|
|
r = utils.perlReToPythonRe(arg)
|
|
|
|
except ValueError, e:
|
|
|
|
irc.error(msg, str(e))
|
|
|
|
return
|
|
|
|
predicates.append(lambda m: r.search(m.args[1]))
|
|
|
|
first = True
|
2003-09-17 10:07:24 +02:00
|
|
|
for m in ifilter(self._validLastMsg, reviter(irc.state.history)):
|
2003-09-07 07:26:18 +02:00
|
|
|
if first:
|
|
|
|
first = False
|
|
|
|
continue
|
|
|
|
for predicate in predicates:
|
|
|
|
if not predicate(m):
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
if fancy:
|
|
|
|
irc.reply(msg, ircmsgs.prettyPrint(m))
|
|
|
|
else:
|
|
|
|
irc.reply(msg, m.args[1])
|
|
|
|
return
|
|
|
|
irc.error(msg, 'I couldn\'t find a message matching that criteria.')
|
|
|
|
|
|
|
|
def tell(self, irc, msg, args):
|
|
|
|
"""<nick|channel> <text>
|
|
|
|
|
|
|
|
Tells the <nick|channel> whatever <text> is. Use nested commands to
|
|
|
|
your benefit here.
|
|
|
|
"""
|
|
|
|
(target, text) = privmsgs.getArgs(args, needed=2)
|
|
|
|
s = '%s wants me to tell you: %s' % (msg.nick, text)
|
|
|
|
irc.queueMsg(ircmsgs.privmsg(target, s))
|
|
|
|
raise callbacks.CannotNest
|
|
|
|
|
2003-10-03 17:42:11 +02:00
|
|
|
def private(self, irc, msg, args):
|
|
|
|
"""<text>
|
|
|
|
|
|
|
|
Replies with <text> in private. Use nested commands to your benefit
|
|
|
|
here.
|
|
|
|
"""
|
|
|
|
text = privmsgs.getArgs(args)
|
|
|
|
irc.reply(msg, text, private=True)
|
|
|
|
|
2003-10-20 12:10:46 +02:00
|
|
|
def notice(self, irc, msg, args):
|
|
|
|
"""<text>
|
|
|
|
|
|
|
|
Replies with <text> in a private notice. Use nested commands to your
|
|
|
|
benefit here.
|
|
|
|
"""
|
|
|
|
text = privmsgs.getArgs(args)
|
|
|
|
irc.reply(msg, text, notice=True)
|
2003-09-07 07:26:18 +02:00
|
|
|
|
2003-03-27 07:34:48 +01:00
|
|
|
|
2003-10-21 08:03:57 +02:00
|
|
|
Class = Misc
|
2003-03-27 07:34:48 +01:00
|
|
|
|
|
|
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|