Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
/ primitive-bot Public archive

Telegram Bot that recreates images sent to it using primitive geometric shapes.

License

Notifications You must be signed in to change notification settings

salkrr/primitive-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Primitive Bot

example

What is it

This is a Telegram Bot that uses the fogleman/primitive library to reproduce images sent to it using various geometric shapes.

Main features:

  • Inline menu for setting desired options.
  • Doesn't use a database. The queue can be restored from the logs.
  • Sessions are stored in memory and cleared after some time of inactivity (30 minutes by default).

Installation

If you have installation of Go on your machine:

go get github.com/lazy-void/primitive-bot/cmd/primitive-bot

Otherwise, you can download the precompiled binaries from the release page.

Usage

Basic Usage:

primitive-bot -token=$BOT_TOKEN

If you want to restore the queue from the logs, use the -log flag:

primitive-bot -token=$BOT_TOKEN -log=path/to/log.txt

Full list of options:

  -i string
        Path to the directory where user-supplied images are stored. (default "inputs")
  -lang value
        Language of the bot (en, ru). (default "en")
  -limit int
        The number of operations that the user can add to the queue. (default 5)
  -log string
        Path to the previous log file. It is used to restore queue.
  -o string
        Path to the directory where resulting images are stored. (default "outputs")
  -size int
        The max value of image size that the user can specify. (default 3840)
  -steps int
        The max value of steps that the user can specify. (default 2000)
  -timeout duration
        The period of time that a session can be inactive before it's terminated. (default 30m0s)
  -token string
        The token for the Telegram Bot.
  -w int
        The number of parallel workers used to create a primitive image. (defaults to number of CPUs)