This is a Telegram bot that interacts with the Grok API to provide chat functionalities. The bot can handle text messages, photos, and media groups, and it maintains a chat context for each user.
- Handles text messages and photos
- Maintains chat context for each user
- Allows users to view the current chat context
- Allows users to change their role
- Logs chat messages to files
-
Clone the repository:
git clone https://github.com/yourusername/TelegramBotForGrok.git cd TelegramBotForGrok -
Install dependencies:
npm install
-
Create a
.envfile in the root directory and add your Telegram bot token and Grok API endpoint:TELEGRAM_BOT_TOKEN=your_telegram_bot_token GROK_API_KEY () GROK_API_ENDPOINT=https://api.x.ai/v1/chat/completions
-
Run the bot:
node grok.js
- Start the bot by sending the
/startcommand. - Use the buttons to view the current chat context or change your role.
- Send text messages or photos to interact with the bot.
This project is licensed under the MIT License.