Unknown Interaction on interaction.reply()
The error is in the given picture, im using discord.js v14, i don't know why this is happening
Code:
Code:
import {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder,
} from 'discord.js';
import { command, query } from '../utils/index.js';
export default command(
new SlashCommandBuilder()
.setName('createorder')
.setDescription('Add an order to the current queue')
// Too many chars in the message, so i removed this in the message
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async (interaction) => {
const userId = interaction.user.id as string;
if (
userId !== '1151874231429242911' &&
userId !== '1151534189729034343'
) {
await interaction.deferReply();
return await interaction.reply({
content: "You're not allowed to use this command",
ephemeral: true,
});
}
const args = {
user: interaction.options.getUser('user', true)!.id,
product: interaction.options.getString('product', true),
paid: interaction.options.getString('paid', true),
status: interaction.options.getString('status', true),
price: interaction.options.getString('price', true),
channel: interaction.options.getChannel('channel')?.id ?? 'š«',
payment: interaction.options.getString('payment') ?? 'š«',
};
for (const arg in args) {
if (args[arg as keyof typeof args] === null) {
await interaction.deferReply();
return await interaction.reply({
content: 'Something went wrong.',
ephemeral: true,
});
}
}
const { insertId } = (await query(
'INSERT INTO orders (user, product, paid, status, price, channel, payment) VALUES (?, ?, ?, ?, ?, ?, ?)',
Object.values(args),
)) as { insertId: number };
const embed = new EmbedBuilder()
.setColor('#ffffff')
.setTitle(`Order Information | No: ${insertId}`)
.addFields([
{
name: 'User:',
value: `<@${args.user}>`,
inline: true,
},
{
name: 'Channel:',
value:
args.channel.length > 17 ? `<#${args.channel}>` : 'š«',
inline: true,
},
{
name: 'Product:',
value: args.product as string,
inline: true,
},
{
name: 'Price:',
value: args.price as string,
inline: true,
},
{
name: 'Payment:',
value: args.payment as string,
inline: true,
},
{
name: 'Paid:',
value: args.paid as string,
inline: true,
},
{
name: 'Status:',
value: args.status as string,
inline: false,
},
]);
await interaction.deferReply();
await interaction.reply({
content: 'Order created:',
embeds: [embed],
});
},
);import {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder,
} from 'discord.js';
import { command, query } from '../utils/index.js';
export default command(
new SlashCommandBuilder()
.setName('createorder')
.setDescription('Add an order to the current queue')
// Too many chars in the message, so i removed this in the message
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async (interaction) => {
const userId = interaction.user.id as string;
if (
userId !== '1151874231429242911' &&
userId !== '1151534189729034343'
) {
await interaction.deferReply();
return await interaction.reply({
content: "You're not allowed to use this command",
ephemeral: true,
});
}
const args = {
user: interaction.options.getUser('user', true)!.id,
product: interaction.options.getString('product', true),
paid: interaction.options.getString('paid', true),
status: interaction.options.getString('status', true),
price: interaction.options.getString('price', true),
channel: interaction.options.getChannel('channel')?.id ?? 'š«',
payment: interaction.options.getString('payment') ?? 'š«',
};
for (const arg in args) {
if (args[arg as keyof typeof args] === null) {
await interaction.deferReply();
return await interaction.reply({
content: 'Something went wrong.',
ephemeral: true,
});
}
}
const { insertId } = (await query(
'INSERT INTO orders (user, product, paid, status, price, channel, payment) VALUES (?, ?, ?, ?, ?, ?, ?)',
Object.values(args),
)) as { insertId: number };
const embed = new EmbedBuilder()
.setColor('#ffffff')
.setTitle(`Order Information | No: ${insertId}`)
.addFields([
{
name: 'User:',
value: `<@${args.user}>`,
inline: true,
},
{
name: 'Channel:',
value:
args.channel.length > 17 ? `<#${args.channel}>` : 'š«',
inline: true,
},
{
name: 'Product:',
value: args.product as string,
inline: true,
},
{
name: 'Price:',
value: args.price as string,
inline: true,
},
{
name: 'Payment:',
value: args.payment as string,
inline: true,
},
{
name: 'Paid:',
value: args.paid as string,
inline: true,
},
{
name: 'Status:',
value: args.status as string,
inline: false,
},
]);
await interaction.deferReply();
await interaction.reply({
content: 'Order created:',
embeds: [embed],
});
},
);