-
Notifications
You must be signed in to change notification settings - Fork 59
Configuration
To configure options, you have the following ways:
- Directly set envrionment variables
- Use
.env.example
as a template, modify the values and rename it to.env
Optional
The default option (production
) uses Webhook mode, you can set to development
to use polling mode.
Required
API token of your bot, can be obtained from @BotFather.
Required if using webhook mode
Webhook URL to be set for Telegram server, must end with /
. e.g.: https://xxx.herokuapp.com/
Required if using webhook mode
Webhook port, automatically set if on Heroku.
Optional
Storage directory, can be local or remote, will be created if not exists.
Default: Pictures
Notice: You need to add your bot to channel administrators
Required
Telegram channel ID used for storing messages, messages sent to bot and containing URL entities will be forwarded here for reviewing.
Required
Telegram user ID(not username) of the admin, some bot functions are restricted to admin user.
eg:
export ADMIN_ID=111111
Optional
Whether to make this bot public, can be true
or false
.
Default: false
Added in v2
Optional
Telegram user ID of the allowed users other than admin, separated by a comma, ignored if IS_PUBLIC=true
.
e.g.:
export ALLOW_ID=12345
export ALLOW_USERNAME=12345,23456,34567
Changed in v2
Tips:
You can get your User ID & Channel ID via @GetIDs Bot
Optional
Telegram username of the allowed users other than admin, without @
prefix, separated by a comma, ignored if IS_PUBLIC=true
.
e.g.:
export ALLOW_USERNAME=user1
export ALLOW_USERNAME=user1,user2,user3
Changed in v2
Optional
Telegram group ID, separated by a comma. Users in this group will be able to use the bot in group chat.
e.g.:
export ALLOW_GROUP=-12345,-23456
Changed in v2
About access control:
- Allow all if
IS_PUBLIC=true
- User in
ALLOW_ID
orALLOW_USERNAME
orADMIN_ID
can access the bot via private chat- User in
ALLOW_GROUP
can access via specified group chatFor more information, see
nazurin/middleware.py
.
Optional
Caption items to ignore when generating image captions, separated by a comma.
e.g.:
export CAPTION_IGNORE=bookmarked
Default is none.
Added in v2
Retry attempts after a failed requests.
e.g.:
export RETRIES=5
Default is 5.
Added in v2
**Notice: Don't use local database on Heroku, or the data cannot be persisted"
Optional
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.
**Notice: Don't use local storage on Heroku, or the data cannot be persisted"
Optional
A string list of storage names, separated by commas.
e.g.:
export STORAGE=Local,Telegram,Mega
Default: Local
Supported storage:
Name | Usage | Config | Note |
---|---|---|---|
Local | Append Local to STORAGE
|
Local |
Default |
Telegram | https://github.com/y-young/nazurin/wiki/Telegram | Telegram |
Added in v2 |
MEGA | https://github.com/y-young/nazurin/wiki/MEGA | Mega |
|
Google Drive | https://github.com/y-young/nazurin/wiki/Google-Drive | GoogleDrive |
|
OneDrive | https://github.com/y-young/nazurin/wiki/OneDrive | OneDrive |
Implement other storage by creating a file under storage
with a store
function.
Changed in v2