Configuration Guide for Bot `.env` File

Use the `.env` file to set the bot's required variables. Below is a detailed explanation of each variable:

Essential Variables

- DOMAIN: The bot's domain (required).
- DB_PASS: MySQL Database Password (required).
- TOKEN: The bot's token (required).
- BOT_USERNAME: The username of the bot without `@` sign (required).
- ADMIN: The unique identifier of the bot's administrator (required).
- SUPPORT_USERNAME: The username for the bot's support contact.

Channel Configuration

- AVATAR_ARCHIVE: The private channel where public avatars are saved. The bot must have admin privileges in this channel (required).
- channel_username: The username of the public channel without `@` sign where users may need to join. The bot must have admin privileges in this channel (required).
- reqChannelJoin: Specifies if users are required to join the `channel_username` before using the bot. Set to `true` or `false` as needed. If enabled, the bot must have admin privileges in the channel (required).

User Limits

- daily_view: The number of daily views allowed per user.
- nearby_view: The number of daily nearby views allowed per user.
- daily_message: The number of daily messages a user can send.
- daily_message_hour: The hour at which the daily message count resets.

Referral and Gifting Features

- giftRef: Enables VIP membership for invitees (set to `true` or `false`).
- minRef: Minimum required invites for an invitee to gain VIP membership.
- enable_gift: Enables free gifting (set to `true` or `false`).
- GIFT_LIMIT: Total number of gifts allowed within the specified hour.
- GIFT_LIMIT_HOUR: The time window (in hours) during which a user can request gifts. For example, if GIFT_LIMIT_HOUR=3 and GIFT_LIMIT=5, the user can request up to 5 gifts within a 3-hour period.
- GIFT_MINUTES: Duration of each gift in minutes.

Subscription Pricing

Set the prices for various subscription durations (in STAR):
- subscriptions_1month_price: Price for a 1-month subscription.
- subscriptions_3month_price: Price for a 3-month subscription.
- subscriptions_6month_price: Price for a 6-month subscription.
- subscriptions_12month_price: Price for a 12-month subscription.

Debugging

- DEBUG_BOT_TOKEN: An optional bot token used for debugging purposes.

Installation Guide

System Requirements:
- Operating System: Ubuntu Server 24.04
- RAM: 1 GB (2 GB Recommended)
- CPU: 1 core
- Storage: 10 GB

Steps:

1. Transfer the `nearmechat.zip` file to the server using `scp` (replace `user`, `server_ip`, and `path/to/nearmechat.zip` as needed):
scp path/to/nearmechat.zip user@server_ip:~

2. Log in to the server:
ssh user@server_ip

3. Extract the files:
apt install unzip unzip nearmechat.zip && cd nearmechat

4. Modify the `.env` file with your configuration details:

- TOKEN: Obtain the bot token from BotFather after creating a bot.
- Use MetaInfoBot to retrieve:
- Channel ID (AVATAR_ARCHIVE): Forward any message from the channel to MetaInfoBot and look for:
{ "forward_origin": { "type": "channel", "chat": { "id": -111111 } } }
Use the value in "id" (e.g., `-111111`).
- User ID (ADMIN): Send any message to MetaInfoBot and look for:
{ "from": { "id": 222222 } }
Use the value in "id" (e.g., `222222`).
- Ensure you have a valid domain name pointing to the server's IP address.

5. Make the installation script executable and run it:
chmod +x setup.sh
./setup.sh

To sync and update changes to the code (in case of modifications):
chmod +x update.sh
./update.sh

6. Set Bot commands:
Edit the menu.txt file to modify the list of bot commands. Each line should follow the format:
command - description
To update the bot's command menu, run the script after editing menu.txt:
chmod +x commands.sh
./commands.sh

7. Admin Menu:
Send the /admin command in the bot to see the available admin commands.


Get $200 free credits on DigitalOcean and run your bot for free! 🚀 Start building today!

https://m.do.co/c/19e0ec5ff2b1

DigitalOcean Referral Badge