auto-answering
v0.0.4
Published
A configurable Node.js Telegram bot for Premium users that automatically replies to messages based on customizable triggers and replies, simulates typing behavior, supports multi-language responses, and logs messages for auditing.
Maintainers
Readme
Telegram Dynamic Responder
A robust Telegram bot that dynamically responds to messages using predefined triggers and replies. It logs messages and errors for auditing and debugging purposes and simulates real-user typing behavior before replying.
Features
- Handles incoming Telegram webhooks for message events.
- Simulates typing behavior before sending responses.
- Logs all received messages into
messages.log. - Logs all errors into
errors.log. - Dynamic responses based on triggers defined in
config.json. - Easily configurable via
.envandconfig.json.
Prerequisites
- Node.js
- Telegram Bot Token
Installation
npm installConfiguration
- Create a
.envfile in the root directory with the following variables:
BOT_TOKEN=<your_telegram_bot_token>
OWNER_ID=<your_telegram_user_id>
WEBHOOK_URL=https://your.domain.com
PORT=3000
SAVE_LOCAL=true- Customize
config.jsonto set your triggers and replies.
Example config.json with localization support:
{
"typingDelay": 1500,
"languages": ["en", "ru"],
"defaultLang": "en",
"responses": {
"en": [
{
"triggers": ["hi", "hello", "hey"],
"replies": ["Hello! 👋", "Hi there! How can I help you?"]
}
],
"ru": [
{
"triggers": ["привет", "здравствуй"],
"replies": ["Привет! 👋", "Здравствуйте! Чем могу помочь?"]
}
]
}
}Usage
Start the bot with:
npm startThe bot will automatically set the Telegram webhook on startup.
Logs
- Incoming messages are saved to
messages.log(if enabled in.env) - Errors are logged into
errors.log
Deployment
Ensure your server is accessible via the public URL defined in WEBHOOK_URL.
Use services like Render, Railway, or Cloudflare Pages with Workers for hosting.
