No description, website, or topics provided.
Go Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
commands
db
modules
user
utils
zbot
.gitignore
.travis.yml
Dockerfile
README.md
disable_modules.json
main.go
main_test.go
sample.db

README.md

zbot-telegram

Build Status Coverage Status Go Report Card

Requirements

Setup

You must set the ZBOT_TOKEN environment variable using the Telegram's API TOKEN

  • ZBOT_TOKEN : Use to connect to telegram
  • ZBOT_LOG_LEVEL : Use to set the log level the alternatives are debug,info, warn, error, panic
  • ZBOT_DATABASE_FILE : Path to the sqlite database "/path/to/file.sqlite"
  • ZBOT_MODULES_PATH : Path to the externals modules directory

Database Schemas

Definitions

CREATE TABLE `definitions` ( 
    id INTEGER PRIMARY KEY AUTOINCREMENT, 
    term TEXT UNIQUE, 
    meaning TEXT NOT NULL, 
    author TEXT NOT NULL, 
    locked INTEGER DEFAULT 0, 
    active INTEGER DEFAULT 1, 
    date TEXT DEFAULT '0000-00-00', 
    hits INTEGER DEFAULT 0, 
    link INTEGER ,
    locked_by TEXT
)

Users

CREATE TABLE `users` ( 
    `id` INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, 
    `username` TEXT NOT NULL, 
    `level` INTEGER DEFAULT 10 
)

You need at least one user in the database

INSERT INTO users VALUES (null, 'ssalvato', 1000)

Ignore

CREATE TABLE `ignore_list` ( 
    `id` INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, 
    `username` TEXT NOT NULL, 
    `since` INTEGER NOT NULL,
    `until` INTEGER NOT NULL
)

Migration (optional)

Ths is just for the migration of the oldest database schema

ALTER TABLE `ledger` RENAME TO `definitions`