primitive-bot

module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0

README

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)

Directories

Path Synopsis
cmd
pkg
menu
Package menu implements functionality of a telegram menu.
Package menu implements functionality of a telegram menu.
primitive
Package primitive implements types and methods for working with fogleman/primitive package.
Package primitive implements types and methods for working with fogleman/primitive package.
queue
Package queue implements a simple linked list based queue
Package queue implements a simple linked list based queue
sessions
Package sessions implements types for working with telegram sessions.
Package sessions implements types for working with telegram sessions.
tg
Package tg implements some of the Telegram API methods
Package tg implements some of the Telegram API methods

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL