CodeRunner is a Discord bot built with Spring Boot and JDA (Java Discord API) that enables users to interact with AI models and execute code snippets within Discord. With a simple and intuitive command system, CodeRunner can handle AI-powered conversations and execute code snippets in real-time.
- AI Conversations: Chat with an AI model powered by OpenAI via the
!chatcommand. - Code Execution: Execute code snippets in multiple languages using the
!runcommand. - Customizable: Easily extendable with new commands and listeners.
- Lightweight & Scalable: Built with Spring Boot, the bot is designed to be fast and scalable, handling multiple requests simultaneously.
Follow these instructions to set up and run the CodeRunner bot on your local machine.
Before setting up the bot, ensure you have the following installed:
- Java 11+
- Maven
- A Discord Bot Token
- OpenAI API Key (for ChatGPT integration)
-
Clone the repository:
git clone https://github.com/yourusername/CodeRunner.git cd CodeRunner -
Build the project using Maven:
mvn clean install
-
Create the
application-env.propertiesin the main dir. -
Add your configuration details:
BOT_TOKEN: Your Discord bot token.AIBOT_TOKEN: Your OpenAI API key.
Example:
BOT_TOKEN=your-discord-bot-token AIBOT_TOKEN=your-openai-api-key
To start the bot, run the following command:
mvn spring-boot:runAlternatively, you can package the application and run the JAR file:
mvn package
java -jar target/coderunner-1.0.jarThe bot responds to several commands to interact with AI models and execute code snippets.
Interact with an AI model (powered by OpenAI) and receive responses in real-time.
Example:
!chat What is the capital of France?
Execute a code snippet in real-time and receive the output.
Example:
!run
```python
print("Hello, world!")
- Python
- JavaScript
- Java
- C#
- More to be added soon!
- Spring Boot - Java framework for building production-ready applications.
- JDA (Java Discord API) - Library for interacting with the Discord API.
- OpenAI API - Integration for AI-powered conversations.
- OkHttp - HTTP & HTTP/2 client for Java.
Contributions are welcome! If you'd like to improve CodeRunner, feel free to submit a pull request or open an issue.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.