attempt to have outbound recursion
same logic as replacing [subcommand] with the output of subcommand, but on the outbound side, via {subcommand}. this lets you do something like, say: !echo {!facts buh} and that won't get interpreted until '{!facts buh}' is on its way out of the bot. thus, you could also put '{!facts buh}' into the output of some other command, like a countdown reminder
This commit is contained in:
parent
b58b208f29
commit
995bb643f3
@ -888,6 +888,19 @@ class IRCBot(irc.client.SimpleIRCClient):
|
|||||||
if recursing:
|
if recursing:
|
||||||
return replystr
|
return replystr
|
||||||
else:
|
else:
|
||||||
|
# try doing outbound recursion
|
||||||
|
log.debug("old replystr: %s", replystr)
|
||||||
|
if event:
|
||||||
|
fake_event = copy.deepcopy(event)
|
||||||
|
fake_event.arguments[0] = copy.deepcopy(replystr).replace('{', '[').replace('}', ']')
|
||||||
|
else:
|
||||||
|
fake_event = irc.client.Event(type='pubmsg', source='fake', target='fake')
|
||||||
|
fake_event.arguments.append(copy.deepcopy(replystr).replace('{', '[').replace('}', ']'))
|
||||||
|
log.debug("hacked replystr: %s", fake_event.arguments[0])
|
||||||
|
self.connection.reactor.try_recursion(self.connection, fake_event)
|
||||||
|
replystr = fake_event.arguments[0]
|
||||||
|
log.debug("final replystr: %s", replystr)
|
||||||
|
|
||||||
lines = 0
|
lines = 0
|
||||||
replies = replystr.split('\n')
|
replies = replystr.split('\n')
|
||||||
for reply in replies:
|
for reply in replies:
|
||||||
|
Loading…
Reference in New Issue
Block a user