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