/usr/share/pyshared/gozerbot/plugs/rest.py is in gozerbot 0.99.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # gozerbot/plugs/rest.py
#
#
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'
# gozerbot imports
from gozerbot.commands import cmnds
from gozerbot.plughelp import plughelp
from gozerbot.examples import examples
from gozerbot.tests import tests
# basic imports
import time
plughelp.add('rest', 'show rest of the output in /msg')
def handle_rest(bot, ievent):
""" show rest of the output in /msg. """
try:
who = ievent.args[0]
except IndexError:
if bot.jabber:
who = ievent.userhost
else:
who = ievent.nick
what, size = bot.less.more(who, 0)
if not what:
ievent.reply('no more data available for %s' % who)
return
if not bot.jabber and int(size)+1 > 10:
ievent.reply("showing %d of %d lines in private" % \
(10, int(size)+1))
else:
ievent.reply("showing %d lines in private" % (int(size)+1))
count = 0
while what:
count += 1
if bot.jabber:
if size:
bot.say(ievent.userhost, "%s (+%s)" % (what, size))
else:
bot.say(ievent.userhost, what)
else:
if size:
bot.output(ievent.nick, "%s (+%s)" % (what, size))
else:
bot.output(ievent.nick, what)
# output limiter
if count >= 10:
what = None
else:
what, size = bot.less.more(who, 0)
if what:
time.sleep(3)
# let the user know if we have remaining data
if size:
s = ''
if size > 1:
s = 's'
if bot.jabber:
bot.say(ievent.userhost, "%s more line%s" % (size, s))
else:
bot.output(ievent.nick, "%s more line%s" % (size, s))
cmnds.add('rest', handle_rest, 'USER')
examples.add('rest', 'show the rest of output cache data', 'rest')
tests.add('avail | rest')
|