watcher

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

README

Twitter Watcher Telegram Bot

Golang Twitter Notification Bot for Telegram

This is a bot for Telegram written in Golang, backed by a SQL database that is used for subscribing to user Tweets.

Command Line Options

Twitter Watcher Telegram Bot
Purple Security (losynth.com/purple) 2021 - 2023

Usage:
  -h              Print this help menu.
  -f <file>       Configuration file path.
  -d              Dump the default configuration and exit.
  -clear-all      Clear the database of ALL DATA before starting up.
  -update         Update the database schema to the latest version.

Configuration Options

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

{
    "db": {
        "host": "tcp(localhost:3306)",
        "user": "watcher_user",
        "password": "password",
        "database": "watcher_db"
    },
    "log": {
        "file": "watcher.log",
        "level": 2
    },
    "blocked": [],
    "allowed": [],
    "twitter": {
        "consumer_key": "",
        "consumer_secret": ""
    },
    "timeouts": {
        "web": 15000000000,
        "resolve": 21600000000000,
        "backoff": 250000000,
        "database": 60000000000,
        "telegram": 15000000000
    },
    "telegram_key": ""
}

Documentation

Index

Constants

View Source
const Defaults = `` /* 397-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 Watcher

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

Watcher is a struct that is used to manage the threads and processes used to control and operate the Telegram Watcher bot service.

func New

func New(s string, empty, update bool) (*Watcher, error)

New returns a new Watcher instance based on the passed config file path.

This function will preform any setup steps needed to start the Watcher. Once complete, use the 'Run' function to actually start the Watcher.

This function allows for specifying the option to clear the database before starting.

func (*Watcher) Add added in v1.4.0

func (w *Watcher) Add(r *http.Request)

Add fulfils the Authenticator interface.

func (*Watcher) Run

func (w *Watcher) Run() error

Run will start the main Watcher process and all associated threads.

This function will block until an interrupt signal is received. This function also 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