5
__copyright__ = 'this file is in the public domain'
7
from gozerbot.commands import cmnds
8
from gozerbot.generic import getwho, waitforqueue
9
from gozerbot.examples import examples
10
from gozerbot.plughelp import plughelp
12
plughelp.add('to', 'send the output to another user .. used in a pipeline')
14
def handle_to(bot, ievent):
15
""" direct pipeline output to <nick> """
16
if not ievent.inqueue:
17
ievent.reply('use to in a pipeline')
22
ievent.reply('to <nick>')
26
if not getwho(bot, nick):
27
ievent.reply("don't know %s" % nick)
29
result = waitforqueue(ievent.inqueue, 5)
31
ievent.reply("%s sends you this:" % ievent.nick, nick=nick)
32
ievent.reply(result, nick=nick, dot=True)
34
ievent.reply('1 element sent')
36
ievent.reply('%s elements sent' % len(result))
38
ievent.reply('nothing to send')
40
cmnds.add('to', handle_to, 'USER')
41
examples.add('to', 'send pipeline output to another user', 'list | to dunker')