@doniczka
@doniczka
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
XD
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
but v.label is not working
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
like v.data.label is working in forEach
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
stupid error
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
okay solved
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
and 0 errors displays but the button labels wont update
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
i have update to like that
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol);
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newComponents = m2.components[0].components.map(v => {
if (v.customId === interaction.customId) {
v.label = `${pol.votes[interaction.customId] || 0}`;
}
return v;
});


await m2.edit({
components: [
new ActionRowBuilder()
.addComponents(newComponents)
]
});
}
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol);
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newComponents = m2.components[0].components.map(v => {
if (v.customId === interaction.customId) {
v.label = `${pol.votes[interaction.customId] || 0}`;
}
return v;
});


await m2.edit({
components: [
new ActionRowBuilder()
.addComponents(newComponents)
]
});
}
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
bump
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
ok. now its error beacuse its duplicated buttons
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol);
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newRows = m2.components.map(row => {
const newComponents = row.components.map(v => {
v.label = `${pol.votes[v.customId] || 0}`;
console.log(v);
return v;
});
return ActionRowBuilder.from(row).addComponents(newComponents);
});


await interaction.message.edit({
components: newRows
});
}





node:events:491
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
components[0].components[2].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component cus
tom id cannot be duplicated
components[0].components[3].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component cus
tom id cannot be duplicated
at handleErrors (C:\Users\ziemo\Desktop\botkacpero\node_modules\discord.js\node_
modules\@discordjs\rest\dist\index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\ziemo\Desktop\botkacpero\node_mo
dules\discord.js\node_modules\@discordjs\rest\dist\index.js:1072:23)
at async SequentialHandler.queueRequest (C:\Users\ziemo\Desktop\botkacpero\node_
modules\discord.js\node_modules\@discordjs\rest\dist\index.js:913:14)
at async _REST.request (C:\Users\ziemo\Desktop\botkacpero\node_modules\discord.j
s\node_modules\@discordjs\rest\dist\index.js:1218:22)
at async GuildMessageManager.edit (C:\Users\ziemo\Desktop\botkacpero\node_module
s\discord.js\src\managers\MessageManager.js:180:15)
at async Object.execute (C:\Users\ziemo\Desktop\botkacpero\src\events\client\int
eractionCreate.js:65:17)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: [
{
type: 1,
components: [ [Object], [Object], [Object], [Object] ]
}
],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
components: { '0': { components: { '2': [Object], '3': [Object] } } }
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1027264053191655516/messages/1149419511
028658296'
}

Node.js v18.16.0
[nodemon] app crashed - waiting for file changes before starting...
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol);
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newRows = m2.components.map(row => {
const newComponents = row.components.map(v => {
v.label = `${pol.votes[v.customId] || 0}`;
console.log(v);
return v;
});
return ActionRowBuilder.from(row).addComponents(newComponents);
});


await interaction.message.edit({
components: newRows
});
}





node:events:491
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
components[0].components[2].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component cus
tom id cannot be duplicated
components[0].components[3].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component cus
tom id cannot be duplicated
at handleErrors (C:\Users\ziemo\Desktop\botkacpero\node_modules\discord.js\node_
modules\@discordjs\rest\dist\index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\ziemo\Desktop\botkacpero\node_mo
dules\discord.js\node_modules\@discordjs\rest\dist\index.js:1072:23)
at async SequentialHandler.queueRequest (C:\Users\ziemo\Desktop\botkacpero\node_
modules\discord.js\node_modules\@discordjs\rest\dist\index.js:913:14)
at async _REST.request (C:\Users\ziemo\Desktop\botkacpero\node_modules\discord.j
s\node_modules\@discordjs\rest\dist\index.js:1218:22)
at async GuildMessageManager.edit (C:\Users\ziemo\Desktop\botkacpero\node_module
s\discord.js\src\managers\MessageManager.js:180:15)
at async Object.execute (C:\Users\ziemo\Desktop\botkacpero\src\events\client\int
eractionCreate.js:65:17)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: [
{
type: 1,
components: [ [Object], [Object], [Object], [Object] ]
}
],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
components: { '0': { components: { '2': [Object], '3': [Object] } } }
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1027264053191655516/messages/1149419511
028658296'
}

Node.js v18.16.0
[nodemon] app crashed - waiting for file changes before starting...
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
No description
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
nothing changes 😢
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
No description
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
but
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
im do that
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol); // Dodaj ten console.log do debugowania
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newRows = m2.components.map(row => {
const newComponents = row.components.map(v => {
v.label = `${pol.votes[v.customId] || 0}`;
console.log(v);
return v;
});
return new ActionRowBuilder().addComponents(newComponents);
});


await interaction.message.edit({
components: newRows
});
}
const m = interaction.message.id;
console.log(m);
const pol = await polls.findOne({ message: m });
if (pol) {
console.log('pol:', pol); // Dodaj ten console.log do debugowania
await interaction.deferReply({
ephemeral: true
});
pol.votes = pol.votes || {};
if (pol.votes[interaction.customId]) pol.votes[interaction.customId] += 1;
else pol.votes[interaction.customId] = 1;
pol.voters.push(interaction.user.id);
await polls.findOneAndUpdate({ message: pol.message }, pol);
await interaction.editReply({ content: "`[ ✔️ ]` Pomyślnie oddano głos w ankiecie!", ephemeral: true });
const m2 = interaction.channel.messages.cache.get(m);


const newRows = m2.components.map(row => {
const newComponents = row.components.map(v => {
v.label = `${pol.votes[v.customId] || 0}`;
console.log(v);
return v;
});
return new ActionRowBuilder().addComponents(newComponents);
});


await interaction.message.edit({
components: newRows
});
}
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
beacuse im updated to discord.js@latest
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
No description
37 replies
DIAdiscord.js - Imagine an app
Created by @doniczka on 9/18/2023 in #djs-questions
button label wont update after message.edit
and that wont work on v14
37 replies