Skip to content

Configuration

Googleplex edited this page Jan 27, 2021 · 8 revisions

ENV

The default option (production) uses Webhook mode, you can set to development to use polling mode.

TOKEN

API token of your bot, can be obtained from @BotFather.

WEBHOOK_URL

Webhook URL to be set for Telegram server.

PORT

Webhook port, automatically set if on Heroku.

DOWNLOAD_DIR

Local directory to store downloaded images, will be created if not exists.

STORAGE_DIR

Storage directory, can be local or remote, will be created if not exists.

ALBUM_ID

Telegram channel ID used for storing files.

GALLERY_ID

Telegram channel ID used for storing messages, messages sent to bot and containing URL entities will be forwarded here for reviewing.

ADMIN_ID

Telegram user ID(not username) of the admin, separated by a comma, bot functions are restricted to admin user.

If ADMIN_ID and ADMIN_USERNAME are both unset, bot will become publicly available.

eg:

export ADMIN_ID=111111 # single admin
export ADMIN_ID=111111,222222,333333 # multiple admins

Tips:

  1. You can get your User ID & Channel ID via @GetIDs Bot
  2. You need to add your bot to channel administrators

ADMIN_USERNAME

Telegram username of the admin, separated by a comma, will not work if ADMIN_ID is present.

If ADMIN_ID and ADMIN_USERNAME are both unset, bot will become publicly available.

eg:

export ADMIN_USERNAME=admin1 # single admin
export ADMIN_USERNAME=admin1,admin2,admin3 # multiple admins

GROUP_ID

Telegram group ID, separated by a comma. Users in this group will be able to use the bot in group chat.

DATABASE

Type of database.

Supported databases:

Driver Usage Config Note
TinyDB https://github.com/y-young/nazurin/wiki/TinyDB Local Default
Firestore https://github.com/y-young/nazurin/wiki/Firestore Firebase
MongoDB https://github.com/y-young/nazurin/wiki/MongoDB Mongo MongoDB Atlas supported
Cloudant https://github.com/y-young/nazurin/wiki/Cloudant Cloudant

You can also implement your own database driver by creating a file under database folder, and set this option to the name of driver class.

STORAGE

String, evaluated to list.

Type of storage, default is ['Local'] which only uses DOWNLOAD_DIR as local storage.

Append the types of storage to the list, eg: ['Mega'], ['Mega', 'GoogleDrive']

Supported storage:

Name Usage Config Note
Local Append 'Local' to STORAGE 'Local' Default
MEGA https://github.com/y-young/nazurin/wiki/MEGA Mega
Google Drive https://github.com/y-young/nazurin/wiki/Google-Drive GoogleDrive

Implement other storage by creating a file under storage with a store function.

Clone this wiki locally