Skip to content

Bot for converting video into a circle note, scheduling feeds to channels, and merging video files together

Notifications You must be signed in to change notification settings

Wl0cKk/circle_tg

Repository files navigation

project-image


What can this bot do?

Convert sent video into circlesconvert-video
Combine multiple files into one mp4 and send it to youcombine-files
Can send a circle to channels, at a given time

This bot avoid of some annoying limitations because it uses the Local Bot API Server

although this bot is long polling, kill feature here is the size of files we can work with.

Important

But the circle video limit is still 60sec, so if the video is long it will be trimmed from the beginning to one minute


How to run

  git clone https://github.com/Wl0cKk/circle_tg.git
  cd circle_tg

Then create or rename config_example.json to config.json

touch config.json or mv config_example.json config.json

Open it in any editor and replace TOKEN with obtained token from @BotFather

channels can be empty if you don't need broadcast feature.

Important

Get API_ID and API_HASH here - https://core.telegram.org/api/obtaining_api_id

  • Docker compose

Tip

  • In Dockerfile.bot you can specify arguments separated by commas
  • CMD ["ruby", "--mjit", "./bot", "--server=http://telegram-bot-api:8081", "--keep_files", "--silent"]

Have you already installed docker and docker-compose?

Create or rename .env_example to .env

touch .env or mv .env_example .env

Open it in any editor and replace API_ID and API_HASH with yours

You are free to change the folder name, but do the same in docker-compose.yml.:

  mkdir videos

this will install what's needed and run:

  docker-compose up --build

Installing telegram-bot-api takes a while.

  • Locally

    You need ruby and bundle installed.

    ruby -v
    bundle -v

    install all dependencies and follow the installation proccess

    Once installed you can run it with

      telegram-bot-api --api-id=API_ID --api-hash=API_HASH --local

    Then open a new tab in terminal and do the following

    bundle install
    ruby --mjit bot

    Specify the arguments if you wish


Options

You can start bot using 3 arguments: --keep_files, --verbose, --silent.

  • --keep_filesall files including submitted and edited files will not be deleted
  • --verboseLog output from FFMPEG will not be muted
  • --silentEverything will be muted, including logo output and telegram bot logs

Warning

You can't run --verbose and --silent at the same time


Syntax for caption

Note

  • By sending caption along with the video, the bot will not send the video personally, but to the channels specified in config.json
  • Don't forget to add channel ID to config.json
  • Make the bot an administrator
  • '.' — Just a dot, will immediately send circle to channels.
  • 'at 2024/11/8 23:05:09' - specifies a timestamp for an action, YYYY/MM/DD HH:MM:SS.

Tip

Trailing zero is not important: at 2024/11/08 23:05:09 or at 2024/11/08 23:5:9

dhms

This syntax is summarized with the current time. Given the current time is 2024/11/03 14:25:

  • 'at 5d 23:05:09' — Scheduled for 2024/11/08 23:05:09.
  • 'at 5d 10h25m55s' — Scheduled for 2024/11/09 00:50:55.
  • 'in 10d5h' — Will happen in 10 days and 5 hours.