ɅV
ɅV
DIAdiscord.js - Imagine an app
Created by ɅV on 8/17/2024 in #djs-questions
Internal Server Error
Discord issues an Internal Server Error when my embed field is 38 characters longer Embed with error:
{
"color": 1578518,
"title": "КВЕСТЫ",
"fields": [
{
"name": "Мои активные квесты (25)",
"value": "1. ❓**Заказ Кузнеца** (`0%`)\n2. ❓**Уроки алхимии** (`0%`)\n3. ❓**Разносчики заразы** (`0%`)\n4. ❓**Свежие сплетни** (`0%`)\n5. ❓**На страже города** (`0%`)\n6. ❓**Хищные растения** (`0%`)\n7. ❓**Поход в подземелье** (`0%`)\n8. ❓**Заказ Шефа** (`0%`)\n9. ❓**Крылатая угроза** (`0%`)\n10. ❓**Заказ алхимика** (`0%`)\n11. ❓**Доставка из таверны** (`0%`)\n12. ❓**Редкие жуки** (`0%`)\n13. 🍉**Поручение лесоруба** (`0%`)\n14. ❓**Меч Короля** (`33%`)\n15. 🍉**Поручение лесоруба1** (`0%`)\n16. 🍉**Поручение лесоруба2** (`0%`)\n17. 🍉**Поручение лесоруба3** (`0%`)\n18. 🍉**Поручение лесоруба4** (`0%`)\n19. 🍉**Поручение лесоруб5а** (`0%`)\n20. 🍉**Поручение лесоруба6** (`0%`)\n21. 🍉**Поручение лесоруба7** (`0%`)\n22. 🍉**Поручение лесоруба8** (`0%`)\n23. 🍉**Поручение лесоруба9** (`0%`)\n24. 🍉**Поручение лесоруба0** (`0%`)\n25. 🍉**Поручение лесоруба01** (`0%`)",
"inline": true
},
{
"name": "Мои завершённые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Не взятые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Ежедневные квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Еженедельные квесты (0)",
"value": "Квестов нет",
"inline": true
}
]
}
{
"color": 1578518,
"title": "КВЕСТЫ",
"fields": [
{
"name": "Мои активные квесты (25)",
"value": "1. ❓**Заказ Кузнеца** (`0%`)\n2. ❓**Уроки алхимии** (`0%`)\n3. ❓**Разносчики заразы** (`0%`)\n4. ❓**Свежие сплетни** (`0%`)\n5. ❓**На страже города** (`0%`)\n6. ❓**Хищные растения** (`0%`)\n7. ❓**Поход в подземелье** (`0%`)\n8. ❓**Заказ Шефа** (`0%`)\n9. ❓**Крылатая угроза** (`0%`)\n10. ❓**Заказ алхимика** (`0%`)\n11. ❓**Доставка из таверны** (`0%`)\n12. ❓**Редкие жуки** (`0%`)\n13. 🍉**Поручение лесоруба** (`0%`)\n14. ❓**Меч Короля** (`33%`)\n15. 🍉**Поручение лесоруба1** (`0%`)\n16. 🍉**Поручение лесоруба2** (`0%`)\n17. 🍉**Поручение лесоруба3** (`0%`)\n18. 🍉**Поручение лесоруба4** (`0%`)\n19. 🍉**Поручение лесоруб5а** (`0%`)\n20. 🍉**Поручение лесоруба6** (`0%`)\n21. 🍉**Поручение лесоруба7** (`0%`)\n22. 🍉**Поручение лесоруба8** (`0%`)\n23. 🍉**Поручение лесоруба9** (`0%`)\n24. 🍉**Поручение лесоруба0** (`0%`)\n25. 🍉**Поручение лесоруба01** (`0%`)",
"inline": true
},
{
"name": "Мои завершённые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Не взятые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Ежедневные квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Еженедельные квесты (0)",
"value": "Квестов нет",
"inline": true
}
]
}
Embed without error:
{
"color": 1578518,
"title": "КВЕСТЫ",
"fields": [
{
"name": "Мои активные квесты (24)",
"value": "1. ❓**Заказ Кузнеца** (`0%`)\n2. ❓**Уроки алхимии** (`0%`)\n3. ❓**Разносчики заразы** (`0%`)\n4. ❓**Свежие сплетни** (`0%`)\n5. ❓**На страже города** (`0%`)\n6. ❓**Хищные растения** (`0%`)\n7. ❓**Поход в подземелье** (`0%`)\n8. ❓**Заказ Шефа** (`0%`)\n9. ❓**Крылатая угроза** (`0%`)\n10. ❓**Заказ алхимика** (`0%`)\n11. ❓**Доставка из таверны** (`0%`)\n12. ❓**Редкие жуки** (`0%`)\n13. 🍉**Поручение лесоруба** (`0%`)\n14. ❓**Меч Короля** (`33%`)\n15. 🍉**Поручение лесоруба1** (`0%`)\n16. 🍉**Поручение лесоруба2** (`0%`)\n17. 🍉**Поручение лесоруба3** (`0%`)\n18. 🍉**Поручение лесоруба4** (`0%`)\n19. 🍉**Поручение лесоруб5а** (`0%`)\n20. 🍉**Поручение лесоруба6** (`0%`)\n21. 🍉**Поручение лесоруба7** (`0%`)\n22. 🍉**Поручение лесоруба8** (`0%`)\n23. 🍉**Поручение лесоруба9** (`0%`)\n24. 🍉**Поручение лесоруба01** (`0%`)",
"inline": true
},
{
"name": "Мои завершённые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Не взятые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Ежедневные квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Еженедельные квесты (0)",
"value": "Квестов нет",
"inline": true
}
]
}
{
"color": 1578518,
"title": "КВЕСТЫ",
"fields": [
{
"name": "Мои активные квесты (24)",
"value": "1. ❓**Заказ Кузнеца** (`0%`)\n2. ❓**Уроки алхимии** (`0%`)\n3. ❓**Разносчики заразы** (`0%`)\n4. ❓**Свежие сплетни** (`0%`)\n5. ❓**На страже города** (`0%`)\n6. ❓**Хищные растения** (`0%`)\n7. ❓**Поход в подземелье** (`0%`)\n8. ❓**Заказ Шефа** (`0%`)\n9. ❓**Крылатая угроза** (`0%`)\n10. ❓**Заказ алхимика** (`0%`)\n11. ❓**Доставка из таверны** (`0%`)\n12. ❓**Редкие жуки** (`0%`)\n13. 🍉**Поручение лесоруба** (`0%`)\n14. ❓**Меч Короля** (`33%`)\n15. 🍉**Поручение лесоруба1** (`0%`)\n16. 🍉**Поручение лесоруба2** (`0%`)\n17. 🍉**Поручение лесоруба3** (`0%`)\n18. 🍉**Поручение лесоруба4** (`0%`)\n19. 🍉**Поручение лесоруб5а** (`0%`)\n20. 🍉**Поручение лесоруба6** (`0%`)\n21. 🍉**Поручение лесоруба7** (`0%`)\n22. 🍉**Поручение лесоруба8** (`0%`)\n23. 🍉**Поручение лесоруба9** (`0%`)\n24. 🍉**Поручение лесоруба01** (`0%`)",
"inline": true
},
{
"name": "Мои завершённые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Не взятые квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Ежедневные квесты (0)",
"value": "Квестов нет",
"inline": true
},
{
"name": "Еженедельные квесты (0)",
"value": "Квестов нет",
"inline": true
}
]
}
3 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 7/6/2024 in #djs-questions
options.uri is a required argument
for (const member of members) {
await member[1].roles.add(role)
}
for (const member of members) {
await member[1].roles.add(role)
}
after 10 added roles this error is appeared
Unhandled promise rejection: Error: options.uri is a required argument
at Request.init (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\request.js:231:31)
at new Request (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\request.js:127:8)
at request (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\index.js:53:10)
at _REST.<anonymous> (c:\Users\AnthonyVault\Documents\GitHub\wetbot\index.js:88:5)
at _REST.emit (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:285:31)
at SequentialHandler.runRequest (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@discordjs\rest\dist\index.js:1017:20)
at SequentialHandler.queueRequest (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@discordjs\rest\dist\index.js:963:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {stack: 'Error: options.uri is a required argument
…ions (node:internal/process/task_queues:95:5)', message: 'options.uri is a required argument', Symbol(kEnhanceStackBeforeInspector): ƒ}
Unhandled promise rejection: Error: options.uri is a required argument
at Request.init (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\request.js:231:31)
at new Request (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\request.js:127:8)
at request (c:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\request\index.js:53:10)
at _REST.<anonymous> (c:\Users\AnthonyVault\Documents\GitHub\wetbot\index.js:88:5)
at _REST.emit (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:285:31)
at SequentialHandler.runRequest (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@discordjs\rest\dist\index.js:1017:20)
at SequentialHandler.queueRequest (C:\Users\AnthonyVault\Documents\GitHub\wetbot\node_modules\@discordjs\rest\dist\index.js:963:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {stack: 'Error: options.uri is a required argument
…ions (node:internal/process/task_queues:95:5)', message: 'options.uri is a required argument', Symbol(kEnhanceStackBeforeInspector): ƒ}
3 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 12/1/2022 in #djs-questions
Shard 0 will stop sending heartbeat
Sometimes shard 0 will stop sending heartbeat, but all the other two shards send heartbeat. The bot becomes unresponsive to commands. Only a full reboot of the bot helps.
6 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 10/7/2022 in #djs-questions
interaction.options.getUser()
interaction.options.getUser() returns null
const userDiscord = interaction.options.getUser("user")
const userDiscord = interaction.options.getUser("user")
CommandInteractionOptionResolver {
_group: null,
_subcommand: 'daily',
_hoistedOptions: [
{ value: '364726576656678912', type: 6, name: 'user' },
{ value: '', type: 3, name: 'item', focused: true }
]
}
CommandInteractionOptionResolver {
_group: null,
_subcommand: 'daily',
_hoistedOptions: [
{ value: '364726576656678912', type: 6, name: 'user' },
{ value: '', type: 3, name: 'item', focused: true }
]
}
4 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 9/24/2022 in #djs-questions
Webhooks in forums
I tried to send webhook in thread channel, which is created in forum, but got this: DiscordAPIError[220001]: Webhooks posted to forum channels must have a thread_name or thread_id So, how i can specify thread_id for webhook?
const forum = await c.channels.fetch(channelId)
const webhook = await forum.guild.fetchWebhooks().then(webhooks => webhooks.find(webhook => webhook.channelId === channelId))
if (forum) {
const thread = forum.threads.cache.find(thread => thread.name.includes(author.id))
if (thread) {
if (webhook) webhook.send({ content: `**${author.username} (${author.id}):** ${message}` })
else thread.send({ content: `**${author.username} (${author.id}):** ${message}` })
}
const forum = await c.channels.fetch(channelId)
const webhook = await forum.guild.fetchWebhooks().then(webhooks => webhooks.find(webhook => webhook.channelId === channelId))
if (forum) {
const thread = forum.threads.cache.find(thread => thread.name.includes(author.id))
if (thread) {
if (webhook) webhook.send({ content: `**${author.username} (${author.id}):** ${message}` })
else thread.send({ content: `**${author.username} (${author.id}):** ${message}` })
}
6 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 8/8/2022 in #djs-questions
TypeError Cannot read properties of null (reading 'interaction')
I can't figure out where the error is coming from
TypeError: Cannot read properties of null (reading 'interaction')
at ModalSubmitInteraction.deferUpdate (C:\Users\AnthonyVault-Beelink\Documents\GitHub\wetbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:200:96)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
TypeError: Cannot read properties of null (reading 'interaction')
at ModalSubmitInteraction.deferUpdate (C:\Users\AnthonyVault-Beelink\Documents\GitHub\wetbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:200:96)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
djs:
async deferUpdate(options = {}) {
if (this.deferred || this.replied) throw new Error(ErrorCodes.InteractionAlreadyReplied);
await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
body: {
type: InteractionResponseType.DeferredMessageUpdate,
},
auth: false,
});
this.deferred = true;

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id);
}
async deferUpdate(options = {}) {
if (this.deferred || this.replied) throw new Error(ErrorCodes.InteractionAlreadyReplied);
await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
body: {
type: InteractionResponseType.DeferredMessageUpdate,
},
auth: false,
});
this.deferred = true;

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id);
}
InteractionResponse(this, this.message.interaction?.id) For some reason message is null
5 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 8/1/2022 in #djs-questions
DiscordAPIError[50001] Missing Access
When I send messages in chat and run commands, buttons and etc this occur (I have invited bot with bot and application.commands scopes):
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:287:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
at async REST.request (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
at async ChannelManager.fetch (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\managers\ChannelManager.js:123:18)
at async eval (eval at _eval (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\client\Client.js:470:12), <anonymous>:2:31)
at async ShardClientUtil._handleMessage (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\sharding\ShardClientUtil.js:194:64)
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:287:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
at async REST.request (F:\WETBOT_discordjs_v14\node_modules\discord.js\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
at async ChannelManager.fetch (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\managers\ChannelManager.js:123:18)
at async eval (eval at _eval (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\client\Client.js:470:12), <anonymous>:2:31)
at async ShardClientUtil._handleMessage (F:\WETBOT_discordjs_v14\node_modules\discord.js\src\sharding\ShardClientUtil.js:194:64)
My client:
const { Client, Collection, Partials, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageReactions,
],
partials: [Partials.Channel]
});
const { Client, Collection, Partials, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageReactions,
],
partials: [Partials.Channel]
});
5 replies
DIAdiscord.js - Imagine an app
Created by ɅV on 6/28/2022 in #djs-questions
Fetch all invites from all guilds
How can i fetch all invites from all guilds without API spam? This do api spam:
client.guilds.cache.forEach(async guild => {
if (guild.me && guild.me.permissions.has('MANAGE_GUILD')) {
const invites = await guild.invites.fetch({ cache: false }).catch(e => null)
guildInvites.set(guild.id, invites);
}
})
client.guilds.cache.forEach(async guild => {
if (guild.me && guild.me.permissions.has('MANAGE_GUILD')) {
const invites = await guild.invites.fetch({ cache: false }).catch(e => null)
guildInvites.set(guild.id, invites);
}
})
9 replies