This GitHub repository contains a simple implementation of a Telegram bot that generates images using OpenAI's GPT-4 image generation model. The bot listens to incoming messages, uses the message text as a prompt, and returns a generated image URL.
Before you get started, make sure you have:
- A Telegram bot token. Learn how to create a bot and get a token by following the official guide.
- An OpenAI API token. You can get your token by signing up for an API key at the OpenAI website.
To use the bot, clone the repository:
git clone https://github.com/username/telegram-bot-openai-image-generation.git
Change to the project directory:
cd telegram-bot-openai-image-generation
Ensure you have the required dependencies installed on your machine:
- Java Development Kit (JDK) 8 or higher
- Gradle
Update the following placeholders in the TelegramBot1CDaleeBot
and OpenAiApiDalee
classes with your actual bot and API tokens:
<YOUR TELEGRAM BOT USERNAME>
<YOUR TELEGRAM BOT TOKEN>
<YOUR OpenAI TOKEN>
To run the bot, open a terminal in the project directory and execute:
gradle clean build
After the build process is completed, run the application:
java -cp build/libs/app.jar telegram-bot-openai-image-generation.App
The bot should now be up and running. To test it, send a message to your bot in Telegram with a text prompt, and the bot will generate an image URL based on the prompt.
This project is released under the MIT License. See LICENSE for more details.