Good bot. Best friend.
WulfBot is a Telegram bot written in Ruby that interfaces with the Telegram Bot API. It does a bunch of arbitrary, unrelated things that I felt like implementing.
- Install the proper version of ruby, according to the contents of
.ruby-version(using rbenv or rvm is recommended) gem install bundlerbundle installrake db:schema:load- Copy
secrets.yaml.sampletosecrets.yamland edit it, setting the token to the token given to you by BotFather.
To set up using a production database instead of a development one, edit
db/config.yml accordingly, then:
export DATABASE=production
rake db:schema:loadbundle exec ruby wulfbot.rbTo run with a production database:
export DATABASE=production
bundle exec ruby wulfbot.rbWulfBot accepts the following commands:
/btc [cur]: Gets the conversion rate for Bitcoin into the specified currency (3 letter international code). Defaults to USD if no argument given./sauce: Posts a link to the bot's source code on GitHub/emojize [phrase]: Turns the given phrase into emojis. ↪️🅾Ⓜ️ 🅿️ 🕒📧➕📧🕒💴 ⛎💲📧🕒📧💲💲./dogyears [time]: Converts a time into dog years, using arbitrary precision decimal math./uptime: Tells how long the bot has been running./ddate: Gets the current date in the Discordian calendar system. Requires theddatecommand to be installed./weewoo: 🚨🐺🚔🚔🚨🐺🚨🐺🚔🐺🚔🐺🚔🚔🐺🐺🐺🐺🚨🐺🚨🚔🚔🚨🚔🐺🐺🐺🚔🚨/bedtime: Calculates times to wake up to avoid interrupting a sleep cycle
A point tracker (think upvotes/downvotes):
/addpoint [thing]: Gives 1 point to thing/rmpoint [thing]: Removes 1 point from thing/points [thing]: Checks how many points thing has/top: Shows the highest scoring things/bottom: Shows the lowest scoring things
Points are stored per chat and rate limited per chat/person/thing combination.
Retrieves information about a Minecraft server. Please update secrets.yaml
with the settings of the server.
/minecraft: Shows the server description, player count, total slots, and list of players online.
Want to write your own plugin for WulfBot? It now has a plugin-ish API, take a
look at files in the plugin/ directory for examples on how to use it. The
short story is:
module MyCoolModule
# Register a command handler
WulfBot::register_command(command: "docoolthing") do |message|
# Do stuff here. This will be run if the user types "/docoolthing".
# `message` is a Telegram API message object, consult the telegram-bot-ruby
# project for more information.
WulfBot::send_limited(message.chat.id, "Yo, this is one cool plugin!")
end
end