Discord-GPT is a simple bot for Discord that utilizes the OpenAI Function tools. It allows users to interact with the bot using natural language and receive responses generated by the GPT model. The bot can be customized and extended to perform various tasks, such as answering questions, providing recommendations, or generating text based on user input.
To install Discord-GPT, follow these steps:
-
Clone the repository:
git clone https://github.com/karhal/discord-gpt-js.git
-
Navigate to the project directory:
cd discord-gpt-js
-
Install the required dependencies:
npm install
To use Discord-GPT, you need to set up a Discord bot and obtain an API key from OpenAI. Here's how:
-
Create a new Discord bot on the Discord Developer Portal.
-
Copy the bot token.
-
Create a new OpenAI account and obtain an API key.
-
Configure the bot by creating a
.env
file in the project directory and adding the following variables:DISCORD_TOKEN=your-discord-bot-token OPENAI_API_KEY=your-openai-api-key
-
Start the bot:
npm start
In addition to using the .env file for configuration, you can also use the config.json.dist file as a configuration file example. To do this, you can make a copy of the config.json.dist file and rename it as config.json. Then, you can set all the necessary variables in the config.json file.
The config.json.dist file serves as a template or a starting point for your configuration. It typically contains default values or placeholders for the variables that need to be configured. By copying and renaming it as config.json, you create a new file that you can modify with your specific configuration values.
Once you have created the config.json file, you can open it and set the values for the variables according to your needs. For example, you can set the DISCORD_TOKEN and OPENAI_API_KEY variables with your Discord bot token and OpenAI API key respectively.
Using a separate configuration file like config.json can be useful for managing different configurations for different environments (e.g., development, staging, production) or for sharing the configuration with other team members.
Once the bot is running, you can interact with it on your Discord server by mentioning it or sending messages to the configured channel.
Some of the main features of Discord-GPT include:
- Natural language processing using OpenAI Function tools
- Customizable responses based on user input
- Support for multiple Discord servers and channels
- Easy integration with existing Discord bots or applications
Contributions to Discord-GPT are welcome! If you would like to contribute, please follow these guidelines:
- Fork the repository and create a new branch for your feature or bug fix.
- Make your changes and test them thoroughly.
- Submit a pull request describing your changes and their purpose.
Please ensure that your code follows the project's coding conventions and includes appropriate documentation.
This project is licensed under the MIT License.