Bot::Backbone::Service::OFun::Karma - Keep track of your channel's favorite things
version 0.142230
# 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
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.
!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.
This command takes no argumenst and shows the worst ten list.
!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 this
This will delete any alias from this to something else.
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).
Called when making database connections to create tables needed to store scores and aliases.
Given a name, returns true if it's scorable.
This implements the tracking of ++ and -- to update scores from regular conversation.
Reports the score of a thing, including any aliased scores.
Used to implement !score_alias with a single argument.
!score_alias
Implements !score_alias with two arguments.
Implements the !score_unalias command.
!score_unalias
Implements the best 10 list.
Implements the worst 10 list.
No op.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
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.
To install Bot::Backbone::Service::OFun, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Backbone::Service::OFun
CPAN shell
perl -MCPAN -e shell install Bot::Backbone::Service::OFun
For more information on module installation, please visit the detailed CPAN module installation guide.