A simple Telegram bot that I built while learning Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
config
lib
tests
.gitignore
.travis.yml
Gemfile
Gemfile.lock
README.md
Rakefile
yanyibot.gemspec

README.md

yanyibot

This is a Telegram bot that I built while learning Ruby. It uses the telegram-bot-ruby gem wrapper for Telegram API.

Installation

Execute:

$ bundle

Usage

Create a new bot and obtain a token from BotFather. Replace the contents of ./config/secret.yml with your obtained token:

telegram_bot_api_token: "YOUR_TELEGRAM_BOT_API_TOKEN"

If you are planning to use Last.fm integration, please obtain a key. Replace the contents of ./config/secret.yml with your obtained key and secret:

key: "YOUR_LASTFM_API_KEY"
secret: "YOUR_LASTFM_API_KEY"

Change the Last.fm user in ./lib/yanyibot/lastfm.rb:

last_track = @lastfm.user.get_recent_tracks(user: 'yanyi_', limit: 1)

Run the app at your project root by:

$ ruby ./bin/yanyibot

Available Commands

The commands are available in ./lib/yanyibot/messenger.rb.

/start - returns a "Hello, FIRST_NAME" and instructions

/help - list the commands available

/github - get my GitHub account link

/twitter - get my Twitter account link

/lastfm - get the last track I listened to