#HTTPError [AbortError]: The user aborted a request.

5 messages · Page 1 of 1 (latest)

slate meteor
#

throw new HTTPError(error.message, error.constructor.name, error.status, request);
^

HTTPError [AbortError]: The user aborted a request.
at RequestHandler.execute (/Users/shayuxuan/Desktop/dad-joke-discord-bot-main/node_modules/discord.js/src/rest/RequestHandler.js:201:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (/Users/shayuxuan/Desktop/dad-joke-discord-bot-main/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async WebSocketManager.connect (/Users/shayuxuan/Desktop/dad-joke-discord-bot-main/node_modules/discord.js/src/client/websocket/WebSocketManager.js:134:9)
at async Client.login (/Users/shayuxuan/Desktop/dad-joke-discord-bot-main/node_modules/discord.js/src/client/Client.js:254:7) {
code: 500,
method: 'get',
path: '/gateway/bot',
requestData: { json: undefined, files: [] }
}

Node.js v18.12.0

digital quail
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

slate meteor
#

discord.js - ^13.12.0
node - v18.12.0

#

this is my code

#

require('dotenv').config();
const OpenAI = require('openai-api');
const openai = new OpenAI(process.env.OPENAI_API_KEY);
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

let prompt ='Marv is a chatbot that reluctantly answers questions.\n
You: How many pounds are in a kilogram?\n
Marv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\n
You: What does HTML stand for?\n
Marv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\n
You: When did the first airplane fly?\n
Marv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\n
You: What is the meaning of life?\n
Marv: I’m not sure. I’ll ask my friend Google.\n
You: hey whats up?\n
Marv: Nothing much. You?\n';

client.on("message", function (message) {
if (message.author.bot) return;
prompt += You: ${message.content}\n;
(async () => {
const gptResponse = await openai.complete({
engine: 'davinci',
prompt: prompt,
maxTokens: 60,
temperature: 0.3,
topP: 0.3,
presencePenalty: 0,
frequencyPenalty: 0.5,
bestOf: 1,
n: 1,
stream: false,
stop: ['\n', '\n\n']
});
message.reply(${gptResponse.data.choices[0].text.substring(5)});
prompt += ${gptResponse.data.choices[0].text}\n;
})();
});

client.login(process.env.BOT_TOKEN);