#waiting before proceeding
16 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by OP
What do you want to make a delay for?
basically i need to extract a value from an embed field, but the embed takes a while to load in, so i want to make it wait like 2 seconds for the embed to load in, and only then take the value from it (because the embed adds a new value, which i need)
right now if im not waiting its saying it cant find the field
If it's an asynchronous method that is loading the embed, you should resolve the promise properly and then continue with your code
Setting an artificial timer does not magically fix promise resolution because it can take longer to resolve, and you would not be able to know ahead of time
i mean it is, but this is my embed code;
if (interaction.customId === 'approve') {
if (interaction.member.roles.cache.hasAny(...allowedIDs)) {
const originalEmbed = interaction.message.embeds[0];
const approvedEmbed = new EmbedBuilder()
.setColor('#2ecc71') // Change the color to green
.setTitle('Award Request Approved') // Change the title
.setDescription('The award request has been approved.') // Change the description
.setFields(originalEmbed.fields) // Copy the fields from the original embed
.addFields(
{name: "Update approved by", value: `<@${interaction.member.id}>`},
)
like my code is asynchronous
What is async here? That looks rather synchronous
hold on ill send you my entire code so i'm not saying something that's not true lol
i-m talking about the approve if loop
i mean yeah but like idk how i can resolve a promise in this case right here
if i put an await behind new that doesn't really fix it lol