Socket
Socket
Sign inDemoInstall

discord-chat-gpt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-chat-gpt

Chat-GPT Chat Bot For Discord


Version published
Weekly downloads
22
increased by175%
Maintainers
1
Weekly downloads
 
Created
Source

Real-Giveaway

Advance discord ChatGPT Chat Bot System with Support Slash/Message support

Download

npm i discord-chat-gpt
------ or ---------------------
yarn add discord-chat-gpt

Example

Example

Setting up

Client values

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

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.

Keywords

FAQs

Package last updated on 21 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc