Last active
March 28, 2020 16:57
-
-
Save valenso/bc449ca57e5cf772e925c9fcb4ec1993 to your computer and use it in GitHub Desktop.
Bots Factory with Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6 | |
WORKDIR /. | |
COPY . . | |
RUN bundle install | |
CMD ["ruby", "./bot.rb"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'telegram-bot-ruby' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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