mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Changed callbacks.Privmsg to be callbacks.Plugin, and callbacks.PrivmsgCommandAndRegexp to be callbacks.Plugin.
This commit is contained in:
parent
3c3b729ee7
commit
b0cb616709
@ -39,7 +39,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Admin(callbacks.Privmsg):
|
||||
class Admin(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Admin, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -162,7 +162,7 @@ def makeNewAlias(name, alias):
|
||||
f = utils.changeFunctionName(f, name, doc)
|
||||
return f
|
||||
|
||||
class Alias(callbacks.Privmsg):
|
||||
class Alias(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Alias, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -33,7 +33,7 @@ from supybot.commands import *
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Anonymous(callbacks.Privmsg):
|
||||
class Anonymous(callbacks.Plugin):
|
||||
"""This plugin allows users to act through the bot anonymously. The 'do'
|
||||
command has the bot perform an anonymous action in a given channel, and
|
||||
the 'say' command allows other people to speak through the bot. Since
|
||||
|
@ -38,7 +38,7 @@ import supybot.callbacks as callbacks
|
||||
class Continue(Exception):
|
||||
pass # Used below, look in the "do" function nested in doJoin.
|
||||
|
||||
class AutoMode(callbacks.Privmsg):
|
||||
class AutoMode(callbacks.Plugin):
|
||||
def doJoin(self, irc, msg):
|
||||
channel = msg.args[0]
|
||||
if ircutils.strEqual(irc.nick, msg.nick):
|
||||
|
@ -34,7 +34,7 @@ import supybot.utils as utils
|
||||
from supybot.commands import *
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Babelfish(callbacks.Privmsg):
|
||||
class Babelfish(callbacks.Plugin):
|
||||
threaded = True
|
||||
_abbrevs = utils.gen.abbrev(map(str.lower, babelfish.available_languages))
|
||||
_abbrevs['de'] = 'german'
|
||||
|
@ -38,7 +38,7 @@ import supybot.schedule as schedule
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Channel(callbacks.Privmsg):
|
||||
class Channel(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Channel, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -47,7 +47,7 @@ class FakeLog(object):
|
||||
def write(self, s):
|
||||
return
|
||||
|
||||
class ChannelLogger(callbacks.Privmsg):
|
||||
class ChannelLogger(callbacks.Plugin):
|
||||
noIgnore = True
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(ChannelLogger, self)
|
||||
|
@ -149,7 +149,7 @@ class StatsDB(plugins.ChannelUserDB):
|
||||
return self[channel, id]
|
||||
|
||||
filename = conf.supybot.directories.data.dirize('ChannelStats.db')
|
||||
class ChannelStats(callbacks.Privmsg):
|
||||
class ChannelStats(callbacks.Plugin):
|
||||
noIgnore = True
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(ChannelStats, self)
|
||||
@ -164,7 +164,7 @@ class ChannelStats(callbacks.Privmsg):
|
||||
def die(self):
|
||||
world.flushers.remove(self._flush)
|
||||
self.db.close()
|
||||
callbacks.Privmsg.die(self)
|
||||
self.__parent.die()
|
||||
|
||||
def __call__(self, irc, msg):
|
||||
try:
|
||||
|
@ -99,7 +99,7 @@ def getConfigVar(irc, msg, args, state):
|
||||
irc.errorInvalid('configuration variable', str(e))
|
||||
addConverter('configVar', getConfigVar)
|
||||
|
||||
class Config(callbacks.Privmsg):
|
||||
class Config(callbacks.Plugin):
|
||||
def callCommand(self, name, irc, msg, *L, **kwargs):
|
||||
try:
|
||||
super(Config, self).callCommand(name, irc, msg, *L, **kwargs)
|
||||
|
@ -37,7 +37,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Ctcp(callbacks.PrivmsgCommandAndRegexp):
|
||||
class Ctcp(callbacks.PluginRegexp):
|
||||
public = False
|
||||
regexps = ('ctcpPing', 'ctcpVersion', 'ctcpUserinfo',
|
||||
'ctcpTime', 'ctcpFinger', 'ctcpSource')
|
||||
|
@ -37,7 +37,7 @@ from supybot.commands import *
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Dict(callbacks.Privmsg):
|
||||
class Dict(callbacks.Plugin):
|
||||
threaded = True
|
||||
def dictionaries(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
@ -43,7 +43,7 @@ class MyFilterProxy(object):
|
||||
def reply(self, s):
|
||||
self.s = s
|
||||
|
||||
class Filter(callbacks.Privmsg):
|
||||
class Filter(callbacks.Plugin):
|
||||
"""This plugin offers several commands which transform text in some way.
|
||||
It also provides the capability of using such commands to 'filter' the
|
||||
output of the bot -- for instance, you could make everything the bot says
|
||||
|
@ -53,7 +53,7 @@ class FilterTest(ChannelPluginTestCase):
|
||||
self.assertNotError('outfilter rot13')
|
||||
finally:
|
||||
try:
|
||||
callbacks.Privmsg._disabled.remove('rot13')
|
||||
callbacks.Plugin._disabled.remove('rot13')
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
@ -43,7 +43,7 @@ def configure(advanced):
|
||||
from supybot.questions import expect, anything, something, yn
|
||||
conf.registerPlugin('Format', True)
|
||||
|
||||
class Format(callbacks.Privmsg):
|
||||
class Format(callbacks.Plugin):
|
||||
def bold(self, irc, msg, args, text):
|
||||
"""<text>
|
||||
|
||||
|
@ -37,7 +37,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Games(callbacks.Privmsg):
|
||||
class Games(callbacks.Plugin):
|
||||
def coin(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
||||
|
@ -99,7 +99,7 @@ last24hours = structures.TimeoutQueue(86400)
|
||||
totalTime = conf.supybot.plugins.Google.state.time()
|
||||
searches = conf.supybot.plugins.Google.state.searches()
|
||||
|
||||
class Google(callbacks.PrivmsgCommandAndRegexp):
|
||||
class Google(callbacks.PluginRegexp):
|
||||
threaded = True
|
||||
callBefore = ['URL']
|
||||
regexps = ['googleSnarfer', 'googleGroups']
|
||||
|
@ -52,7 +52,7 @@ class HeraldDB(plugins.ChannelUserDB):
|
||||
raise ValueError
|
||||
return L[0]
|
||||
|
||||
class Herald(callbacks.Privmsg):
|
||||
class Herald(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Herald, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -36,7 +36,7 @@ from supybot.utils.iter import any
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Internet(callbacks.Privmsg):
|
||||
class Internet(callbacks.Plugin):
|
||||
"""Add the help for "@help Internet" here."""
|
||||
threaded = True
|
||||
def dns(self, irc, msg, args, host):
|
||||
|
@ -208,7 +208,7 @@ class SqliteKarmaDB(object):
|
||||
KarmaDB = plugins.DB('Karma',
|
||||
{'sqlite': SqliteKarmaDB})
|
||||
|
||||
class Karma(callbacks.Privmsg):
|
||||
class Karma(callbacks.Plugin):
|
||||
callBefore = ('Factoids', 'MoobotFactoids', 'Infobot')
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Karma, self)
|
||||
|
@ -38,7 +38,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Later(callbacks.Privmsg):
|
||||
class Later(callbacks.Plugin):
|
||||
"""Used to do things later; currently, it only allows the sending of
|
||||
nick-based notes. Do note (haha!) that these notes are *not* private
|
||||
and don't even pretend to be; if you want such features, consider using the
|
||||
|
@ -43,7 +43,7 @@ import convertcore
|
||||
|
||||
baseArg = ('int', 'base', lambda i: i <= 36)
|
||||
|
||||
class Math(callbacks.Privmsg):
|
||||
class Math(callbacks.Plugin):
|
||||
def base(self, irc, msg, args, frm, to, number):
|
||||
"""<fromBase> [<toBase>] <number>
|
||||
|
||||
|
@ -42,7 +42,7 @@ import supybot.callbacks as callbacks
|
||||
|
||||
from supybot.utils.iter import ifilter
|
||||
|
||||
class Misc(callbacks.Privmsg):
|
||||
class Misc(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Misc, self)
|
||||
self.__parent.__init__(irc)
|
||||
@ -143,7 +143,7 @@ class Misc(callbacks.Privmsg):
|
||||
commands = {}
|
||||
L = []
|
||||
for cb in irc.callbacks:
|
||||
if isinstance(cb, callbacks.Privmsg):
|
||||
if isinstance(cb, callbacks.Plugin):
|
||||
for attr in dir(cb):
|
||||
if s in attr and cb.isCommand(attr):
|
||||
if attr == callbacks.canonicalName(attr):
|
||||
|
@ -38,7 +38,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Network(callbacks.Privmsg):
|
||||
class Network(callbacks.Plugin):
|
||||
_whois = {}
|
||||
_latency = {}
|
||||
def _getIrc(self, network):
|
||||
|
@ -34,7 +34,7 @@ import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class NickCapture(callbacks.Privmsg):
|
||||
class NickCapture(callbacks.Plugin):
|
||||
"""This module constantly tries to take whatever nick is configured as
|
||||
supybot.nick. Just make sure that's set appropriately, and thus plugin
|
||||
will do the rest."""
|
||||
@ -55,7 +55,7 @@ class NickCapture(callbacks.Privmsg):
|
||||
# except on reconnects, which can cause trouble.
|
||||
# if nick not in irc.state.nicksToHostmasks:
|
||||
self._ison(irc, nick)
|
||||
callbacks.Privmsg.__call__(self, irc, msg)
|
||||
self.__parent.__call__(irc, msg)
|
||||
|
||||
def _ison(self, irc, nick):
|
||||
if self.registryValue('ison'):
|
||||
|
@ -72,7 +72,7 @@ def numberShifts(s):
|
||||
s=re.sub('[0-9]+', 'n', s)
|
||||
return len(s)-1
|
||||
|
||||
class Nickometer(callbacks.Privmsg):
|
||||
class Nickometer(callbacks.Plugin):
|
||||
def punish(self, damage, reason):
|
||||
self.log.debug('%s lameness points awarded: %s' % (damage, reason))
|
||||
return damage
|
||||
|
@ -124,7 +124,7 @@ class DbiNoteDB(dbi.DB):
|
||||
|
||||
NoteDB = plugins.DB('Note', {'flat': DbiNoteDB})
|
||||
|
||||
class Note(callbacks.Privmsg):
|
||||
class Note(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent= super(Note, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -119,7 +119,7 @@ class LogProxy(object):
|
||||
return getattr(self.log, attr)
|
||||
|
||||
|
||||
class Owner(callbacks.Privmsg):
|
||||
class Owner(callbacks.Plugin):
|
||||
# This plugin must be first; its priority must be lowest; otherwise odd
|
||||
# things will happen when adding callbacks.
|
||||
def __init__(self, irc=None):
|
||||
|
@ -33,7 +33,7 @@ import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Protector(callbacks.Privmsg):
|
||||
class Protector(callbacks.Plugin):
|
||||
def isImmune(self, irc, msg):
|
||||
if not ircutils.isUserHostmask(msg.prefix):
|
||||
self.log.debug('%q is immune, it\'s a server.', msg)
|
||||
|
@ -183,7 +183,7 @@ class SqliteQuoteGrabsDB(object):
|
||||
|
||||
QuoteGrabsDB = plugins.DB('QuoteGrabs', {'sqlite': SqliteQuoteGrabsDB})
|
||||
|
||||
class QuoteGrabs(callbacks.Privmsg):
|
||||
class QuoteGrabs(callbacks.Plugin):
|
||||
"""Add the help for "@help QuoteGrabs" here."""
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(QuoteGrabs, self)
|
||||
|
@ -49,7 +49,7 @@ def getFeedName(irc, msg, args, state):
|
||||
state.args.append(callbacks.canonicalName(args.pop(0)))
|
||||
addConverter('feedName', getFeedName)
|
||||
|
||||
class RSS(callbacks.Privmsg):
|
||||
class RSS(callbacks.Plugin):
|
||||
"""This plugin is useful both for announcing updates to RSS feeds in a
|
||||
channel, and for retrieving the headlines of RSS feeds via command. Use
|
||||
the "add" command to add feeds to this plugin, and use the "announce"
|
||||
|
@ -39,7 +39,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
from supybot.structures import MultiSet, TimeoutQueue
|
||||
|
||||
class Relay(callbacks.Privmsg):
|
||||
class Relay(callbacks.Plugin):
|
||||
noIgnore = True
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Relay, self)
|
||||
|
@ -31,7 +31,7 @@ from supybot.commands import *
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Reply(callbacks.Privmsg):
|
||||
class Reply(callbacks.Plugin):
|
||||
"""This plugins contains a few commands that construct various types of
|
||||
replies. Some bot owners would be wise to not load this plugin because it
|
||||
can be easily abused.
|
||||
|
@ -35,7 +35,7 @@ from supybot.commands import *
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Scheduler(callbacks.Privmsg):
|
||||
class Scheduler(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Scheduler, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -89,7 +89,7 @@ class SeenDB(plugins.ChannelUserDB):
|
||||
|
||||
filename = conf.supybot.directories.data.dirize('Seen.db')
|
||||
|
||||
class Seen(callbacks.Privmsg):
|
||||
class Seen(callbacks.Plugin):
|
||||
noIgnore = True
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Seen, self)
|
||||
|
@ -39,7 +39,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Services(callbacks.Privmsg):
|
||||
class Services(callbacks.Plugin):
|
||||
"""This plugin handles dealing with Services on networks that provide them.
|
||||
Basically, you should use the "password" command to tell the bot a nick to
|
||||
identify with and what password to use to identify with that nick. You can
|
||||
|
@ -66,7 +66,7 @@ class CdbShrunkenUrlDB(object):
|
||||
|
||||
ShrunkenUrlDB = plugins.DB('ShrinkUrl', {'cdb': CdbShrunkenUrlDB})
|
||||
|
||||
class ShrinkUrl(callbacks.PrivmsgCommandAndRegexp):
|
||||
class ShrinkUrl(callbacks.PluginRegexp):
|
||||
regexps = ['shrinkSnarfer']
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(ShrinkUrl, self)
|
||||
|
@ -38,7 +38,7 @@ import supybot.world as world
|
||||
from supybot.commands import *
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Status(callbacks.Privmsg):
|
||||
class Status(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Status, self)
|
||||
self.__parent.__init__(irc)
|
||||
@ -52,7 +52,7 @@ class Status(callbacks.Privmsg):
|
||||
def __call__(self, irc, msg):
|
||||
self.recvdMsgs += 1
|
||||
self.recvdBytes += len(msg)
|
||||
callbacks.Privmsg.__call__(self, irc, msg)
|
||||
self.__parent.__call__(irc, msg)
|
||||
|
||||
def outFilter(self, irc, msg):
|
||||
self.sentMsgs += 1
|
||||
@ -162,17 +162,17 @@ class Status(callbacks.Privmsg):
|
||||
Returns some interesting command-related statistics.
|
||||
"""
|
||||
commands = 0
|
||||
callbacksPrivmsg = 0
|
||||
callbacksPlugin = 0
|
||||
for cb in irc.callbacks:
|
||||
if isinstance(cb, callbacks.Privmsg) and cb.public:
|
||||
callbacksPrivmsg += 1
|
||||
if isinstance(cb, callbacks.Plugin) and cb.public:
|
||||
callbacksPlugin += 1
|
||||
for attr in dir(cb):
|
||||
if cb.isCommand(attr) and \
|
||||
attr == callbacks.canonicalName(attr):
|
||||
commands += 1
|
||||
s = format('I offer a total of %n in %n. I have processed %n.',
|
||||
(commands, 'command'),
|
||||
(callbacksPrivmsg, 'command-based', 'plugin'),
|
||||
(callbacksPlugin, 'command-based', 'plugin'),
|
||||
(world.commandsProcessed, 'command'))
|
||||
irc.reply(s)
|
||||
cmd = wrap(cmd)
|
||||
@ -184,7 +184,7 @@ class Status(callbacks.Privmsg):
|
||||
"""
|
||||
commands = set()
|
||||
for cb in irc.callbacks:
|
||||
if isinstance(cb, callbacks.Privmsg) and cb.public:
|
||||
if isinstance(cb, callbacks.Plugin) and cb.public:
|
||||
for attr in dir(cb):
|
||||
if cb.isCommand(attr) and \
|
||||
attr == callbacks.canonicalName(attr):
|
||||
|
@ -38,7 +38,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class String(callbacks.Privmsg):
|
||||
class String(callbacks.Plugin):
|
||||
def ord(self, irc, msg, args, letter):
|
||||
"""<letter>
|
||||
|
||||
|
@ -52,7 +52,7 @@ def parse(s):
|
||||
i = f(i)
|
||||
return i
|
||||
|
||||
class Time(callbacks.Privmsg):
|
||||
class Time(callbacks.Plugin):
|
||||
def seconds(self, irc, msg, args):
|
||||
"""[<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s]
|
||||
|
||||
|
@ -94,7 +94,7 @@ addConverter('canChangeTopic', canChangeTopic)
|
||||
def splitTopic(topic, separator):
|
||||
return filter(None, topic.split(separator))
|
||||
|
||||
class Topic(callbacks.Privmsg):
|
||||
class Topic(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(Topic, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -58,7 +58,7 @@ class DbiUrlDB(plugins.DbiChannelDB):
|
||||
|
||||
URLDB = plugins.DB('URL', {'flat': DbiUrlDB})
|
||||
|
||||
class URL(callbacks.Privmsg):
|
||||
class URL(callbacks.Plugin):
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(URL, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
@ -37,7 +37,7 @@ from supybot.commands import *
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class User(callbacks.Privmsg):
|
||||
class User(callbacks.Plugin):
|
||||
def _checkNotChannel(self, irc, msg, password=' '):
|
||||
if password and irc.isChannel(msg.args[0]):
|
||||
raise callbacks.Error, conf.supybot.replies.requiresPrivacy()
|
||||
|
@ -34,7 +34,7 @@ from supybot.commands import *
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Utilities(callbacks.Privmsg):
|
||||
class Utilities(callbacks.Plugin):
|
||||
# Yes, I really do mean "requires no arguments" below. "takes no
|
||||
# arguments" would probably lead people to think it was a useless command.
|
||||
def ignore(self, irc, msg, args):
|
||||
|
@ -45,7 +45,7 @@ noLocationError = 'No such location could be found.'
|
||||
class NoLocation(callbacks.Error):
|
||||
pass
|
||||
|
||||
class Weather(callbacks.Privmsg):
|
||||
class Weather(callbacks.Plugin):
|
||||
weatherCommands = ['wunder', 'cnn', 'ham']
|
||||
threaded = True
|
||||
def __init__(self, irc):
|
||||
|
@ -36,7 +36,7 @@ import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Web(callbacks.PrivmsgCommandAndRegexp):
|
||||
class Web(callbacks.PluginRegexp):
|
||||
"""Add the help for "@help Web" here."""
|
||||
regexps = ['titleSnarfer']
|
||||
threaded = True
|
||||
|
@ -993,8 +993,7 @@ class DisabledCommands(object):
|
||||
if self.d[command] is not None:
|
||||
self.d[command].remove(plugin)
|
||||
|
||||
class Privmsg(irclib.IrcCallback):
|
||||
"""Base class for all Privmsg handlers."""
|
||||
class Plugin(irclib.IrcCallback):
|
||||
# For awhile, a comment stood here to say, "Eventually callCommand." But
|
||||
# that's wrong, because we can't do generic error handling in this
|
||||
# callCommand -- plugins need to be able to override callCommand and do
|
||||
@ -1243,8 +1242,9 @@ class SimpleProxy(RichReplyMethods):
|
||||
def __getattr__(self, attr):
|
||||
return getattr(self.irc, attr)
|
||||
|
||||
Privmsg = Plugin # Backwards compatibility.
|
||||
|
||||
class PrivmsgCommandAndRegexp(Privmsg):
|
||||
class PluginRegexp(Plugin):
|
||||
"""Same as Privmsg, except allows the user to also include regexp-based
|
||||
callbacks. All regexp-based callbacks must be specified in a set
|
||||
(or list) attribute "regexps".
|
||||
@ -1311,5 +1311,7 @@ class PrivmsgCommandAndRegexp(Privmsg):
|
||||
proxy = self.Proxy(irc, msg)
|
||||
self.callCommand(name, proxy, msg, m, catchErrors=True)
|
||||
|
||||
PrivmsgCommandAndRegexp = PluginRegexp
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
@ -359,22 +359,22 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
conf.supybot.reply.error.inPrivate.set(original)
|
||||
|
||||
# Now for stuff not based on the plugins.
|
||||
class First(callbacks.Privmsg):
|
||||
class First(callbacks.Plugin):
|
||||
def firstcmd(self, irc, msg, args):
|
||||
"""First"""
|
||||
irc.reply('foo')
|
||||
|
||||
class Second(callbacks.Privmsg):
|
||||
class Second(callbacks.Plugin):
|
||||
def secondcmd(self, irc, msg, args):
|
||||
"""Second"""
|
||||
irc.reply('bar')
|
||||
|
||||
class FirstRepeat(callbacks.Privmsg):
|
||||
class FirstRepeat(callbacks.Plugin):
|
||||
def firstcmd(self, irc, msg, args):
|
||||
"""FirstRepeat"""
|
||||
irc.reply('baz')
|
||||
|
||||
class Third(callbacks.Privmsg):
|
||||
class Third(callbacks.Plugin):
|
||||
def third(self, irc, msg, args):
|
||||
"""Third"""
|
||||
irc.reply(' '.join(args))
|
||||
@ -420,7 +420,7 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag.
|
||||
self.assertRegexp('help firstrepeat firstcmd', 'FirstRepeat', 0)
|
||||
|
||||
class TwoRepliesFirstAction(callbacks.Privmsg):
|
||||
class TwoRepliesFirstAction(callbacks.Plugin):
|
||||
def testactionreply(self, irc, msg, args):
|
||||
irc.reply('foo', action=True)
|
||||
irc.reply('bar') # We're going to check that this isn't an action.
|
||||
@ -457,7 +457,7 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
def testNoEscapingAttributeErrorFromTokenizeWithFirstElementList(self):
|
||||
self.assertError('[plugin list] list')
|
||||
|
||||
class InvalidCommand(callbacks.Privmsg):
|
||||
class InvalidCommand(callbacks.Plugin):
|
||||
def invalidCommand(self, irc, msg, tokens):
|
||||
irc.reply('foo')
|
||||
|
||||
@ -472,7 +472,7 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
finally:
|
||||
conf.supybot.reply.whenNotCommand.set(original)
|
||||
|
||||
class BadInvalidCommand(callbacks.Privmsg):
|
||||
class BadInvalidCommand(callbacks.Plugin):
|
||||
def invalidCommand(self, irc, msg, tokens):
|
||||
s = 'This shouldn\'t keep Misc.invalidCommand from being called'
|
||||
raise Exception, s
|
||||
@ -487,9 +487,9 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
conf.supybot.reply.whenNotCommand.set(original)
|
||||
|
||||
|
||||
class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
|
||||
class PluginRegexpTestCase(PluginTestCase):
|
||||
plugins = ()
|
||||
class PCAR(callbacks.PrivmsgCommandAndRegexp):
|
||||
class PCAR(callbacks.PluginRegexp):
|
||||
def test(self, irc, msg, args):
|
||||
"<foo>"
|
||||
raise callbacks.ArgumentError
|
||||
@ -499,7 +499,7 @@ class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
|
||||
|
||||
class RichReplyMethodsTestCase(PluginTestCase):
|
||||
plugins = ()
|
||||
class NoCapability(callbacks.Privmsg):
|
||||
class NoCapability(callbacks.Plugin):
|
||||
def error(self, irc, msg, args):
|
||||
irc.errorNoCapability('admin')
|
||||
def testErrorNoCapability(self):
|
||||
@ -509,7 +509,7 @@ class RichReplyMethodsTestCase(PluginTestCase):
|
||||
|
||||
class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
||||
plugins = ('Utilities',)
|
||||
class WithPrivateNotice(callbacks.Privmsg):
|
||||
class WithPrivateNotice(callbacks.Plugin):
|
||||
def normal(self, irc, msg, args):
|
||||
irc.reply('should be with private notice')
|
||||
def explicit(self, irc, msg, args):
|
||||
|
Loading…
Reference in New Issue
Block a user