Host your own link shortener that works with a bot. Just send the link to a bot and it'll take care of the rest for you. Demo: @AutoExpireShortLinkBot
This version has no external database dependency, and it you can spin it up with just one command.
- Install Docker and Docker Compose in your local machine or server
- Create a Telegram bot by talking to @BotFather
- Create and fill in the credentials to the
env.yml
file, seeenv.yml.example
for the template - run
docker-compose up -d
from the project root folder - Send a link to your bot from Telegram, you should be see reply like (you will need to set up a backend too.)
YOU: http://example.com
BOT: Wow, try http://randomhost.name/abcdefgh
- Following the Docker installation guide.
- Install Docker Compose
- Create a Telegram bot with @BotFather
After cloning the repo, you should create and fill in the credentials to the env.yml
file, see env.yml.example
for the template
To run locally using Docker:
$ docker-compose up
To run without Docker (requires locally installed Ruby 2.3.1+):
$ mkdir -p /run/links # sudo if this doesn't work
$ bundle install
$ bundle exec ruby bot/link-shortener-bot.rb &
$ bundle exec ruby web/app.rb &
$ bundle exec ruby autoremove/app.rb &
On the deployment machine:
$ docker-compose up -d
- Docker - For building and deploying the image
- atipugin/telegram-bot-ruby - Telegram API wrapper
- tommyku/telegram-bot-starter - A telegram bot Boilerplate