Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot. Getting YouTube image previews

Version ENG | RUS

Install

  1. Install golang: go.dev/doc/install
  2. Clone repo:
md youtube-bot && cd youtube-bot
git clone https://github.com/tecspda/get-img-from-youtube-bot.git .
  1. Initialize the Golang project
go mod init modules
go mod tidy

Compilation for Unix

GOOS=linux GOARCH=amd64 go build -o youtubeimgbot

In this example, the amd64 parameter is specified for compiling the executable file for Linux x86. If you want to compile for your system, enter the command

go build youtubeimgbot

Copy to production-server

If you compiled the bot on your local computer:

  1. Copy only three files to the server: youtubeimgbot.sh, youtubeimgbot, .env.
  2. Don't forget to set the permissions:
cd /var/www/bots/get_youtube_img_bot
chmod 0775 youtubeimgbot.*
  1. Create a directory uploads on the server. Grant 775 permissions.

Bot Configuration

  1. Регистрация бота
  2. Rename the example.env file to .env and enter the bot key (see the above point)

Running the Bot as a Service

Creating the Service File

sudo nano /etc/systemd/system/youtubeimgbot.service
[Unit]
Description=Youtube bot Service
After=network.target

[Service]
ExecStart=/var/www/bots/get_youtube_img_bot/youtubeimgbot.sh
Restart=always

[Install]
WantedBy=default.target

Starting the Daemon on the Server

systemctl start youtubeimgbot
systemctl status youtubeimgbot
systemctl enabled youtubeimgbot

Done

Congratulations! Your standalone bot is now running on the server.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages