The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bot::Backbone::Service::OFun::Karma - Keep track of your channel's favorite things

VERSION

version 0.142230

SYNOPSIS

    # in your bot config
    service karma => (
        service => 'OFun::Karma',
        db_dsn  => 'dbi:SQLite:karma.db',
    );

    disapatcher chatroom => as {
        redispatch_to 'karma';
    }

    # in chat
    alice> bob++ that was hilarious
    bob> !best
    bot> alice: 23
         bob: 14
         rob: 7
         bobby: 6
    bob> !score_alias bobby bob
    bot> Scores for "bobby" will count for "bob" instead.
    alice> !score_alias rob bob
    bot> Scores for "rob" will count for "bob" instead.
    bob> !score bob
    bot> bob: 27
    bob> !score bobby
    bot> bob: 27
    bob> !score_alias bob
    bot> Scores for "bob" also include "bobby" and "rob".
    bob> !score_unalias rob
    bot> Scores for "rob" will count for "rob" now.
    alice> "made up stuff"--
    bob> !worst
    bot> made up stuff: -1
         rob: 7
         bob: 20
         alice: 23

DESCRIPTION

A common idiom in group chat (at least among tech geeks) is to use ++ and -- to show appreciation and derision. Now, you can have a bot that tracks that. It will show you a best ten list, a worst ten list, and the score of any particular word or phrase.

You can also provide aliases, just in case a particular thing is referred to in more than one way and you want to track those scores together. The scores are still tracked for the original words, but tallied together while aliased. This way, if someone creates a bad or false alias, you can unalias it later without losing how things were scored in the meantime.

DISPATCHER

!score

    !score thing
    !score

With an argument, this command reports the score for it. Without an argument, it shows the best ten list, just like !best.

!best

This command takes no arguments and shows the best ten list.

!worst

This command takes no argumenst and shows the worst ten list.

!score_alias

    !score_alias this that
    !score_alias this

With two arguments, this command will establish an alias from one word or phrase to another. You need to make sure to quote your phrases if they contain more than one word. Note that when it creates the alias, it will remove that word from either side of any other alias. Aliases cannot be chained.

If only a single argument is given (again, make sure you quote your phrases), it will report if there are any score aliases to or from that word or phrase.

!score_unalias

    !score_unalias this

This will delete any alias from this to something else.

Other Conversation

Finally, any other conversation is monitored to see if it contains ++ or -- notation. Anytime a word or quoted phrase contains a ++ or -- at the end of it, the score for that word or phrase will be incremented or decremented (respectively).

METHODS

load_schema

Called when making database connections to create tables needed to store scores and aliases.

ok_name

Given a name, returns true if it's scorable.

update_scores

This implements the tracking of ++ and -- to update scores from regular conversation.

score_of_thing

Reports the score of a thing, including any aliased scores.

show_alias_of_this

Used to implement !score_alias with a single argument.

alias_this_to_that

Implements !score_alias with two arguments.

unalias_this

Implements the !score_unalias command.

best_scores

Implements the best 10 list.

worst_scores

Implements the worst 10 list.

initialize

No op.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.