This is a Telegram bot that integrates with the Claude AI and generates Pepe the Frog memes.
- Interacts with users through Telegram messages
- Utilizes the Claude AI for generating responses
- Generates Pepe the Frog humor and mannerism
- Stores conversation history using Upstash Redis
- Uploads generated response to AWS S3
Before running the bot, make sure you have the following:
- Node.js installed (version 18.X.X or higher)
- Telegram Bot Token (obtained from BotFather)
- OpenAI API Key
- Upstash Redis URL and Token
- AWS S3 Bucket, Region, Access Key ID, and Secret Access Key
- Anthropic API Key
-
Clone the repository:
git clone https://github.com/your-username/telegram-ai-bot.git
-
Navigate to the project directory:
cd telegram-ai-bot
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and provide the necessary environment variables:TELEGRAM_BOT_TOKEN="" OPENAI_API_KEY="" UPSTASH_URL="" UPSTASH_TOKEN="" BUCKET="" REGION="" AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" ANTHROPIC_API_KEY=""
Make sure to replace the empty strings with your actual values.
-
Start the bot in development mode:
npm run dev
This command uses nodemon to automatically restart the bot whenever changes are made to the source code.
-
To build the TypeScript code and generate the JavaScript output:
npm run build
The compiled JavaScript files will be placed in the
dist
directory. -
To start the bot in production mode:
npm start
This command runs the compiled JavaScript code from the
dist
directory. -
Interact with the bot on Telegram by sending messages to it. The bot will respond using the Claude AI and generate Pepe the Frog memes based on the user's input.
The bot relies on the following dependencies:
@anthropic-ai/sdk
: SDK for interacting with the Anthropic AI (Claude)@aws-sdk/client-s3
: AWS SDK for uploading files to S3@upstash/redis
: Redis client for storing data using Upstashdotenv
: Loads environment variables from a.env
filenode-telegram-bot-api
: Telegram Bot API library for Node.jsopenai
: OpenAI API library for generating responsestiny-invariant
: Tiny invariant assertion librarywhatsapp-web.js
: WhatsApp Web API library (not used in this bot)zod
: TypeScript-first schema validation library
The following dev dependencies are used for development purposes:
@types/node
: TypeScript type definitions for Node.js@types/node-telegram-bot-api
: TypeScript type definitions fornode-telegram-bot-api
@types/qrcode-terminal
: TypeScript type definitions forqrcode-terminal
nodemon
: Automatically restarts the bot during developmentqrcode-terminal
: Generates QR codes in the terminal (not used in this bot)ts-node
: TypeScript execution and REPL for Node.jstypescript
: TypeScript language
This project is licensed under the ISC License.
Shola Ayeni ayenisholah@gmail.com https://github.com/ayenisholah