mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Changed prefixName to prefixNick, which is more appropriate, and has always bothered me. Better now than later.
This commit is contained in:
parent
a477f12f47
commit
490fb0b140
@ -121,7 +121,7 @@ class Games(callbacks.Plugin):
|
||||
"""
|
||||
if spin:
|
||||
self._rouletteBullet = random.randrange(0, 6)
|
||||
irc.reply('*SPIN* Are you feeling lucky?', prefixName=False)
|
||||
irc.reply('*SPIN* Are you feeling lucky?', prefixNick=False)
|
||||
return
|
||||
channel = msg.args[0]
|
||||
if self._rouletteChamber == self._rouletteBullet:
|
||||
@ -131,7 +131,7 @@ class Games(callbacks.Plugin):
|
||||
irc.queueMsg(ircmsgs.kick(channel, msg.nick, 'BANG!'))
|
||||
else:
|
||||
irc.reply('*BANG* Hey, who put a blank in here?!',
|
||||
prefixName=False)
|
||||
prefixNick=False)
|
||||
irc.reply('reloads and spins the chambers.', action=True)
|
||||
else:
|
||||
irc.reply('*click*')
|
||||
|
@ -320,7 +320,7 @@ class Google(callbacks.PluginRegexp):
|
||||
return
|
||||
if data.results:
|
||||
url = data.results[0].URL
|
||||
irc.reply(url, prefixName=False)
|
||||
irc.reply(url, prefixNick=False)
|
||||
googleSnarfer = urlSnarfer(googleSnarfer)
|
||||
|
||||
_ggThread = re.compile(r'Subject: <b>([^<]+)</b>', re.I)
|
||||
@ -355,7 +355,7 @@ class Google(callbacks.PluginRegexp):
|
||||
if mThread and mGroup:
|
||||
irc.reply(format('Google Groups: %s, %s',
|
||||
mGroup.group(1), mThread.group(1)),
|
||||
prefixName=False)
|
||||
prefixNick=False)
|
||||
else:
|
||||
self.log.debug('Unable to snarf. %s doesn\'t appear to be a '
|
||||
'proper Google Groups page.', match.group(1))
|
||||
|
@ -116,7 +116,7 @@ class Herald(callbacks.Plugin):
|
||||
return
|
||||
self.lastHerald[channel, id] = now
|
||||
herald = ircutils.standardSubstitute(irc, msg, herald)
|
||||
irc.reply(herald, prefixName=False)
|
||||
irc.reply(herald, prefixNick=False)
|
||||
|
||||
def doPart(self, irc, msg):
|
||||
try:
|
||||
|
@ -72,10 +72,10 @@ class Insult(callbacks.Plugin):
|
||||
"""
|
||||
tempinsult = self._buildInsult()
|
||||
if not victim:
|
||||
irc.reply(tempinsult, prefixName=False)
|
||||
irc.reply(tempinsult, prefixNick=False)
|
||||
else:
|
||||
irc.reply(format('%s - %s ', victim, tempinsult),
|
||||
prefixName=False)
|
||||
prefixNick=False)
|
||||
insult = wrap(insult, [additional('text')])
|
||||
|
||||
|
||||
|
@ -384,7 +384,7 @@ class Misc(callbacks.Plugin):
|
||||
|
||||
Checks to see if the bot is alive.
|
||||
"""
|
||||
irc.reply('pong', prefixName=False)
|
||||
irc.reply('pong', prefixNick=False)
|
||||
|
||||
Class = Misc
|
||||
|
||||
|
@ -347,9 +347,9 @@ class MoobotFactoids(callbacks.Plugin):
|
||||
if type == 'action':
|
||||
irc.reply(text, action=True)
|
||||
elif type == 'reply':
|
||||
irc.reply(text, prefixName=False)
|
||||
irc.reply(text, prefixNick=False)
|
||||
elif type == 'define':
|
||||
irc.reply(format('%s is %s', key, text), prefixName=False)
|
||||
irc.reply(format('%s is %s', key, text), prefixNick=False)
|
||||
else:
|
||||
assert False, 'Spurious type from _parseFactoid'
|
||||
else:
|
||||
|
@ -219,7 +219,7 @@ class QuoteGrabs(callbacks.Plugin):
|
||||
|
||||
def _sendGrabMsg(self, irc, msg):
|
||||
s = 'jots down a new quote for %s' % msg.nick
|
||||
irc.reply(s, action=True, prefixName=False)
|
||||
irc.reply(s, action=True, prefixNick=False)
|
||||
|
||||
def grab(self, irc, msg, args, channel, nick):
|
||||
"""[<channel>] <nick>
|
||||
|
@ -187,7 +187,7 @@ class RSS(callbacks.Plugin):
|
||||
sep = ircutils.bold(sep)
|
||||
headlines = self.buildHeadlines(newheadlines, channel)
|
||||
irc.replies(headlines, prefixer=pre, joiner=sep,
|
||||
to=channel, prefixName=False, private=True)
|
||||
to=channel, prefixNick=False, private=True)
|
||||
finally:
|
||||
self.releaseLock(url)
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Reply(callbacks.Plugin):
|
||||
|
||||
Replies with <text>. Equivalent to the alias, 'echo $nick: $1'.
|
||||
"""
|
||||
irc.reply(text, prefixName=True)
|
||||
irc.reply(text, prefixNick=True)
|
||||
reply = wrap(reply, ['text'])
|
||||
|
||||
Class = Reply
|
||||
|
@ -137,7 +137,7 @@ class ShrinkUrl(callbacks.PluginRegexp):
|
||||
s = format('%u (at %s)', ircutils.bold(shorturl), domain)
|
||||
else:
|
||||
s = format('%u (at %s)', shorturl, domain)
|
||||
m = irc.reply(s, prefixName=False)
|
||||
m = irc.reply(s, prefixNick=False)
|
||||
m.tag('shrunken')
|
||||
shrinkSnarfer = urlSnarfer(shrinkSnarfer)
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Utilities(callbacks.Plugin):
|
||||
handled appropriately.
|
||||
"""
|
||||
text = ircutils.standardSubstitute(irc, msg, text)
|
||||
irc.reply(text, prefixName=False)
|
||||
irc.reply(text, prefixNick=False)
|
||||
echo = wrap(echo, ['text'])
|
||||
|
||||
def shuffle(self, irc, msg, args, things):
|
||||
|
@ -94,7 +94,7 @@ class Web(callbacks.PluginRegexp):
|
||||
domain = utils.web.getDomain(url)
|
||||
title = utils.web.htmlToText(parser.title.strip())
|
||||
s = format('Title: %s (at %s)', title, domain)
|
||||
irc.reply(s, prefixName=False)
|
||||
irc.reply(s, prefixNick=False)
|
||||
titleSnarfer = urlSnarfer(titleSnarfer)
|
||||
|
||||
def headers(self, irc, msg, args, url):
|
||||
|
@ -157,7 +157,7 @@ def canonicalName(command):
|
||||
command = command[:-1]
|
||||
return command.translate(utils.str.chars, special).lower() + reAppend
|
||||
|
||||
def reply(msg, s, prefixName=None, private=None,
|
||||
def reply(msg, s, prefixNick=None, private=None,
|
||||
notice=None, to=None, action=None, error=False):
|
||||
msg.tag('repliedTo')
|
||||
# Ok, let's make the target:
|
||||
@ -171,14 +171,14 @@ def reply(msg, s, prefixName=None, private=None,
|
||||
notice = conf.get(conf.supybot.reply.withNotice, channel)
|
||||
if private is None:
|
||||
private = conf.get(conf.supybot.reply.inPrivate, channel)
|
||||
if prefixName is None:
|
||||
prefixName = conf.get(conf.supybot.reply.withNickPrefix, channel)
|
||||
if prefixNick is None:
|
||||
prefixNick = conf.get(conf.supybot.reply.withNickPrefix, channel)
|
||||
if error:
|
||||
notice =conf.get(conf.supybot.reply.error.withNotice, channel) or notice
|
||||
private=conf.get(conf.supybot.reply.error.inPrivate, channel) or private
|
||||
s = 'Error: ' + s
|
||||
if private:
|
||||
prefixName = False
|
||||
prefixNick = False
|
||||
if to is None:
|
||||
target = msg.nick
|
||||
else:
|
||||
@ -189,7 +189,7 @@ def reply(msg, s, prefixName=None, private=None,
|
||||
s = ircutils.safeArgument(s)
|
||||
if not s and not action:
|
||||
s = 'Error: I tried to send you an empty message.'
|
||||
if prefixName and ircutils.isChannel(target):
|
||||
if prefixNick and ircutils.isChannel(target):
|
||||
# Let's may sure we don't do, "#channel: foo.".
|
||||
if not ircutils.isChannel(to):
|
||||
s = '%s: %s' % (to, s)
|
||||
@ -617,10 +617,10 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
self.private = None
|
||||
self.noLengthCheck = None
|
||||
if ircutils.isChannel(self.msg.args[0]):
|
||||
self.prefixName = conf.get(conf.supybot.reply.withNickPrefix,
|
||||
self.prefixNick = conf.get(conf.supybot.reply.withNickPrefix,
|
||||
self.msg.args[0])
|
||||
else:
|
||||
self.prefixName = conf.supybot.reply.withNickPrefix()
|
||||
self.prefixNick = conf.supybot.reply.withNickPrefix()
|
||||
|
||||
def evalArgs(self):
|
||||
while self.counter < len(self.args):
|
||||
@ -782,14 +782,14 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
else:
|
||||
cb._callCommand(command, self, self.msg, args)
|
||||
|
||||
def reply(self, s, noLengthCheck=False, prefixName=None,
|
||||
def reply(self, s, noLengthCheck=False, prefixNick=None,
|
||||
action=None, private=None, notice=None, to=None, msg=None):
|
||||
"""reply(s) -> replies to msg with s
|
||||
|
||||
Keyword arguments:
|
||||
noLengthCheck=False: True if the length shouldn't be checked
|
||||
(used for 'more' handling)
|
||||
prefixName=True: False if the nick shouldn't be prefixed to the
|
||||
prefixNick=True: False if the nick shouldn't be prefixed to the
|
||||
reply.
|
||||
action=False: True if the reply should be an action.
|
||||
private=False: True if the reply should be in private.
|
||||
@ -805,18 +805,18 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
'Old code alert: there is no longer a "msg" argument to reply.'
|
||||
if msg is None:
|
||||
msg = self.msg
|
||||
if prefixName is not None:
|
||||
self.prefixName = prefixName
|
||||
if prefixNick is not None:
|
||||
self.prefixNick = prefixNick
|
||||
if action is not None:
|
||||
self.action = self.action or action
|
||||
self.prefixName = False
|
||||
self.prefixNick = False
|
||||
if notice is not None:
|
||||
self.notice = self.notice or notice
|
||||
if private is not None:
|
||||
self.private = self.private or private
|
||||
if to is not None:
|
||||
self.to = self.to or to
|
||||
# action=True implies noLengthCheck=True and prefixName=False
|
||||
# action=True implies noLengthCheck=True and prefixNick=False
|
||||
self.noLengthCheck=noLengthCheck or self.noLengthCheck or self.action
|
||||
target = self.private and self.to or self.msg.args[0]
|
||||
s = str(s) # Allow non-string esses.
|
||||
@ -828,7 +828,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
notice=self.notice,
|
||||
action=self.action,
|
||||
private=self.private,
|
||||
prefixName=self.prefixName,
|
||||
prefixNick=self.prefixNick,
|
||||
noLengthCheck=self.noLengthCheck)
|
||||
elif self.noLengthCheck:
|
||||
# noLengthCheck only matters to NestedCommandsIrcProxy, so
|
||||
@ -837,7 +837,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
notice=self.notice,
|
||||
action=self.action,
|
||||
private=self.private,
|
||||
prefixName=self.prefixName)
|
||||
prefixNick=self.prefixNick)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
else:
|
||||
@ -867,7 +867,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
m = reply(msg, s, to=self.to,
|
||||
notice=self.notice,
|
||||
private=self.private,
|
||||
prefixName=self.prefixName)
|
||||
prefixNick=self.prefixNick)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
msgs = ircutils.wrap(s, allowedLength)
|
||||
@ -879,7 +879,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
m = reply(msg, response, to=self.to,
|
||||
notice=self.notice,
|
||||
private=self.private,
|
||||
prefixName=self.prefixName)
|
||||
prefixNick=self.prefixNick)
|
||||
self.irc.queueMsg(m)
|
||||
# XXX We should somehow allow these to be returned, but
|
||||
# until someone complains, we'll be fine :) We
|
||||
@ -909,7 +909,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
action=self.action,
|
||||
notice=self.notice,
|
||||
private=self.private,
|
||||
prefixName=self.prefixName)
|
||||
prefixNick=self.prefixNick)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
finally:
|
||||
|
@ -241,7 +241,7 @@ class FunctionsTestCase(SupyTestCase):
|
||||
callbacks.reply(channelMsg, 'foo'))
|
||||
self.assertEqual(ircmsgs.privmsg(channelMsg.args[0],
|
||||
'foo'),
|
||||
callbacks.reply(channelMsg, 'foo', prefixName=False))
|
||||
callbacks.reply(channelMsg, 'foo', prefixNick=False))
|
||||
self.assertEqual(ircmsgs.notice(nonChannelMsg.nick, 'foo'),
|
||||
callbacks.reply(channelMsg, 'foo',
|
||||
notice=True, private=True))
|
||||
|
Loading…
Reference in New Issue
Block a user