Unknown interaction

DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData); ^ DiscordAPIError[10062]: Unknown interaction
const target_data = await database.get(`users.${user.id}`);

if (!target_data) {
await database.set(`users.${user.id}`, {
club: "",
club_role: "",
pass_block: new Date().getTime(),
balance: 0,
});

return interaction.reply({ content: "`[ ✔️ ]` Pomyślnie utworzono konto użytkownika <@" + user.id + ">, użyj komendy ponownie!", ephemeral: true });
}

if (target_data.club) return interaction.reply({ content: "`[ ❌ ]` Podany gracz jest już w klubie!", ephemeral: true });

if (new Date().getTime() < target_data.pass_block) return interaction.reply({ content: "\`[ ✔️ ]\` Użytkownik posiada aktywną blokadę podań!", ephemeral: true });

if (!contracts[user.id]) contracts[user.id] = [];
for (i = 0; i < contracts[user.id].length; i++) {
if (contracts[user.id][i].club === club_data.name && contracts[user.id][i].end > new Date().getTime()) return interaction.reply({ content: "`[ ❌ ]` Wysłałeś już oferte kontraktu!", ephemeral: true });
};

contracts[user.id].push({
"club": club_data.name,
"rank": rank,
"end": 0,
"mId": 0,
});

let current_contract = contracts[user.id][contracts[user.id].length - 1];

current_contract.end = new Date().getTime() + (12 * 3600000);
let time = Date.parse(new Date(new Date().getTime() + (12 * 3600000))) / 1000;

const embed = {
title: "`🎫` IFL - Oferta kontraktu",
description: "Dostałeś ofertę podpisania kontraktu od klubu **" + club_data.name + "**!",
fields: [
{
name: '`🕐` Wygasa za:',
value: "<t:" + time + ":R>",
inline: true,
},
{
name: '`🎖️` Posada:',
value: rank,
inline: true,
},
{
name: '`👤` Prezes:',
value: interaction.user.username,
inline: true,
},
],
timestamp: new Date().toISOString(),
footer: {
text: interaction.user.username + " | " + interaction.user.id,
icon_url: interaction.user.avatarURL(),
},
image: {
url: "https://imgur.com/MjTK8Dn.png",
},
color: Colors.White,
};

const button_accept = new ButtonBuilder()
.setCustomId('CONTRACT_ACCEPT_BUTTON')
.setLabel('Podpisz kontrakt!')
.setStyle(ButtonStyle.Primary);

const button_reject = new ButtonBuilder()
.setCustomId('CONTRACT_REJECT_BUTTON')
.setLabel('Odrzuć kontrakt!')
.setStyle(ButtonStyle.Secondary);

const row = new ActionRowBuilder()
.addComponents(button_accept, button_reject);

user.send({ embeds: [embed], components: [row] }).then(message => {
current_contract.mId = message.id;

fs.writeFileSync("data/contracts.json", JSON.stringify(contracts));

interaction.reply({ content: "\`[ ✔️ ]\` Pomyślnie wysłano ofertę kontraktu do <@" + user.id + ">!", ephemeral: true });
}).catch(error => {
interaction.reply({ content: "\`[ ❌ ]\` Podana osoba ma wyłączone wiadomości prywatne!", ephemeral: true });
});
const target_data = await database.get(`users.${user.id}`);

if (!target_data) {
await database.set(`users.${user.id}`, {
club: "",
club_role: "",
pass_block: new Date().getTime(),
balance: 0,
});

return interaction.reply({ content: "`[ ✔️ ]` Pomyślnie utworzono konto użytkownika <@" + user.id + ">, użyj komendy ponownie!", ephemeral: true });
}

if (target_data.club) return interaction.reply({ content: "`[ ❌ ]` Podany gracz jest już w klubie!", ephemeral: true });

if (new Date().getTime() < target_data.pass_block) return interaction.reply({ content: "\`[ ✔️ ]\` Użytkownik posiada aktywną blokadę podań!", ephemeral: true });

if (!contracts[user.id]) contracts[user.id] = [];
for (i = 0; i < contracts[user.id].length; i++) {
if (contracts[user.id][i].club === club_data.name && contracts[user.id][i].end > new Date().getTime()) return interaction.reply({ content: "`[ ❌ ]` Wysłałeś już oferte kontraktu!", ephemeral: true });
};

contracts[user.id].push({
"club": club_data.name,
"rank": rank,
"end": 0,
"mId": 0,
});

let current_contract = contracts[user.id][contracts[user.id].length - 1];

current_contract.end = new Date().getTime() + (12 * 3600000);
let time = Date.parse(new Date(new Date().getTime() + (12 * 3600000))) / 1000;

const embed = {
title: "`🎫` IFL - Oferta kontraktu",
description: "Dostałeś ofertę podpisania kontraktu od klubu **" + club_data.name + "**!",
fields: [
{
name: '`🕐` Wygasa za:',
value: "<t:" + time + ":R>",
inline: true,
},
{
name: '`🎖️` Posada:',
value: rank,
inline: true,
},
{
name: '`👤` Prezes:',
value: interaction.user.username,
inline: true,
},
],
timestamp: new Date().toISOString(),
footer: {
text: interaction.user.username + " | " + interaction.user.id,
icon_url: interaction.user.avatarURL(),
},
image: {
url: "https://imgur.com/MjTK8Dn.png",
},
color: Colors.White,
};

const button_accept = new ButtonBuilder()
.setCustomId('CONTRACT_ACCEPT_BUTTON')
.setLabel('Podpisz kontrakt!')
.setStyle(ButtonStyle.Primary);

const button_reject = new ButtonBuilder()
.setCustomId('CONTRACT_REJECT_BUTTON')
.setLabel('Odrzuć kontrakt!')
.setStyle(ButtonStyle.Secondary);

const row = new ActionRowBuilder()
.addComponents(button_accept, button_reject);

user.send({ embeds: [embed], components: [row] }).then(message => {
current_contract.mId = message.id;

fs.writeFileSync("data/contracts.json", JSON.stringify(contracts));

interaction.reply({ content: "\`[ ✔️ ]\` Pomyślnie wysłano ofertę kontraktu do <@" + user.id + ">!", ephemeral: true });
}).catch(error => {
interaction.reply({ content: "\`[ ❌ ]\` Podana osoba ma wyłączone wiadomości prywatne!", ephemeral: true });
});
1 Reply
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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
Want results from more Discord servers?
Add your server