Attempt to create a python script that monitors a telegram bot URL and replies to commands for adding/removing karma.
Check more information about Telegram Bots.
News about the program, new features, etc at https://telegram.me/stampynews.
- The bot will need to have access to all of your messages in order to find the words with "++" or "--"
- On first execution it will create database and start filling values
- I've a copy running on <openshift.redhat.com> at http://stampy-iranzo.rhcloud.com/ with the name
@redken_bot
. Invite it to your channels if you want to give it a try or click https://telegram.me/redken_bot.
word++
to add karmaword--
to remove karma/quote add username text
to add a quote for given username with the following text as message/quote username
to retrieve a random quote for that username./dilbert <date>
to retrieve Dilbert's strip for today or supplied date (today if error parsing)/mel <date>
to retrieve Mel's strip for today or supplied date (today or prior days as data is obtained from RSS feed)/obichero <date>
to retrieve O bichero's strip for today or supplied date (today or prior days as data is obtained from RSS feed)@all
to ping all usernames for users in a channelstock <ticker>
to get trading quote for ticker in stock market
The bot, once token has been used and owner set via commandline, will store that information in the database, so you can control it from a chat window
/config show
will list actual defined settings/config set var=value
will set one of those settings with a new value- As of this writing (verbosity, url for api, token, sleep timeout, owner, database, run in daemon mode)
/config delete var
will delete that variable from configuration.
The bot stores stats on users/chats, remembering the chat/user name and last time seen so it can be later used for purging data not being accessed in a while
/stats show (user|chat)
will list the list of users/chats and time of last update
/skarma word=value
will set specified word to the karma value provided.
Bot allows to trigger auto-karma events, so when keyword is given, it will trigger an event to increase karma value for other words
/autok key=value
Will create a new auto-karma trigger, so each timekey
is used, it will trigger value++ event/alias list [word]
Will show current defined autokarma triggers and in case a word is provided will search based on that word/alias delete key=value
will delete a previously defined auto-karma so no more auto-karma events will be triggered for that pair
Bot allows to setup alias, so when karma is given to a word, it will instead add it to a different one (and report that one)
/alias key=value
Will create a new alias, so each timekey++
is used, it will instead do value++- This operation, sums the previous karma of
key
andvalue
and stores it in value so no karma is lost - Recursive aliases can be defined, so doing:
/alias lettuce=vegetable
/alias vegetable=food
lettuce++
will give karma tofood
.
- Alias can be defined to groups of words so, it can be defined to have:
/alias friday=tgif tfsmif
friday++
will increase karma ontgif
andtfsmif
.
- This operation, sums the previous karma of
/alias list
Will show current defined aliases/alias delete key
will delete a previously defined alias so each word gets karma on its own
/quote del id
to remove a specific quote id from database
/quit
will exit daemon mode