██████╗ ██████╗ █████╗ ███╗ ███╗███╗ ███╗██████╗██╗██╗ ██╗██████╗ ██████╗ ████████╗
██╔════╝ ██╔══██╗██╔══██╗████╗ ████║████╗ ████║██╔════╝██║██║ ██║██╔══██╗██╔═══██╗╚══██╔══╝
██║ ███╗██████╔╝███████║██╔████╔██║██╔████╔██║██║ ██║███████║██████╔╝██║ ██║ ██║
██║ ██║██╔══██╗██╔══██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║██╔══██║██╔══██╗██║ ██║ ██║
╚██████╔╝██║ ██║██║ ██║██║ ╚═╝ ██║██║ ╚═╝ ██║╚██████╗██║██║ ██║██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝
GrammChatBot is an elite Node.js bot framework providing a 1-to-1 API Adapter Port of Goatbot-V2 from Facebook Messenger (FCA) to Telegram (TCA), supercharged with AstrBot-inspired Agentic AI Capabilities.
By utilizing the built-in FCA to TCA Adapter Layer (system/api-adapter.js) and Agentic AI Core (system/ai-core.js), existing Goatbot V2 Facebook commands using api.sendMessage(), event.threadID, and event.senderID run natively on Telegram alongside autonomous multi-LLM Agentic AI workflows!
- Character Persona Presets: Customizable system prompts & emotional companion personas.
- Local & Cloud RP Engines: Supports SillyTavern character cards, Ollama local roleplay, and OpenAI/Gemini personas.
- Proactive Notifications: Event-triggered scheduled reminders, background cron tasks, and group alerts.
- Contextual Engagement: Monitors thread activity to provide timely suggestions and automated assistance.
- Multi-Provider LLM Routing: 11+ supported model services (OpenAI, Gemini, Claude, DeepSeek, Groq, Ollama, Moonshot Kimi, GLM, Qwen, OneAPI).
- Autonomous Tool Execution: LLM function calling for Web Search, Code Interpreter Sandbox, and Task Scheduler.
- Multimodal (Vision & Audio): Image recognition & Speech-to-Text (Whisper).
- RAG Knowledge Base: Retrieval-Augmented Generation for indexing documents and PDF context.
- AstrBot Plugins Collection Marketplace: Direct integration with
AstrBotDevs/AstrBot_Plugins_Collection. - Modular Star Plugins System: Dynamic plugin loading, tool registration (
register_tool), and Web UI marketplace management.
/image <prompt>(/dalle): Generates high-definition AI digital art from text prompts./edit <style>(/filter): Applies AI transformations to replied photos./upscale(/4k,/hd): Enhances image quality to 4K resolution./removebg(/nobg): Removes backgrounds and exports transparent PNGs.
The integrated Express web server serves a live management dashboard on process.env.PORT (http://localhost:5000):
- System Stats Panel: Polling status, active token index, total tokens, uptime, and RAM usage.
- AI Control Panel: Interactive UI to switch LLM Provider, update System Prompt Persona, and toggle Tool Execution.
- Plugins Marketplace: Browse, install, and uninstall plugins from the AstrBot Plugins Collection.
GrammChatBot/
├── images/
│ ├── banner.jpg # Cute Anime Girl Mascot Header
│ ├── agentic_features.jpg # Core 4 Pillars Agentic Features Showcase
│ ├── ai_demo.jpg # AI Image Tools Showcase Banner
│ └── dashboard_preview.jpg # Express Web Analytics Dashboard Mockup
├── index.js # Main process entry launcher & dashboard
├── Goat.js # Core bot framework orchestrator
├── bot.js # Telegram event listener & router
├── config.json # Bot tokens, developer ID & permission lists
├── package.json # Project dependencies
├── system/
│ ├── api-adapter.js # Core FCA-to-TCA API Wrapper Adapter
│ ├── ai-core.js # AstrBot-inspired Agentic AI Engine (Multi-LLM, RAG, Tools)
│ ├── astrbot-api.js # AstrBot API Specs (@filter, MessageChain, Star Tool Registry)
│ └── astrbot-plugins.js # AstrBot Plugins Collection Marketplace & Manager
├── includes/
│ ├── handleReply.js # System listener for onReply
│ ├── handleReaction.js # System listener for onReaction
│ └── handleEvent.js # System listener for onEvent
├── bot/
│ ├── telegram/
│ │ ├── tokenManager.js # Multi-token manager & rate-limit failover
│ │ └── handlerTelegram.js # grammY update interceptor & role matrix
│ └── cron/
│ └── autoCleanup.js # 30-minute cache & memory cleanup cron job
├── dashboard/ # Express.js Web Dashboard
│ ├── app.js # Express web server & AstrBot APIs
│ └── views/
│ └── stats.eta # Real-time HTML stats & AI control panel template
├── utils/
│ └── levenshtein.js # Levenshtein distance typo suggestion engine
├── test/
│ └── testAll.js # Comprehensive automated test suite (100% Pass)
└── scripts/
└── cmds/ # Modular commands folder
├── ai-chat.js # AstrBot AI Agent command (/ai /ask) in Goatbot syntax
├── example.js # FCA-syntax command test (/examplecmd)
├── newcommand.eg.js # Template command file
├── eval.js # Level 4 Developer JS evaluator
├── shell.js # Level 4 Developer shell executor
├── admin.js # Level 3/4 Admin control panel
├── image.js # AI image generator (Stream)
├── edit.js # AI image editor (Stream)
├── upscale.js # AI 4K image upscaler (Stream)
├── removebg.js # AI background remover (Stream)
├── help.js # Dynamic command menu
├── stats.js # Bot memory & status
└── ping.js # Latency check
Thanks to system/api-adapter.js, you can write commands using the exact original Goatbot-V2 Facebook syntax:
const aiCore = require("../../system/ai-core.js");
module.exports = {
config: {
name: "ai",
aliases: ["ask"],
version: "2.1",
author: "frnAlt & Gtajisan",
countDown: 3,
role: 0,
description: { en: "Chat with Agentic AI Core" },
category: "ai-agent"
},
// Classic Goatbot V2 signature
onStart: async function ({ api, event, args, message, getLang }) {
const prompt = args.join(" ");
if (!prompt) return message.reply("Please ask a question!");
const response = await aiCore.generateCompletion({
prompt,
contextId: `${event.threadID}_${event.senderID}`
});
api.sendMessage(
`🤖 [${aiCore.getProvider().toUpperCase()}]\n\n${response}`,
event.threadID,
(err, info) => {
api.setMessageReaction("🧠", event.messageID, event.threadID);
},
event.messageID
);
}
};Run the comprehensive automated test suite:
node test/testAll.jsExpected Output:
==================================================
📊 TEST RESULTS: 14 Passed, 0 Failed
==================================================
git clone https://github.com/frnAlt/GrammChatBot.git
cd GrammChatBot
npm install
# Edit config.json with your Telegram tokens and user ID
npm start- Create a Web Service on Render.
- Connect your GitHub repository.
- Build Command:
npm install - Start Command:
npm start - Set Environment Variable:
PORT=5000
- Deploy project from GitHub on Railway.
- Add
PORT=5000environment variable. - Railway automatically detects
npm start.
npm install -g pm2
pm2 start index.js --name "grammchatbot" --node-args="--expose-gc --max-old-space-size=400"
pm2 save
pm2 startup- Original Architecture: Goat-Bot-V2 by NTKhang & Modded by frnAlt & Gtajisan.
- AI Engine: AstrBot-inspired Agentic AI Engine & Plugins Collection.
- Telegram Adapter Port: GrammChatBot by frnAlt & Gtajisan.
- License: MIT



