Пример #1
0
        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')
Пример #2
0
"""  used in a pipeline .. unique elements """

__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'

from gozerbot.commands import cmnds
from gozerbot.generic import waitforqueue
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import sets

plughelp.add('uniq', 'unique elements of a pipeline')

def handle_uniq(bot, ievent):
    """ uniq the result list """
    if not ievent.inqueue:
        ievent.reply('use uniq in a pipeline')
        return
    result = waitforqueue(ievent.inqueue, 30)
    if not result:
        ievent.reply('no data')
        return
    result = list(sets.Set(result))
    if not result:
        ievent.reply('no result')
    else:
        ievent.reply(result, dot=True)

cmnds.add('uniq', handle_uniq, ['USER', 'WEB', 'CLOUD'])
tests.add('list | uniq')
Пример #3
0
        return

    for job in periodical.jobs:
        if job.id() == int(ievent.args[0]):
            next = job.next
            if type(next) in [types.FloatType, types.IntType]:
                next = datetime.datetime(*time.localtime(next)[:7])
            ievent.reply('%s, fires at %s' % (job.__repr__(), str(next)))
            return

    ievent.reply('job not found')


cmnds.add('job', handle_job, 'USER')
examples.add('job', 'show job data of <jobid> ', 'job 1')
tests.add('job 1')


def handle_joblist(bot, ievent):
    """ show job list. """

    try:
        group = ievent.args[0]
    except IndexError:
        group = None
    result = []

    for job in periodical.jobs:
        if group and not job.group == group:
            continue
        if job.description:
Пример #4
0
    """ karma-del <item> .. delete karma item """
    if not ievent.rest:
        ievent.missing('<item>')
        return
    item = ievent.rest
    result = karma.delete(item)
    if result:
        ievent.reply("%s deleted" % item)
    else:
        ievent.reply("can't delete %s" % item)


cmnds.add('karma-del', handle_karmadel, ['OPER'])
examples.add('karma-del', 'karma-del <item> .. delete karma item', \
'karma-del dunker')
tests.add('boozer--').add('karma-del boozer', 'boozer deleted')


def handle_karmaup(bot, ievent):
    """ <item>++ ['#' <reason>] .. increase karma of item with optional \
        reason """
    if not ratelimit(bot, ievent):
        return
    (item, reason) = ievent.groups
    item = item.strip().lower()
    if not item:
        return
    karma.upitem(item, reason=reason)
    karma.setwhoup(item, ievent.nick)
    ievent.reply('karma of ' + item + ' is now ' + str(karma.get(item)))
Пример #5
0
plughelp.add('inform', 'inform <nick> the output of a command')


def handle_inform(bot, ievent):
    """ prepend nick: to the output of command to another user """
    if ievent.msg:
        ievent.reply('inform can only be used in a channel')
        return

    try:
        nick, cmnd = ievent.rest.split(' ', 1)
    except ValueError:
        ievent.missing('<nick> <command>')
        return

    ievent.txt = cmnd
    result = plugins.cmnd(bot, ievent)

    if not result:
        ievent.reply("no result for %s" % cmnd)
        return

    ievent.reply("%s: " % nick, result, dot=True)


cmnds.add('inform', handle_inform, 'USER', threaded=True)
examples.add('inform',
             'inform <nick> <command> .. inform <nick> the output of command',
             'inform dunker version')
tests.add('inform dunker version', 'dunker')
Пример #6
0
        return
    ievent.reply("autovoice enabled on %s" % ievent.channel)


cmnds.add("autovoice-on", handle_autovoiceon, "OPER")
examples.add(
    "autovoice-on",
    "enable autovoice on channel in which the \
command is given",
    "autovoice-on",
)


def handle_autovoiceoff(bot, ievent):
    """ autovoice-off .. disable autovoice for the channel the command was \
        given in """
    bot.channels[ievent.channel]["autovoice"] = 0
    ievent.reply("autovoice disabled on %s" % ievent.channel)


cmnds.add("autovoice-off", handle_autovoiceoff, "OPER")
examples.add(
    "autovoice-off",
    "disable autovoice on channel in which \
the command is given",
    "autovoice-off",
)
tests.add("autovoice-on --chan #dunkbots", "enabled").fakein(":[email protected] JOIN #dunkbots").add(
    "autovoice-off --chan #dunkbots", "disabled"
)
Пример #7
0
        return
    if not awaydict.data.has_key((name, bot.name, ievent.channel)):
        return
    ievent.reply("welcome back %s" % ievent.nick)
    try:
        del awaydict.data[(name, bot.name, ievent.channel)]
        awaydict.save()
    except KeyError:
        pass

def handle_awayenable(bot, ievent):
    """ away-enable .. enable away """
    awaydict.data['enable'] = 1
    awaydict.save()
    plugins.reload('gozerplugs', 'away')
    ievent.reply('away enabled')

cmnds.add('away-enable', handle_awayenable, 'OPER')
examples.add('away-enable' , 'enable the away plugin', 'away-enable')

def handle_awaydisable(bot, ievent):
    """ away-disable .. disable away """
    awaydict.data['enable'] = 0
    awaydict.save()
    plugins.reload('gozerplugs', 'away')
    ievent.reply('away disabled')

cmnds.add('away-disable', handle_awaydisable, 'OPER')
examples.add('away-disable', 'disable the away plugin', 'away-disable')
tests.add('away-enable --chan #dunkbots', 'enabled').fakein(':[email protected] PRIVMSG #dunkbots :&').fakein(':[email protected] PRIVMSG #dunkbots :re').add('away-disable --chan #dunkbots', 'disabled')
Пример #8
0
        try:
            when = int(ievent.args[0])
        except ValueError, e:
            when = ievent.args[0] 
        try:
            AtJob(when, bot, nevent)
        except JobError:
            ievent.reply('wrong date/time')
            return
        ievent.reply('job scheduled')
    else:
        ievent.reply('could not dispatch')

cmnds.add('at', handle_at, 'USER')
examples.add('at', 'start a job at given time', 'at 23:00 say moooo')
tests.add('at 23:55 say #dunkbots mekker', 'job scheduled')

def handle_atlist(bot, ievent):

    """ show scheduled at events. """

    reply = []

    for job in periodical.jobs:
        if job.func.func_name != 'at_job':
            continue
        next = job.next
        if type(next) in [types.FloatType, types.IntType]:
            next = float(next)
        try:
            cmnd = job.func.cmnd
Пример #9
0
    res = []

    for i, j in aliases.data.iteritems():
        if what in i or what in j:
            result.append((i, j))

    if not result:
        ievent.reply('no %s found' % what)
    else:
        for i in result:
            res.append("%s => %s" % i)
        ievent.reply("aliases matching %s: " % what, res, dot=True)

cmnds.add('alias-search', handle_aliassearch, 'USER')
examples.add('alias-search', 'search aliases',' alias-search web')
tests.add('alias-set mekker miep').add('alias-search mekker', 'miep').add('alias-del mekker')

def handle_aliasset(bot, ievent):

    """ alias-set <from> <to> .. set alias. """

    global aliases

    try:
        (aliasfrom, aliasto) = (ievent.args[0], ' '.join(ievent.args[1:]))
    except IndexError:
        ievent.missing('<from> <to>')
        return

    if not aliasto:
        ievent.missing('<from> <to>')
Пример #10
0
def handle_test(bot, ievent):
    """ test .. give test response which is a string of the ircevent. """

    ievent.reply(str(ievent))


cmnds.add('test',
          handle_test, [
              'USER',
              'WEB',
              'JCOLL',
              'CLOUD',
          ],
          options={'--t': 'bla'})
examples.add('test', 'give test response', ' test')
tests.add('test')


def handle_source(bot, ievent):
    """ source .. show where to fetch the bot source. """

    ievent.reply('see http://gozerbot.org')


cmnds.add('source', handle_source, ['USER', 'WEB', 'CLOUD'])
examples.add('source', 'show source url', 'source')
aliases.data['about'] = 'source'
tests.add('source', 'gozerbot')


def handle_response(bot, ievent):
Пример #11
0
#
""" count number of items in result queue. """

__copyright__ = 'this file is in the public domain'

# gozerbot imports
from gozerbot.commands import cmnds
from gozerbot.generic import waitforqueue
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('count', 'the count command counts the number of results in a \
pipeline')


def handle_count(bot, ievent):
    """ show nr of elements in result list. """

    if not ievent.inqueue:
        ievent.reply("use count in a pipeline")
        return

    result = waitforqueue(ievent.inqueue, 5)
    ievent.reply(str(len(result)))


cmnds.add('count', handle_count, ['USER', 'WEB', 'CLOUD'], threaded=True)
examples.add('count', 'count nr of items', 'todo | count')
tests.add('list | count')
Пример #12
0
    if not ievent.rest:
        ievent.missing('<command>')
        return

    target = aliasget(ievent.rest) or ievent.rest

    if not 'OPER' in cmnds.perms(target):
        bot.state['allowed'].append(target)
        bot.state.save()
        ievent.reply('%s command is now allowed for all clients' % target)
    else:
        ievent.reply('sorry')

cmnds.add('all-add', handle_alladd, 'OPER')
examples.add('all-add', 'add command to be allowed by all users', 'all-add version')
tests.add('all-add version', 'version').add('all-del version')

def handle_alldel(bot, ievent):

    """ remove a command from the all allowed list. """

    if not ievent.rest:
        ievent.missing('<command>')
        return

    target = aliasget(ievent.rest) or ievent.rest

    if target in bot.state['allowed']:
        bot.state['allowed'].remove(target)
        ievent.reply('%s command is removed from allowed list' % target)
    else:
Пример #13
0
                errors.append(str(ex))
    ievent.reply("reloaded: ", reloaded, dot=True)
    try:
        cantreload = list(sets.Set(plugs) - sets.Set(reloaded))
        if cantreload:
            ievent.reply("can't reload: ", cantreload, dot=True)
            if errors:
                ievent.reply("errors: ", errors)
    except AttributeError:  # in case of !reload reload
        pass


cmnds.add("reload", handle_reload, "OPER")
examples.add("reload", "reload <plugin>", "reload core")
aliases.data["load"] = "reload"
tests.add("reload country", "country").add("unload country")


def handle_unload(bot, ievent):
    """ unload <plugin> .. unload a plugin """
    try:
        what = ievent.args[0].lower()
    except IndexError:
        ievent.missing("<plugin>")
        return
    if not plugins.exist(what):
        ievent.reply("there is no %s module" % what)
        return
    got = plugins.unload(what)
    for what in got:
        plugins.disable(what)
Пример #14
0
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.aliases import aliases, aliasdel
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('user', 'manage users')

def handle_whoami(bot, ievent):
    """ user-whoami .. get your username """
    ievent.reply('%s' % users.getname(ievent.userhost))

cmnds.add('user-whoami', handle_whoami, 'USER')
examples.add('user-whoami', 'get your username', 'user-whoami')
aliases.data['whoami'] = 'user-whoami'
tests.add('whoami')

def handle_meet(bot, ievent):
    """ user-meet <nick> .. introduce a new user to the bot """
    try:
        nick = ievent.args[0].lower()
    except IndexError:
        ievent.missing('<nick>')
        return
    if users.exist(nick):
        ievent.reply('there is already a user with username %s' % nick)
        return
    userhost = getwho(bot, nick)
    if not userhost:
        ievent.reply("can't find userhost of %s" % nick)
        return
Пример #15
0
            ievent.reply(str(e))
            return
    else:
        result = waitforqueue(ievent.inqueue, 30)
        try:
            options, args = parser.parse_args(ievent.rest.split())
        except SortError, e:
            ievent.reply(str(e))
            return

    if not result:
        ievent.reply('no data to sort')
        return

    if options.unique:
        result = list(set(result))
    if options.numeric:
        result.sort(numeric_compare)
    else:
        result.sort()
    if options.ignorecase:
        result.sort(lambda a, b: cmp(a.upper(), b.upper()))
    if options.reverse:
        result.reverse()
    
    ievent.reply(result, dot=True)

cmnds.add('sort', handle_sort, ['USER', 'WEB', 'CLOUD'], threaded=True)
examples.add('sort', 'sort the output of a command', 'list | sort')
tests.add('list | sort')
Пример #16
0
    if len(ievent.args) >= 1:
        options.update({'password': ievent.args[0]})

    if len(ievent.args) >= 2:
        options.update({'nickserv': ievent.args[1]})

    if len(ievent.args) >= 3:
        options.update({'identify': ' '.join(ievent.args[2:])})

    nsauth.add(bot, **options)
    ievent.reply('ok')

cmnds.add('ns-add', handle_nsadd, 'OPER', threaded=True)
examples.add('ns-add', 'ns-add <password> [<nickserv nick>] [<identify command>] .. add nickserv', 'ns-add mekker')
tests.add('ns-add mekker', 'ok')

def handle_nsdel(bot, ievent):

    """ remove a bot from nickserv. """

    if bot.jabber:
        return

    if len(ievent.args) != 1:
        ievent.missing('<fleetbot name>')
        return

    fbot = fleet.byname(ievent.args[0])

    if not fbot:
Пример #17
0
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('code', 'the code plugin provides code related commands')


def handle_showexceptions(bot, ievent):
    """ show exception list. """

    ievent.reply(str(exceptionlist))


cmnds.add('code-exceptions', handle_showexceptions, 'OPER')
examples.add('code-exceptions', 'show exception list', 'code-exceptions')
aliasset('exceptions', 'code-exceptions')
tests.add('code-exceptions')


def handle_funcnames(bot, ievent):
    """ show function names of a plugin. """

    try:
        plugname = ievent.args[0]
    except IndexError:
        ievent.missing('<plugname>')
        return

    if not plugins.exist(plugname):
        ievent.reply('no %s plugin exists' % plugname)
        return
Пример #18
0
# gozerplugs/beats.py
#
#
""" internet time .beats """

__copyright__ = 'this file is in the public domain'

from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import time, math

plughelp.add('beats', 'show internet time')


def handle_beats(bot, ievent):
    """ beats .. show current internet time """
    beats = ((time.time() + 3600) % 86400) / 86.4
    beats = int(math.floor(beats))
    ievent.reply('@' + str(beats))


cmnds.add('beats', handle_beats, 'USER')
examples.add('beats', 'show current internet time', 'beats')
tests.add('beats', '@')
Пример #19
0
            errors.append(str(ex))
            failed.append(plug)
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
            failed.append(plug)
    ievent.reply('enabled plugins: ', reloaded, dot=True)
    if failed:
        ievent.reply('failed to reload: ', failed, dot=True)
    if errors:
        ievent.reply('errors: ', errors, dot=True)


cmnds.add('plug-enable', handle_plugenable, 'OPER', options={'-a': ''})
examples.add('plug-enable', 'enable a plugin', 'plug-enable karma')
tests.add('plug-enable country', 'country')


def handle_plugdisable(bot, ievent):
    if not ievent.rest:
        ievent.missing('<plugname>')
        return
    plugs = ievent.rest.split()
    disabled = []
    for plug in plugs:
        plugins.unload(plug)
        plugins.disable(plug)
        disabled.append(plug)
    ievent.reply('disabled plugins: ', disabled)

Пример #20
0
plughelp.add('autoreply', 'jabber autoreply')


def preautoreply(bot, ievent):
    """ check where autoreply callbacks should fire """
    if not ievent.usercmnd and cfg.get('txt') and not ievent.groupchat:
        return 1


def cbautoreply(bot, ievent):
    """ do the auto reply """
    bot.say(ievent.userhost, cfg.get('txt'))


jcallbacks.add('Message', cbautoreply, preautoreply)


def handle_autoreplydisable(bot, ievent):
    """ disable autoreply """
    cfg.set('txt', '')
    ievent.reply('autoreply is disabled')


cmnds.add('autoreply-disable', handle_autoreplydisable, 'OPER')
examples.add('autoreply-disable', 'disable the autoreply functionality', \
'autoreply-disable')

aliasset('autoreply-set', 'autoreply-cfg txt')
aliasset('autoreply-enable', 'autoreply-cfg txt')
tests.add('autoreply-enable mekker', 'set').add('autoreply-disable')
Пример #21
0
        except ImportError, ex:
            errors.append(str(ex))
            failed.append(plug)
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
            failed.append(plug)
    ievent.reply('enabled plugins: ', reloaded, dot=True)
    if failed:
        ievent.reply('failed to reload: ', failed, dot=True)
    if errors:
        ievent.reply('errors: ', errors, dot=True)
  
cmnds.add('plug-enable', handle_plugenable, 'OPER', options={'-a': ''})
examples.add('plug-enable', 'enable a plugin', 'plug-enable karma')
tests.add('plug-enable country', 'country')

def handle_plugdisable(bot, ievent):
    if not ievent.rest:
        ievent.missing('<plugname>')
        return
    plugs = ievent.rest.split()
    disabled = []
    for plug in plugs:
        plugins.unload(plug)
        plugins.disable(plug)
        disabled.append(plug)
    ievent.reply('disabled plugins: ', disabled)

cmnds.add('plug-disable', handle_plugdisable, 'OPER')
examples.add('plug-disable', 'disable a plugin', 'plug-disable karma')
Пример #22
0
# gozerplugs/plugs/reverse.py
#
# 

__copyright__ = 'this file is in the public domain'
__author__ = 'Hans van Kranenburg <*****@*****.**>'

from gozerbot.generic import waitforqueue
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('reverse', 'reverse string or list')

def handle_reverse(bot, ievent):
    """ reverse string or pipelined list """
    if ievent.inqueue:
        result = waitforqueue(ievent.inqueue, 5)
    elif not ievent.rest:
        ievent.missing('<text to reverse>')
        return
    else:
        result = ievent.rest
    ievent.reply(result[::-1])

cmnds.add('reverse', handle_reverse, ['USER', 'CLOUD'], threaded=True)
examples.add('reverse', 'reverse text or pipeline', '1) reverse gozerbot 2) list | \
reverse')
tests.add('reverse gozerbot', 'tobrezog').add('list | reverse', 'misc')
Пример #23
0
# gozerplugs/beats.py
#
#

""" internet time .beats """

__copyright__ = 'this file is in the public domain'

from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import time, math

plughelp.add('beats', 'show internet time')

def handle_beats(bot, ievent):
    """ beats .. show current internet time """
    beats = ((time.time() + 3600) % 86400) / 86.4
    beats = int(math.floor(beats))
    ievent.reply('@' + str(beats))

cmnds.add('beats', handle_beats, 'USER')
examples.add('beats', 'show current internet time', 'beats')
tests.add('beats' , '@')
Пример #24
0
            else:
                rlog(
                    100,
                    "register",
                    "username %s already exists .. can't \
add %s"
                    % (ievent.nick, ievent.userhost),
                )
    except Exception, ex:
        rlog(100, "register", "failed to add %s (%s) .. reason: %s" % (ievent.nick, ievent.userhost, str(ex)))


callbacks.add("JOIN", anoncb, anonpre, threaded=True)
callbacks.add("Presence", anoncb, anonpre, threaded=True)
tests.add("anon-enable --chan #dunkbots").fakein(":[email protected] JOIN #dunkbots").sleep(3).add(
    "delete dunker"
).add("anon-disable --chan #dunkbots")


def handle_anonenable(bot, ievent):
    cfg.append("enable", jsonstring([bot.name, ievent.channel]))
    ievent.reply("anon enabled on (%s,%s)" % (bot.name, ievent.channel))


cmnds.add("anon-enable", handle_anonenable, "OPER")
examples.add("anon-enable", "enable anon register", "anon-enable")
tests.add("anon-enable", "anon enabled")


def handle_anondisable(bot, ievent):
    try:
Пример #25
0
             ievent.reply('there are already infoitems in the main database .. not upgrading')
             ievent.reply('use the -f option to force an upgrade')
             return
    ievent.reply('upgrading infoitems')
    nritems = upgrade()
    ievent.reply('%s items upgraded' % nritems)

cmnds.add('info-upgrade', handle_infoupgrade, 'OPER', options={'-f': ''})

def handle_infosize(bot, ievent):
    """ info-size .. show number of information items """
    ievent.reply("we have %s infoitems" % info.size())

cmnds.add('info-size', handle_infosize, ['USER', 'WEB', 'CLOUD'])
examples.add('info-size', 'show number of infoitems', 'info-size')
tests.add('info-size', 'we have (\d+) infoitems')

def handle_addinfoitem(bot, ievent):
    """ <keyword> = <description> .. add information item """
    try:
        (what, description) = ievent.groups
    except ValueError:
        ievent.reply('i need <item> <description>')
        return
    if len(description) < 3:
        ievent.reply('i need at least 3 chars for the description')
        return
    what = what.strip()
    ret = info.add(what, description, ievent.userhost, time.time())
    if ret:
        ievent.reply('item added')
Пример #26
0
    "Well, I'll go build my own theme park! With blackjack and hookers! In fact, forget the park!",
    "Compare your lives to mine and then kill yourself!",
    "I would give up my 8 other senses, even smision, for a sense of taste!",
    "Stupid anti-pimping laws!",
    "Blackmail's such an ugly word. I prefer extortion. The x makes it sound cool.",
    "Great is ok, but amazing would be great!",
    "The pie is ready. You guys like swarms of things, right?",
    "Fry cracked corn, and I don't care; Leela cracked corn, I still don't care; Bender cracked corn, and he is great! Take that you stupid corn!",
    "Stay away from our women. You got metal fever, baby, metal fever!",
    "If it ain't black and white, peck, scratch and bite.",
    "Life is hilariously cruel.",
    "Pardon me, brother. Care to donate to the anti-mugging you fund?",
    "I love this planet. I've got wealth, fame, and access to the depths of sleaze that those things bring.",
    "C'mon, it's just like making love. Y'know, left, down, rotate sixty-two degrees, engage rotors...",
    "Oh my God, I'm so excited I wish I could wet my pants.",
    "Argh. The laws of science be a harsh mistress.",
    "In the event of an emergency, my ass can be used as a floatation device.",
    "Hey, I got a busted ass here! I don't see anyone kissing it.",
    "I'm a fraud - a poor, lazy, sexy fraud.",
    "This'll show those filthy bastards who's loveable!"
]


def handle_bender(bot, ievent):
    ievent.reply(random.choice(benders))


cmnds.add('bender', handle_bender, 'USER')
examples.add('bender', 'show a bender quote', 'bender')
tests.add('bender')
Пример #27
0
 "Ahh, computer dating. It's like pimping, but you rarely have to use the phrase, 'upside your head'.",
 "Court's kinda fun when it's not my ass on the line!",
 "Maybe you can interface with my ass! By biting it!",
 "Well, I'll go build my own theme park! With blackjack and hookers! In fact, forget the park!",
 "Compare your lives to mine and then kill yourself!",
 "I would give up my 8 other senses, even smision, for a sense of taste!",
 "Stupid anti-pimping laws!",
 "Blackmail's such an ugly word. I prefer extortion. The x makes it sound cool.",
 "Great is ok, but amazing would be great!",
 "The pie is ready. You guys like swarms of things, right?",
 "Fry cracked corn, and I don't care; Leela cracked corn, I still don't care; Bender cracked corn, and he is great! Take that you stupid corn!",
 "Stay away from our women. You got metal fever, baby, metal fever!",
 "If it ain't black and white, peck, scratch and bite.",
 "Life is hilariously cruel.",
 "Pardon me, brother. Care to donate to the anti-mugging you fund?",
 "I love this planet. I've got wealth, fame, and access to the depths of sleaze that those things bring.",
 "C'mon, it's just like making love. Y'know, left, down, rotate sixty-two degrees, engage rotors...",
 "Oh my God, I'm so excited I wish I could wet my pants.",
 "Argh. The laws of science be a harsh mistress.",
 "In the event of an emergency, my ass can be used as a floatation device.",
 "Hey, I got a busted ass here! I don't see anyone kissing it.",
 "I'm a fraud - a poor, lazy, sexy fraud.",
 "This'll show those filthy bastards who's loveable!"]

def handle_bender(bot, ievent):
    ievent.reply(random.choice(benders))
    
cmnds.add('bender', handle_bender, 'USER')
examples.add('bender', 'show a bender quote', 'bender')
tests.add('bender')
Пример #28
0
__copyright__ = 'this file is in the public domain'
__author__ = 'Hans van Kranenburg <*****@*****.**>'

from gozerbot.generic import waitforqueue
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('reverse', 'reverse string or list')


def handle_reverse(bot, ievent):
    """ reverse string or pipelined list """
    if ievent.inqueue:
        result = waitforqueue(ievent.inqueue, 5)
    elif not ievent.rest:
        ievent.missing('<text to reverse>')
        return
    else:
        result = ievent.rest
    ievent.reply(result[::-1])


cmnds.add('reverse', handle_reverse, ['USER', 'CLOUD'], threaded=True)
examples.add('reverse', 'reverse text or pipeline',
             '1) reverse gozerbot 2) list | \
reverse')
tests.add('reverse gozerbot', 'tobrezog').add('list | reverse', 'misc')
Пример #29
0
        ievent.missing('<botname>')
        return

    try:
        if fleet.connect(botname):
            ievent.reply('%s connected' % botname)
        else:
            ievent.reply("can't connect %s" % botname)
    except Exception, ex:
        ievent.reply(str(ex))


cmnds.add('fleet-connect', handle_fleetconnect, 'OPER', threaded=True)
examples.add('fleet-connect', 'connect bot with <name> to irc server',
             'fleet-connect test')
tests.add('fleet-add local test localhost').add('fleet-connect local').add(
    'fleet-del local')


def handle_fleetdisconnect(bot, ievent):
    """ fleet-disconnect <botname> .. disconnect a fleet bot from server. """

    try:
        botname = ievent.args[0]
    except IndexError:
        ievent.missing('<botname>')
        return

    ievent.reply('exiting %s' % botname)

    try:
        if fleet.exit(botname):
Пример #30
0
from gozerbot.generic import waitforqueue
from gozerbot.commands import cmnds
from gozerbot.plughelp import plughelp
from gozerbot.examples import examples
from gozerbot.tests import tests

plughelp.add('tail', 'show last <nr> elements of pipeline')


def handle_tail(bot, ievent):
    """ used in a pipeline .. show last <nr> elements """
    if not ievent.inqueue:
        ievent.reply("use tail in a pipeline")
        return
    try:
        nr = int(ievent.args[0])
    except (ValueError, IndexError):
        ievent.reply('tail <nr>')
        return
    result = waitforqueue(ievent.inqueue, 30)
    if not result:
        ievent.reply('no data to tail')
        return
    ievent.reply(result[-nr:])


cmnds.add('tail', handle_tail, ['USER', 'CLOUD'], threaded=True)
examples.add('tail', 'show last <nr> lines of pipeline output', \
'list | tail 5')
tests.add('list | tail 5')
Пример #31
0
ignorenicks = []

def handle_broadcast(bot, ievent):

    """ broadcast txt to all joined channels. """

    if not ievent.rest:
         ievent.missing('<txt>')
         return

    fleet.broadcast(ievent.rest)
    partyline.say_broadcast(ievent.rest)

cmnds.add('broadcast', handle_broadcast, 'OPER')
examples.add('broadcast', 'send a message to all channels and dcc users', 'broadcast good morning')
tests.add('broadcast testing testing')

def handle_alternick(bot, ievent):

    """ set alternative nick used if nick is already taken. """

    try:
        nick = ievent.args[0]
    except IndexError:
        ievent.reply('alternick is %s' % bot.state['alternick'])
        return

    bot.state['alternick'] = nick
    bot.state.save()
    ievent.reply('alternick changed to %s' % nick)
Пример #32
0
    ttime = strtotime(what)
    nr = 0
    if not ttime == None:
        ievent.reply('time detected ' + time.ctime(ttime))
        what = striptime(what)
        alarmnr = alarms.add(bot.name, ievent.nick, ttime, what)
        nr = todo.add(name, what, ttime, alarmnr=alarmnr)
    else:
        nr = todo.add(name, what)
    ievent.reply('todo item %s added' % nr)


cmnds.add('todo', handle_todo, 'USER')
examples.add('todo', 'todo [<item>] .. show todo items or add a todo item', \
'1) todo 2) todo program the bot 3) todo 22:00 sleep')
tests.add('todo program the bot').add('todo', 'program the bot')


def handle_tododone(bot, ievent):
    """ todo-done <listofnrs> .. remove todo items """
    if len(ievent.args) == 0:
        ievent.missing('<list of nrs>')
        return
    try:
        nrs = []
        for i in ievent.args:
            nrs.append(int(i))
    except ValueError:
        ievent.reply('%s is not an integer' % i)
        return
    name = users.getname(ievent.userhost)
Пример #33
0
        ievent.reply('<job id>')
        return

    for job in periodical.jobs:
        if job.id() == int(ievent.args[0]):
            next = job.next
            if type(next) in [types.FloatType, types.IntType]:
                next = datetime.datetime(*time.localtime(next)[:7])
            ievent.reply('%s, fires at %s' % (job.__repr__(), str(next)))
            return

    ievent.reply('job not found')

cmnds.add('job', handle_job, 'USER')
examples.add('job', 'show job data of <jobid> ', 'job 1')
tests.add('job 1')

def handle_joblist(bot, ievent):

    """ show job list. """

    try:
        group = ievent.args[0]
    except IndexError:
        group = None
    result = []

    for job in periodical.jobs:
        if group and not job.group == group:
            continue
        if job.description:
Пример #34
0
            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')
Пример #35
0
__copyright__ = 'this file is in the public domain'
__revision__ = '$Id: m8b.py 1120 2006-12-30 12:00:00Z deck $'

from gozerbot.generic import handle_exception
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import re, random

plughelp.add('8b', 'Ask the magic 8 ball')

balltxt = [
    "Signs point to yes.", "Yes.", "Most likely.", "Without a doubt.",
    "Yes - definitely.", "As I see it, yes.", "You may rely on it.",
    "Outlook good.", "It is certain.", "It is decidedly so.",
    "Reply hazy, try again.", "Better not tell you now.", "Ask again later.",
    "Concentrate and ask again.", "Cannot predict now.", "My sources say no.",
    "Very doubtful.", "My reply is no.", "Outlook not so good.",
    "Don't count on it."
]


def handle_8b(bot, ievent):
    ievent.reply(random.choice(balltxt))


cmnds.add('8b', handle_8b, 'USER')
examples.add('8b', 'show what the magic 8 ball has to say', '8b')
tests.add('8b')
Пример #36
0
cmnds.add('quote-upgrade', handle_quoteupgrade, 'OPER', options={'-f': ''})


def handle_quoteadd(bot, ievent):
    """ quote-add <txt> .. add a quote """
    if not ievent.rest:
        ievent.missing("<quote>")
        return
    idnr = quotes.add(ievent.nick, ievent.userhost, ievent.rest)
    ievent.reply('quote %s added' % idnr)


cmnds.add('quote-add', handle_quoteadd, ['USER', 'QUOTEADD'], allowqueue=False)
examples.add('quote-add', 'quote-add <txt> .. add quote', 'quote-add mekker')
aliases.data['aq'] = 'quote-add'
tests.add('quote-add mekker', 'quote (\d+) added')


def handle_quotewho(bot, ievent):
    """ quote-who <nr> .. show who added a quote """
    try:
        quotenr = int(ievent.args[0])
    except IndexError:
        ievent.missing("<nr>")
        return
    except ValueError:
        ievent.reply("argument must be an integer")
        return
    result = quotes.whoquote(quotenr)
    if not result:
        ievent.reply('no who quote data available')
Пример #37
0
from gozerbot.plugins import plugins
from gozerbot.fleet import fleet
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add(
    'size', 'the size command shows the sizes of plugins that \
provide a size() plugin command and the sizes of some basic structures')


def handle_size(bot, ievent):
    """ size .. show size of core datastructures """
    txtlist = []
    txtlist.append("fleet: %s" % fleet.size())
    txtlist.append("users: %s" % users.size())
    txtlist.append("cmnds: %s" % cmnds.size())
    txtlist.append("callbacks: %s" % callbacks.size())
    txtlist.append("rebefore: %s" % rebefore.size())
    txtlist.append("reafter: %s" % reafter.size())
    txtlist.append("aliases: %s" % len(aliases.data))
    txtlist.append("examples: %s" % examples.size())
    plugsizes = plugins.plugsizes()
    if plugsizes:
        txtlist += plugsizes
    ievent.reply(txtlist)


cmnds.add('size', handle_size, ['USER', 'WEB'])
examples.add('size', 'show sizes of various data structures', 'size')
tests.add('size', 'users')
Пример #38
0
from gozerbot.aliases import aliasset
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('code', 'the code plugin provides code related commands')

def handle_showexceptions(bot, ievent):

    """ show exception list. """

    ievent.reply(str(exceptionlist))

cmnds.add('code-exceptions' , handle_showexceptions, 'OPER')
examples.add('code-exceptions', 'show exception list', 'code-exceptions')
aliasset('exceptions', 'code-exceptions')
tests.add('code-exceptions')

def handle_funcnames(bot, ievent):

    """ show function names of a plugin. """

    try:
        plugname = ievent.args[0]
    except IndexError:
        ievent.missing('<plugname>')
        return

    if not plugins.exist(plugname):
        ievent.reply('no %s plugin exists' % plugname)
        return
Пример #39
0
import requests
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

# add help

plughelp.add('asn', 'lookup ASN via peeringdb')

def handle_asn(bot, ievent):
    asnumber_in = ""
    try: what = ievent.args[0]
    except IndexError: ievent.missing("<asn>"); return
    try:
         asnumber_in = what
         url = "https://stat.ripe.net/data/as-overview/data.json?resource=" + asnumber_in
         resp = requests.get(url=url)
         pdb_json = json.loads(resp.text)
         network_name = pdb_json['data'][0]['holder']
         resultstring = "AS Number: %s has name: %s" % (asnumber_in, network_name)
         ievent.reply(resultstring)
    except Exception, ex: ievent.reply("Invalid ASN") ; return


cmnds.add('asn', handle_asn, 'USER')
examples.add('asn', 'Lookup as number on ripestat', 'asn 8315')
tests.add('asn 8315')

### In elkaar gerost door phreak ergens in 2020.
Пример #40
0
def handle_to(bot, ievent):
    """ direct pipeline output to <nick> """
    if not ievent.inqueue:
        ievent.reply('use to in a pipeline')
        return
    try:
        nick = ievent.args[0]
    except IndexError:
        ievent.reply('to <nick>')
        return
    if nick == 'me':
        nick = ievent.nick
    if not getwho(bot, nick):
        ievent.reply("don't know %s" % nick)
        return
    result = waitforqueue(ievent.inqueue, 5)
    if result:
        ievent.reply("%s sends you this:" % ievent.nick, nick=nick)
        ievent.reply(result, nick=nick, dot=True)
        if len(result) == 1:
            ievent.reply('1 element sent')
        else:
            ievent.reply('%s elements sent' % len(result))
    else:
        ievent.reply('nothing to send')

cmnds.add('to', handle_to, 'USER', threaded=True)
examples.add('to', 'send pipeline output to another user', 'list | to dunker')
tests.add('list | to dunker')
Пример #41
0
    txt = striptime(alarmtxt).strip()
    if not txt:
        ievent.reply('i need txt to remind you')
        return
    if time.time() > alarmtime:
        ievent.reply("we are already past %s" % time.ctime(alarmtime))
        return
    # add alarm
    nrid = alarms.add(bot.name, ievent.nick, alarmtime, txt, ievent.printto)
    ievent.reply("alarm %s set at %s" % (nrid, time.ctime(alarmtime)))

cmnds.add('alarm', handle_alarmadd, 'USER', allowqueue=False)
examples.add('alarm', 'say txt at a specific time or time diff', \
'1) alarm 12:00 lunchtime 2) alarm 3-11-2008 0:01 birthday ! 3) alarm +180 \
egg ready')
tests.add('alarm 23:59 sleeptime', 'alarm (\d+) set at').add('alarm-del %s')

def handle_alarmlist(bot, ievent):
    """ alarm-list .. list all alarms """
    result = []
    for alarmdata in alarms.data:
        i = Alarmitem(d=alarmdata)
        result.append("%s) %s: %s - %s " % (i.idnr, i.nick, \
time.ctime(i.time), i.txt))
    if result:
        ievent.reply("alarmlist: ", result, dot=True)
    else:
        ievent.reply('no alarms')

cmnds.add('alarm-list', handle_alarmlist, 'OPER')
examples.add('alarm-list', 'list current alarms', 'alarm-list')
Пример #42
0
    try:
        result = addtolist('all', listname, item)
    except Exception, ex:
        handle_exception()
        ievent.reply('ERROR: %s' % str(ex))
        return
    if result:
        ievent.reply('%s (%s) added to %s list' % (item, result, listname))
    else:
        ievent.reply('add failed')

cmnds.add('lists-global', handle_listsglobal, 'USER')
examples.add('lists-global', "lists-global <listname> [',' <item>] .. show \
content of list or add item to list", '1) lists-global bla 2) lists-global \
bla, mekker')
tests.add('lists-global test, mekker', 'added to test list').add('lists-global test', 'mekker')

def handle_listsglobaldel(bot, ievent):
    """ list-globaldel <listname> ',' <listofnrs> .. remove items with \
indexnr from list """
    if not ievent.rest:
        ievent.missing('<listofnrs>')
        return
    try:
        nrs = []
        for i in ievent.rest.split():
            nrs.append(int(i))
    except ValueError:
        ievent.reply('%s is not an integer' % i)
        return
    nrs.sort()
Пример #43
0
    for i, j in options:
        if i == '-r':
            doregex = True

    res = []

    if doregex:
        try:
            reg = re.compile(' '.join(rest))
        except Exception, ex:
            ievent.reply("can't compile regex: %s" % str(ex))
            return
        for i in result:
            if not re.search(reg, i):
                res.append(i)
    else:
        for i in result:
            if ievent.rest not in str(i):
                res.append(i)

    if not res:
        ievent.reply('no result')
    else:
        ievent.reply(res, dot=True)


cmnds.add('not', handle_not, ['USER', 'WEB', 'CLOUD'], threaded=True)
examples.add('not', 'reverse grep used in pipelines', 'list | not todo')
tests.add('list | not core')
Пример #44
0
from gozerbot.plugins import plugins
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

plughelp.add('inform', 'inform <nick> the output of a command')

def handle_inform(bot, ievent):
    """ prepend nick: to the output of command to another user """
    if ievent.msg:
        ievent.reply('inform can only be used in a channel')
        return
 
    try:
        nick, cmnd = ievent.rest.split(' ', 1)
    except ValueError:
        ievent.missing('<nick> <command>')
        return

    ievent.txt = cmnd
    result = plugins.cmnd(bot, ievent)

    if not result:
        ievent.reply("no result for %s" % cmnd)
        return

    ievent.reply("%s: " % nick, result, dot=True)

cmnds.add('inform', handle_inform, 'USER', threaded=True)
examples.add('inform', 'inform <nick> <command> .. inform <nick> the output of command', 'inform dunker version')
tests.add('inform dunker version', 'dunker')
Пример #45
0
plughelp.add('tell', 'the tell command sends the output of a command to \
another user')

def handle_tell(bot, ievent):
    """ send output of command to another user """
    if ievent.msg:
        ievent.reply('tell can only be used in a channel')
        return 
    try:
        nick, cmnd = ievent.rest.split(' ', 1)
    except ValueError:
        ievent.missing('<nick> <command>')
        return
    ievent.txt = cmnd
    #if not plugins.woulddispatch(bot, ievent):
    #    ievent.reply("can't execute %s" % cmnd)
    #    return  
    result = plugins.cmnd(bot, ievent)
    if not result:
        ievent.reply("no result for %s" % cmnd)
        return
    ievent.reply("%s sends your this: " % ievent.nick, result, nick=nick, \
dot=True)
    ievent.reply("%s item(s) send" % len(result))

cmnds.add('tell', handle_tell, 'USER', threaded=True)
examples.add('tell', 'tell <nick> <command> .. send output of command to \
another user', 'tell dunker version')
tests.add('tell dunker version', 'GOZERBOT')
Пример #46
0
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

# basic imports
import random

plughelp.add('choice', 'make a random choice')

def handle_choice(bot, ievent):

    """ make a random choice out of different words or list elements. """ 

    result = []

    if ievent.inqueue:
        result = waitforqueue(ievent.inqueue, 5)
    elif not ievent.args:
        ievent.missing('<space seperated list>')
        return
    else:
        result = ievent.args         

    ievent.reply(random.choice(result))

cmnds.add('choice', handle_choice, ['USER', 'WEB', 'CLOUD'], threaded=True)
examples.add('choice', 'make a random choice', '1) choice a b c 2) list | choice')
tests.add('choice a ab ac', 'a')
tests.add('list | choice')
Пример #47
0
    allowed = users.allowed(userhost, 'OPER', log=False)

    if allowed:
        ievent.reply("can't ignore OPER")
        return

    addignore(userhost, nrseconds)
    ievent.reply("ignoring %s for %s seconds" % (nick, nrseconds))


cmnds.add('ignore', handle_ignore, ['OPER', 'IGNORE'], speed=1)
examples.add('ignore',
             'ignore <nick> <seconds> .. ignore <nick> for <seconds>',
             'ignore test 3600')
tests.add('ignore bottest 3', 'bottest').add('ignore-del bottest')


def handle_ignoredel(bot, ievent):
    """ remove nick from ignore list. """

    try:
        nick = ievent.args[0]
    except IndexError:
        ievent.missing('<nick>')
        return

    userhost = getwho(bot, nick)

    if not userhost:
        ievent.reply("can't get userhost of %s" % nick)
Пример #48
0
        botname = ievent.args[0]
    except IndexError:
        ievent.missing('<botname>')
        return

    try:
        if fleet.connect(botname):
            ievent.reply('%s connected' % botname)
        else:
            ievent.reply("can't connect %s" % botname)
    except Exception, ex:
        ievent.reply(str(ex))

cmnds.add('fleet-connect', handle_fleetconnect, 'OPER', threaded=True)
examples.add('fleet-connect', 'connect bot with <name> to irc server', 'fleet-connect test')
tests.add('fleet-add local test localhost').add('fleet-connect local').add('fleet-del local')

def handle_fleetdisconnect(bot, ievent):

    """ fleet-disconnect <botname> .. disconnect a fleet bot from server. """

    try:
        botname = ievent.args[0]
    except IndexError:
        ievent.missing('<botname>')
        return

    ievent.reply('exiting %s' % botname)

    try:
        if fleet.exit(botname):
Пример #49
0
    chan = ievent.channel.lower()

    try:
        p = bot.channels[chan]['perms']
    except (KeyError, TypeError):
        ievent.reply("channel %s has no permissions set" % chan)
        return

    if p:
        ievent.reply('permissions of channel %s: ' % chan, p, dot=True)
    else:
        ievent.reply("channel %s has no permissions set" % chan)
    
cmnds.add('chanperm', handle_chanperm, 'OPER')
examples.add('chanperm', 'show channel permissions', 'chanperm')
tests.add('chanperm-add mekker chan #dunkbots').add('chanperm chan #dunkbots', 'MEKKER').add('chanperm-del chan #dunkbots mekker')

def handle_chanpermadd(bot, ievent):

    """ add channel permission. """

    try:
        perm = ievent.args[0].upper()
    except IndexError:
        ievent.missing('<perm>')
        return

    if perm in ['OPER', 'USER']:
        ievent.reply("can't set channel permission to %s" % perm)
        return
Пример #50
0
    name = users.getname(ievent.userhost)
    ttime = strtotime(what)
    nr = 0
    if not ttime == None:
        ievent.reply('time detected ' + time.ctime(ttime))
        what = striptime(what)
        alarmnr = alarms.add(bot.name, ievent.nick, ttime, what)
        nr = todo.add(name, what, ttime, alarmnr=alarmnr)
    else:
        nr = todo.add(name, what)
    ievent.reply('todo item %s added' % nr)

cmnds.add('todo', handle_todo, 'USER')
examples.add('todo', 'todo [<item>] .. show todo items or add a todo item', \
'1) todo 2) todo program the bot 3) todo 22:00 sleep')
tests.add('todo program the bot').add('todo', 'program the bot')

def handle_tododone(bot, ievent):
    """ todo-done <listofnrs> .. remove todo items """
    if len(ievent.args) == 0:
        ievent.missing('<list of nrs>')
        return
    try:
        nrs = []
        for i in ievent.args:
            nrs.append(int(i))
    except ValueError:
        ievent.reply('%s is not an integer' % i)
        return
    name = users.getname(ievent.userhost)
    nrdone = 0
Пример #51
0
balltxt=[
    "Signs point to yes.",
    "Yes.",
    "Most likely.",
    "Without a doubt.",
    "Yes - definitely.",
    "As I see it, yes.",
    "You may rely on it.",
    "Outlook good.",
    "It is certain.",
    "It is decidedly so.",
    "Reply hazy, try again.",
    "Better not tell you now.",
    "Ask again later.",
    "Concentrate and ask again.",
    "Cannot predict now.",
    "My sources say no.",
    "Very doubtful.",
    "My reply is no.",
    "Outlook not so good.",
    "Don't count on it."
    ]

def handle_8b(bot, ievent):
    ievent.reply(random.choice(balltxt))

cmnds.add('8b', handle_8b, 'USER')
examples.add('8b', 'show what the magic 8 ball has to say', '8b')
tests.add('8b')
Пример #52
0
    s = create_session()
    s.begin(subtransactions=True)
    bd = s.query(Birthday).filter(Birthday.name==name).first()
    if not bd:
        bd = Birthday(name, what)
        s.save(bd)
    else:
        bd.birthday = what
    s.commit()
    ievent.reply('birthday set')

cmnds.add('bd-set', handle_bdset, 'USER')
examples.add('bd-set', 'bd-set <date> .. set birthday', 'bd-set 3-11-1967')
aliases.data['setbd'] = 'bd-set'
aliases.data['setjarig'] = 'bd-set'
tests.add('bd-set 3-11-1967', 'birthday set')

def handle_bddel(bot, ievent):
    """ bd-del .. delete birthday """
    name = users.getname(ievent.userhost)
    result = 0
    s = create_session()
    bd = s.query(Birthday).filter(Birthday.name==name).first()
    if not bd:
        ievent.reply('no birthday known for %s (%s)' % (ievent.nick, name))
    else:
        s.delete(bd)
        ievent.reply('birthday removed')

cmnds.add('bd-del', handle_bddel, 'USER')
examples.add('bd-del', 'delete birthday data', 'bd-del')