Xge
Xge
DIAdiscord.js - Imagine an app
Created by Xge on 6/20/2024 in #djs-questions
Can't upload emojis: TypeError: terminated
Hi, when I try to upload emojis using a URL, it works fine locally but not in production.
await guild.emojis.create({
attachment: baseAttachmentURL, // some url to an already existing Discord emoji
name: "randomemojiname"
})
await guild.emojis.create({
attachment: baseAttachmentURL, // some url to an already existing Discord emoji
name: "randomemojiname"
})
TypeError: terminated
at Fetch.onAborted (/node_modules/undici/lib/web/fetch/index.js:2034:49)
at Fetch.emit (node:events:513:28)
at Fetch.terminate (/node_modules/undici/lib/web/fetch/index.js:93:10)
at /node_modules/undici/lib/web/fetch/index.js:506:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_ARG_TYPE]: The "stream" argument must be an instance of Stream. Received an instance of ReadableStream
at new NodeError (node:internal/errors:393:5)
at eos (node:internal/streams/end-of-stream:65:11)
at fetchFinale (/node_modules/undici/lib/web/fetch/index.js:1093:5)
at mainFetch (/node_modules/undici/lib/web/fetch/index.js:760:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
}
TypeError: terminated
at Fetch.onAborted (/node_modules/undici/lib/web/fetch/index.js:2034:49)
at Fetch.emit (node:events:513:28)
at Fetch.terminate (/node_modules/undici/lib/web/fetch/index.js:93:10)
at /node_modules/undici/lib/web/fetch/index.js:506:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_ARG_TYPE]: The "stream" argument must be an instance of Stream. Received an instance of ReadableStream
at new NodeError (node:internal/errors:393:5)
at eos (node:internal/streams/end-of-stream:65:11)
at fetchFinale (/node_modules/undici/lib/web/fetch/index.js:1093:5)
at mainFetch (/node_modules/undici/lib/web/fetch/index.js:760:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
}
What could be the issue here?
4 replies
DIAdiscord.js - Imagine an app
Created by Xge on 5/15/2024 in #djs-questions
"No description" error when sending message
Hi, as far as I know, discord.js throwing "DiscordAPIError[undefined]: No Description" indicates that an error unknown to discord.js was thrown. Is there any way to show the raw error sent by Discord?
DiscordAPIError[undefined]: No Description
at handleErrors (/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async TextChannel.send (/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:15)
DiscordAPIError[undefined]: No Description
at handleErrors (/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async TextChannel.send (/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:15)
7 replies
DIAdiscord.js - Imagine an app
Created by Xge on 4/10/2024 in #djs-questions
408 Request Timeout when sending messages
Hello! Some shards of my bots regularly experience that single messages can't be sent or are sent but it still throws the following error, letting my bot think the message was not sent:
DiscordAPIError[undefined]: No Description
{"requestBody":{"files":[],"json":{"content":"Hello!","tts":false,"embeds":[],"components":[],"attachments":[]}},"rawError":{},"status":408,"method":"POST","url":"/api/v10/channels/xxxx2460659311xxxxx/messages"}
DiscordAPIError[undefined]: No Description
{"requestBody":{"files":[],"json":{"content":"Hello!","tts":false,"embeds":[],"components":[],"attachments":[]}},"rawError":{},"status":408,"method":"POST","url":"/api/v10/channels/xxxx2460659311xxxxx/messages"}
Is this something that can be "fixed" by setting client.rest.timeout to something larger than 15_000? Or is this a Discord issue I can't fix myself? I do use nirn-proxy, maybe this is part of the issue? - Just checked, nirn-proxy's monitoring does not say anything about 408 requests..., I guess this is a proxy issue then?
6 replies
DIAdiscord.js - Imagine an app
Created by Xge on 10/30/2023 in #djs-questions
Invalid bitfield in audit log channel permissions event
Hey, I currently have the issue that errors like these are sent multiple times a minute into my bot's console:
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 3072.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 0.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 2048.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 377959222272.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 1048593.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 3072.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 0.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 2048.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 377959222272.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 1048593.
It seems like this is being sent every time I am trying to parse permissions sent from the Audit Log event ChannelOverwriteCreate/-Update/-Delete. The code causing this error:
// ...
let changes = {};
for (let change of (entry.changes || [])) {
changes[change.key] = [change.old_value, change.new_value];
}
if (changes.allow?.[1]) {
// This line causes the error:
let allow = new Discord.PermissionsBitField(changes.allow[1]).toArray();
// ...
}
// ...
// ...
let changes = {};
for (let change of (entry.changes || [])) {
changes[change.key] = [change.old_value, change.new_value];
}
if (changes.allow?.[1]) {
// This line causes the error:
let allow = new Discord.PermissionsBitField(changes.allow[1]).toArray();
// ...
}
// ...
I am not sure why this would suddenly be an issue, especially because Discord sent those bitfield numbers.
6 replies
DIAdiscord.js - Imagine an app
Created by Xge on 9/22/2023 in #djs-questions
Get ApplicationCommand API data
Hi, how would I get API compatible data from an ApplicationCommand object? .toJSON() also returns stuff like guild and applicationId.
7 replies
DIAdiscord.js - Imagine an app
Created by Xge on 9/1/2023 in #djs-questions
Webhook rate limit
Hi, my bot can't send webhook messages (promise not resolving) but using node-fetch it is sending them just fine. I thought there might be some issue with djs' rate limit handling for webhook endpoints but even after a full reboot, webhook messages are still not sending using webhook.send() which I find very weird, because manual sending using node-fetch just works without issues. Some additional information: - This happens every few days for at least an hour. - Initial interaction responses work fine - follow ups and reply edits don't. - Probably because initial responses are done using the interaction ( /api/interactions/...) endpoint. - And follow ups, etc. are done using the webhooks (/api/webhooks/...) endpoint. - Sending messages with bot owned and user owned webhooks both does not work. - After the "imaginary" rate limit ends, most recent webhook message sent attempts are executed Is this a known bug for v13 or am I missing something? As discord.js still refuses to send webhook messages after stopping and starting the application but sending the request to the raw endpoint myself works, I am really unsure what the issue is here. Any help appreciated.
18 replies
DIAdiscord.js - Imagine an app
Created by Xge on 12/16/2022 in #djs-questions
Resume gateway session after full restart
Hey, I want to update my bot's code without missing any events and reaching my session start limit. Is there any way to send a gateway resume event by providing a session_id and sequence number?
5 replies
DIAdiscord.js - Imagine an app
Created by Xge on 12/5/2022 in #djs-questions
GuildMember.fetch loading 15s-30min but fetching manually using REST works instantly
Hey, I am currently having the issue that on very busy servers (100-800k members), my Discord bot is having issues fetching members properly. Executing
member.fetch()
member.fetch()
sometimes takes ages while
fetch(`${apiURL}/guilds/${guildId}/members/${memberId}`)
fetch(`${apiURL}/guilds/${guildId}/members/${memberId}`)
resolves instantly with a rate limit bucket of 4 of 5 left. Is this an issue with discord.js' internal rate limit handling or am I missing something? Any help is appreciated!
33 replies