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 - npm Package Compare versions

Comparing version 1.0.2 to 1.1.2

36

index.js

@@ -11,29 +11,29 @@ import { Configuration, OpenAIApi } from "openai";

this.apiKey = options.apiKey;
this.configuration = new Configuration({
organization: this.orgKey,
apiKey: this.apiKey,
});
this.openai = new OpenAIApi(this.configuration);
}
async chat(content, requester) {
const configuration = new Configuration({
organization: this.orgKey,
apiKey: this.apiKey,
});
const openai = new OpenAIApi(configuration);
let response = await openai
.createCompletion({
if (!content || !requester) {
throw new Error("Content and requester cannot be null or undefined");
}
try {
let response = await this.openai.createCompletion({
model: "davinci",
prompt: `ChatGPT is a friendly chatbot. \n\
ChatGPT : Hello, how are you?\n\
${requester}: ${content}\n\
ChatGPT:`,
ChatGPT : Hello, how are you?\n\
${requester}: ${content}\n\
ChatGPT:`,
temperature: 0.9,
max_tokens: 100,
stop: ["ChatGPT:", "Kabir Jaipal:"],
})
.then((res) => {
return res.data.choices.at(0).text;
})
.catch((e) => {
return e.message;
});
return response;
return response.data.choices.at(0).text;
} catch (error) {
throw new Error(`Failed to complete API call: ${error.message}`);
}
}

@@ -40,0 +40,0 @@ }

{
"name": "discord-chat-gpt",
"version": "1.0.2",
"version": "1.1.2",
"description": "Chat-GPT Chat Bot For Discord",

@@ -36,4 +36,5 @@ "main": "index.js",

"dependencies": {
"discord.js": "^14.7.1",
"openai": "^3.1.0"
}
}
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