repositorypackage
0.0.3
Repository: https://github.com/guionardo/go-tgbot.git
Documentation: pkg.go.dev
# README
go-tgbot
Go Telegram bot framework
Features
- Listening to messages sent into chat -> event triggering
- Background worker for scheduled services
- Message persistence with expiration time
Configuration
Json file
{
"bot": {
"token": "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678",
"name": "tgbot_test",
"hello_world": "Hello World!"
},
"repository": {
"connection_string": "tgbot.db",
"house_keeping_max_age": "24h"
},
"logging": {
"level": "warn",
"format_time_stamp": "",
"log_format": ""
}
}
YAML file
---
bot:
token: 1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678
name: tgbot_test
hello_world: "Hello World!"
repository:
connection_string: "tgbot.db"
house_keeping_max_age: 24h
logging:
level: warn
format_time_stamp: ""
log_format: ""
Environment variables
TG_BOT_TOKEN=1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678
TG_LOG_LEVEL=debug
TG_REPOSITORY_CONNECTION_STRING=tgbot.db
TG_BOT_NAME='GO Bot'
TG_BOT_HOUSEKEEPING_MAX_AGE=6h
Structures
erDiagram
MESSAGE {
int64 ChatID PK
int MessageId PK
Time MessageTime "Timestamp of message"
string Message "Serialized received message"
}
CHAT {
int64 ID PK
string Type "[private, group, supergroup, channel]"
string Title "Title for supergroups, channels and group chats"
string UserName "UserName for private chats, supergroups and channels if available"
}