Config vars

Detailed description of config variables

Config file

All the config variables are stored in a single file named .env at the root of Mega.nz-Bot directory.

For reference please look at the below example,

.env.sample
APP_ID=app-id-from-my.telegram.org
API_HASH=api-hash-from-my.telegram.org
BOT_TOKEN=bot-token-from-@BotFather

MEGA_EMAIL=yourname@gmail.com
MEGA_PASSWORD=mypassword

AUTH_USERS=*
USE_ENV=False
LOG_CHAT=-1001234567890
MONGO_URI=mongodb+srv://username:password@host/dbname?retryWrites=true&w=majority
CYPHER_KEY=vJmDXO4xria6SYVcOfVYd3k3YM8WiiGBfRjbQ8MBsvI=

DOWNLOAD_LOCATION=${PWD}/NexaBots
CHUNK_SIZE=524288
TG_MAX_SIZE=2040108421

Mandatory

As the name suggests these variables must be present in either as an environment variable or in .env file in order for the bot to function properly.

Optional

Bot can function without these variables. However you won't be able to use all of it's features such as upload, private content downloader.

  • MEGA_EMAIL - Your Mega account email address. Use this to associate the bot with a specific Mega account for private deployments.

  • MEGA_PASSWORD - The password for your Mega account specified in MEGA_EMAIL.

  • USE_ENV - Set this to 'true' if you're running a private bot with a single Mega account using MEGA_EMAIL and MEGA_PASSWORD. Defaults to False

  • LOG_CHAT - A chat ID where you want to receive user activity logs. Ensure the bot has admin privileges in this chat.

  • MONGO_URI - A mongodb url

    • It is recommended to setup this as you can manage multiple accounts when using a database

  • AUTH_USERS - A list of authorized user IDs, separated by a space

    • *: All the users can use the bot without restrictions

    • *|<user_id> <user_id>...: Bot is available for public use and user ids act as admins

    • <user_id> <user_id>...: Bot is only available for these users

  • CYPHER_KEY - A private key used to encrypt data before sending it to the database. Highly recommended to generate a new key

  • CHUNK_SIZE - Number of bytes bot should read into memory when downloading from DDL

    • Increasing chunk size speeds up the download process while also increasing memory usage.

    • Keep it between 1024 - 1048576 (1 KiB - 1 MiB) for optimal performance

    • Defaults to 524288 (500 KiB)

  • TG_MAX_SIZE - Maximum file size that can be uploaded in a single piece. If a file exceeds this value, it will be automatically split into smaller chunks of the specified size.

    • You can lower this value if you need to create smaller file chunks for specific purposes. For example, setting it to 500 MiB (megabytes) would split any file larger than 500 MiB into 500 MiB chunks.

    • Defaults to telegram limit of 2040108421 bytes (2 GiB)

  • DOWNLOAD_LOCATION - Path to the folder where files need to be downloaded. Defaults to the "{current working directory}/NexaBots"

Last updated