swapper

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

README

Sticker Swapper Telegram Bot

Sticker Swapper Bot for Telegram

This is a bot for Telegram written in Golang, backed by a SQL database that is used for swapping or suggesting user stickers via names or parses.

Command Line Options

Sticker Swapper Telegram Bot
Purple Security (losynth.com/purple) 2021

Usage:
  -h              Print this help menu.
  -f <file>       Configuration file path.
  -d              Dump the default configuration and exit.
  -c              Clear the database of ALL DATA before starting up.

Configuration Options

The default config can be dumped to Stdout using the '-d' command line flag.

{
    "db": {
        "host": "tcp(localhost:3306)",
        "user": "swapper_user",
        "timeout": 180000000000,
        "password": "password",
        "database": "swapper_db"
    },
    "log": {
        "file": "swapper.log",
        "level": 2
    },
    "telegram_key": ""
}

Documentation

Index

Constants

View Source
const Defaults = `` /* 228-byte string literal not displayed */

Defaults is a string representation of a JSON formatted default configuration for a Watcher instance.

Variables

This section is empty.

Functions

This section is empty.

Types

type Swapper

type Swapper struct {
	// contains filtered or unexported fields
}

Swapper is a struct that contains the threads and config values that can be used to run the StickerSwap Telegram bot. Use the 'NewSwapper' function to properly create a Swapper.

func New

func New(s string, empty bool) (*Swapper, error)

New returns a new Swapper instance based on the passed config file path. This function will preform any setup steps needed to start the Swapper. Once complete, use the 'Run' function to actually start the Swapper. This function allows for specifying the option to clear the database before starting.

func (*Swapper) Run

func (s *Swapper) Run() error

Run will start the main Swapper process and all associated threads. This function will block until an interrupt signal is received. This function returns any errors that occur during shutdown.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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