toke / go-triggerbot

Telegram Triggerbot written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Triggerbot

A Basic Telegram trigger bot. Triggers can be configured as go regular expressions in a configuration file. Currently only text messages can be triggered.

Go

Compiling

Download and install it. In the Source code directory run: go build -v . Done - proceed withe Section Usage.

Usage

Use config-example.yaml as a template and place save it as triggerbot.yml in the same Directory as the binary. A different name and location can be set via the command line parameter -config

Make sure to insert The Bot TOKEN into the config file. Use @BotFather to create a bot and a TOKEN. Make sure to disable privacy mode.

telegram:
  token: "YOUR BOTTOKEN"
  timeout: 60

limits:
  - # Allow one request per 5 minutes
    bucket: 5m
    limit: 1
  - # Allow 5 requests per hour
    bucket: 1h
    limit: 5

trigger:
  - # A normal Case sensitive Match
    match: "WTF?"
    text: "What the Fish?"
  - # Case insensitive Match
    match: "(?i)guten morgen"
    text: "Nimm Dir nen Kaffee! ☕️"
  - # This will match "Die 5 Freunde" but not "Die fünf Freunde"
    match: "[Dd]ie \\d+ Freunde"
    text: "... und Timmy der Hund"

NOTE: The Configuration file uses YAML as format. Indentation matters! Also make sure not to mix Tabs and Spaces when doing indentation.

About

Telegram Triggerbot written in go


Languages

Language:Go 100.0%