Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kabirjaipal/discord-chat-gpt
Advance discord ChatGPT Chat Bot System with Support Slash/Message support
https://github.com/kabirjaipal/discord-chat-gpt
ai chatbot chatgpt-api chatgpt3 discord discord-bot discord-chat-bot discord-js nodejs nodejs-api openai openai-api
Last synced: 3 months ago
JSON representation
Advance discord ChatGPT Chat Bot System with Support Slash/Message support
- Host: GitHub
- URL: https://github.com/kabirjaipal/discord-chat-gpt
- Owner: kabirjaipal
- License: mit
- Created: 2023-01-21T13:59:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-18T15:56:14.000Z (almost 2 years ago)
- Last Synced: 2024-10-02T20:34:47.414Z (4 months ago)
- Topics: ai, chatbot, chatgpt-api, chatgpt3, discord, discord-bot, discord-chat-bot, discord-js, nodejs, nodejs-api, openai, openai-api
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 19
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discord Chat GPT
Advance discord ChatGPT Chat Bot System with Support Slash/Message support
# Download
```cli
npm i discord-chat-gpt
------ or ---------------------
yarn add discord-chat-gpt
```# Example
**_
[![Example](https://media.discordapp.net/attachments/1007230019371802654/1066354977704001596/Screenshot_2023-01-21_192330.png)](https://discord.gg/PcUVWApWN3)
_**# Setting up
### Client values
```js
import { Client, GatewayIntentBits } from "discord.js";
import { ChatGPT } from "discord-chat-gpt";const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
allowedMentions: {
repliedUser: false,
},
});const chatGpt = new ChatGPT({
apiKey: `OPEN_AI_KEY`, // get from https://beta.openai.com/account/api-keys
orgKey: `Organization_ID`, // get from https://beta.openai.com/account/org-settings
});client.on("ready", () => {
console.log(`> ${client.user.username} is Online !!`);
});
```### Discord Chat Bot Example
```js
client.on("messageCreate", async (message) => {
if (!message.guild || message.author.bot) return;
let ChatBotChannelId = "ChannelID";
let channel = message.guild.channels.cache.get(ChatBotChannelId);
if (!channel) return;
if (message.channel.id === channel.id) {
let msg = await message.reply({
content: `Waiting ....`,
});
let chatreply = await chatGpt
.chat(message.content, message.author.username)
.catch((e) => {
console.log(e);
});
msg.edit({
content: `${chatreply}`,
});
}
});
```### Bugs, glitches and issues
If you encounter any problems feel free to open an issue in our GitHub repository or join the [Discord server](https://discord.gg/PcUVWApWN3).