interaction.reply and web3 library issue

I receive an error during interaction.reply . I use discord.js (ver. 13.16) and web3 library to send transaction from one account to another and transaction is passed, but after doing it my bot turn off and show me an error:
\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Unknown interaction
\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Unknown interaction
this is code what I use:
if (availableQuantity >= quantity) {
async function withdrawBNB(wallet, quantity) {
// ...
// Transaction logic using web3
// ...
};
withdrawBNB(wallet, quantity)
.then((response) => {
interaction.reply(`You have successfully withdrawn ${quantity} ${cryptoName} to wallet ${wallet}. TxHash: ${response.txHash}`);
})
.catch((error) => {
console.error(error);
interaction.reply('Failed to withdraw BNB. Please try again later.');
});
}
if (availableQuantity >= quantity) {
async function withdrawBNB(wallet, quantity) {
// ...
// Transaction logic using web3
// ...
};
withdrawBNB(wallet, quantity)
.then((response) => {
interaction.reply(`You have successfully withdrawn ${quantity} ${cryptoName} to wallet ${wallet}. TxHash: ${response.txHash}`);
})
.catch((error) => {
console.error(error);
interaction.reply('Failed to withdraw BNB. Please try again later.');
});
}
4 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
d.js docs
d.js docs15mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. * Note: you cannot defer modal or autocomplete value responses
Job102|The Little Universe
what dose it mean? should I use some await ? I think values in interaction.reply are ok
It's Manny
It's Manny15mo ago
if your bot's reply takes longer than 3 seconds until sending you need to defer it You'd need to await the defer
Want results from more Discord servers?
Add your server