Skip to content

Instantly share code, notes, and snippets.

@valenso
Last active March 28, 2020 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valenso/bc449ca57e5cf772e925c9fcb4ec1993 to your computer and use it in GitHub Desktop.
Save valenso/bc449ca57e5cf772e925c9fcb4ec1993 to your computer and use it in GitHub Desktop.
Bots Factory with Docker
require 'telegram/bot'
token = ""
Telegram::Bot::Client.run(token) do |bot|
bot.listen do |message|
text = ["😂","😎","🥳"].sample
bot.api.send_message(chat_id: message.chat.id, text: text)
end
end
FROM ruby:2.6
WORKDIR /.
COPY . .
RUN bundle install
CMD ["ruby", "./bot.rb"]
source 'https://rubygems.org'
gem 'telegram-bot-ruby'
Go to https://www.docker.com/products/docker-desktop
Download version for your platform (Windows or MacOS)
Run the Docker app
Create folder "bot" in Documents
Generate files (bot.rb, Dockerfile, Gemfile) in the folder
Set token in bot.rb file
Opem terminal app
Type `cd ~/Documents` and press enter
Type `bundle install` and press enter
Type `docker build -t my-bot .` and press enter
Type `docker run my-bot` and press enter
Open your bot in Telegram app
Type anything to Bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment