okunamayanad
okunamayanad
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by okunamayanad on 12/5/2024 in #djs-questions
client.login stopped working out of nowhere, can't start the bot
Nothing changed in code, the container was just sitting there. Out of nowhere, the bot stopped responding to events so I hopped on to check what's going on Stopped and tried to restart the bot and it gave this error code:
node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^

Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}

Node.js v20.17.0
node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^

Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}

Node.js v20.17.0
nothing changed in the code. so I tried debugging it, it crashes at client.login() and before calling client.on('ready',()=>{}) tried pnpm up and updated to the last discord.js version (14.16.3), same error.
7 replies
DIAdiscord.js - Imagine an app
Created by okunamayanad on 8/21/2024 in #djs-questions
Message.startThread fails with: DiscordAPIError[10008]: Unknown Message
I'm sending a message to the channel using channel.send, awaiting it and saving it to a variable called sentMessage. Then executing .startThread() but it fails with:
ode:events:497
throw er; // Unhandled 'error' event
^

DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildTextThreadManager.create (/home/baran-mordo-an/vote/node_modules/.pnpm/discord.js@14.15.3/node_modules/discord.js/src/managers/GuildTextThreadManager.js:76:18)
at async Object.execute (/home/baran-mordo-an/vote/events/messageCreate.js:78:20)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
name: 'food-talk',
auto_archive_duration: 60,
type: 11,
invitable: undefined,
rate_limit_per_user: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1275894957969772725/messages/1275897984210567199/threads'
ode:events:497
throw er; // Unhandled 'error' event
^

DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildTextThreadManager.create (/home/baran-mordo-an/vote/node_modules/.pnpm/discord.js@14.15.3/node_modules/discord.js/src/managers/GuildTextThreadManager.js:76:18)
at async Object.execute (/home/baran-mordo-an/vote/events/messageCreate.js:78:20)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
name: 'food-talk',
auto_archive_duration: 60,
type: 11,
invitable: undefined,
rate_limit_per_user: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1275894957969772725/messages/1275897984210567199/threads'
Here's the code:
const sentMessage = await message.channel.send(toSend);

// create thread
const thread = await message.startThread({
name: "food-talk",
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: "Needed a separate thread for food",
});
const sentMessage = await message.channel.send(toSend);

// create thread
const thread = await message.startThread({
name: "food-talk",
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: "Needed a separate thread for food",
});
8 replies
DIAdiscord.js - Imagine an app
Created by okunamayanad on 8/19/2024 in #djs-questions
Message create event is being triggered on thread creation
How can I check if the event was because a thread was created?
4 replies
DIAdiscord.js - Imagine an app
Created by okunamayanad on 8/18/2024 in #djs-questions
Get message by ID and then update it
I tried this but .update does not exist
await interaction.channel.messages.fetch(messageId).update(toSend);
await interaction.channel.messages.fetch(messageId).update(toSend);
30 replies