A Telegram bot to analyze and provide insights on crypto tokens, including price, market cap, safety score, and AI-generated insights. Built with Node.js, TypeScript, Fastify, Prisma, and Langchain.
-
Clone the repository
git clone https://github.com/Rann-Studio/TokenGuardAI.git cd TokenGuardAI -
Install dependencies
npm install
-
Configure environment variables
Copy.env.exampleto.envand fill in your credentials. -
Generate Prisma client
npx prisma generate
-
Run database migrations
npx prisma migrate deploy
-
Build the project
npm run build
-
Start the bot and backend
npm start
Or for development:
npm run dev
This project uses the following APIs for various functionalities:
-
CoinGecko API - For fetching crypto token data.
-
OpenAI API - For generating AI responses.
-
Telegram Bot API (via grammY) - For interacting with Telegram.
/start- Start the bot and get a welcome message./help- Get a list of available commands./ping- Check if the bot is online.
You can ask the bot for information about any crypto token by simply sending its name or symbol or its contract address. The bot will respond with detailed information about the token.
For example, you can send:
- "Analyze this token 0x2170ed0880ac9a755fd29b2688956bd959f933f8"
- "What is the price of Bitcoin?"
- "Give me the market cap of Ethereum."
- "Tell me about Dogecoin."
The bot uses Langchain with OpenAI models to generate AI responses. Prompt templates are defined in the /src/backend/services/langchain.ts
- Intent Prompt
This prompt is used to determine the user's intent based on the input text. It helps in understanding what kind of information the user is looking for.
{
"intent": "analyze | price | marketcap | ask | unknown",
"symbol": "string | null",
"name": "string | null",
"address": "string | null",
"query": "string | null"
}- Analysis Prompt
This prompt is used to analyze the token based on the user's intent. It provides detailed information about the token, including its price, market cap, and other relevant data.
{
"risk" : {
"score": "number",
"explanation": "string"
},
"insight": "array of strings",
}- Chat Prompt
This prompt is used to generate a AI response based on the user's query. It provides a conversational response to the user's question.
{
"text": "string"
}You can find the bot on Telegram at @TokenGuardAI_BOT.
Please check out the TokenGuardAI Showcase for a demonstration of the bot's features and capabilities.
This project is licensed under AGPL-3.0 License. See the LICENSE file for details.