mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-24 02:54:05 +01:00
add usesendMsg=False to irc.reply() to use sendMsg() instead of queueMsg()
This commit is contained in:
parent
c58399730b
commit
2fe84a3474
@ -836,8 +836,8 @@ 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, prefixNick=None,
|
def reply(self, s, noLengthCheck=False, prefixNick=None, action=None,
|
||||||
action=None, private=None, notice=None, to=None, msg=None):
|
private=None, notice=None, to=None, msg=None, usesendMsg=False):
|
||||||
"""
|
"""
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
|
|
||||||
@ -851,6 +851,8 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
bot is configured to do so.
|
bot is configured to do so.
|
||||||
* `to=<nick|channel>`: The nick or channel the reply should go to.
|
* `to=<nick|channel>`: The nick or channel the reply should go to.
|
||||||
Defaults to msg.args[0] (or msg.nick if private)
|
Defaults to msg.args[0] (or msg.nick if private)
|
||||||
|
* `usesendMsg=False`: True if the reply should be sent
|
||||||
|
using sendMsg instead of queueMsg
|
||||||
"""
|
"""
|
||||||
# These use and or or based on whether or not they default to True or
|
# These use and or or based on whether or not they default to True or
|
||||||
# False. Those that default to True use and; those that default to
|
# False. Those that default to True use and; those that default to
|
||||||
@ -858,6 +860,10 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
assert not isinstance(s, ircmsgs.IrcMsg), \
|
assert not isinstance(s, ircmsgs.IrcMsg), \
|
||||||
'Old code alert: there is no longer a "msg" argument to reply.'
|
'Old code alert: there is no longer a "msg" argument to reply.'
|
||||||
self.repliedTo = True
|
self.repliedTo = True
|
||||||
|
if usesendMsg:
|
||||||
|
sendMsg = self.irc.sendMsg
|
||||||
|
else:
|
||||||
|
sendMsg = self.irc.queueMsg
|
||||||
if msg is None:
|
if msg is None:
|
||||||
msg = self.msg
|
msg = self.msg
|
||||||
if prefixNick is not None:
|
if prefixNick is not None:
|
||||||
@ -895,7 +901,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
action=self.action,
|
action=self.action,
|
||||||
private=self.private,
|
private=self.private,
|
||||||
prefixNick=self.prefixNick)
|
prefixNick=self.prefixNick)
|
||||||
self.irc.queueMsg(m)
|
sendMsg(m)
|
||||||
return m
|
return m
|
||||||
else:
|
else:
|
||||||
s = ircutils.safeArgument(s)
|
s = ircutils.safeArgument(s)
|
||||||
@ -928,7 +934,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
notice=self.notice,
|
notice=self.notice,
|
||||||
private=self.private,
|
private=self.private,
|
||||||
prefixNick=self.prefixNick)
|
prefixNick=self.prefixNick)
|
||||||
self.irc.queueMsg(m)
|
sendMsg(m)
|
||||||
return m
|
return m
|
||||||
msgs = ircutils.wrap(s, allowedLength,
|
msgs = ircutils.wrap(s, allowedLength,
|
||||||
break_long_words=True)
|
break_long_words=True)
|
||||||
@ -941,7 +947,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
notice=self.notice,
|
notice=self.notice,
|
||||||
private=self.private,
|
private=self.private,
|
||||||
prefixNick=self.prefixNick)
|
prefixNick=self.prefixNick)
|
||||||
self.irc.queueMsg(m)
|
sendMsg(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
|
||||||
# can't return from here, though, for obvious
|
# can't return from here, though, for obvious
|
||||||
@ -974,7 +980,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
notice=self.notice,
|
notice=self.notice,
|
||||||
private=self.private,
|
private=self.private,
|
||||||
prefixNick=self.prefixNick)
|
prefixNick=self.prefixNick)
|
||||||
self.irc.queueMsg(m)
|
sendMsg(m)
|
||||||
return m
|
return m
|
||||||
finally:
|
finally:
|
||||||
self._resetReplyAttributes()
|
self._resetReplyAttributes()
|
||||||
|
Loading…
Reference in New Issue
Block a user