require('dotenv').
config();
const { Client, GatewayIntentBits, REST, Routes, SlashCommandBuilder,
EmbedBuilder } = require('[Link]');
const client = new Client({ intents: [[Link]] });
// Store image link (upload to Discord and replace this link)
const STORE_IMAGE =
'[Link]
now_make_logo_in_wid.png?
ex=689c5bde&is=689b0a5e&hm=acb4b34da2914c51b55d71fd06b46219f12b8c81642476e64f30d84f
e5600392&';
// Store orders in memory
let dailyOrders = [];
// Slash commands
const commands = [
new SlashCommandBuilder()
.setName('order')
.setDescription('Post an order confirmation embed')
.addStringOption(option =>
[Link]('buyer').setDescription('Buyer name or
mention').setRequired(true))
.addStringOption(option =>
[Link]('product').setDescription('Product name').setRequired(true))
.addIntegerOption(option =>
[Link]('order_no').setDescription('Order number').setRequired(true))
.addIntegerOption(option =>
[Link]('quantity').setDescription('Quantity').setRequired(true))
.toJSON(),
new SlashCommandBuilder()
.setName('todayorders')
.setDescription('List all orders placed today')
.toJSON()
];
async function registerCommands() {
const rest = new REST({ version: '10' }).setToken([Link].BOT_TOKEN);
await [Link](
[Link]([Link].CLIENT_ID, [Link].GUILD_ID),
{ body: commands }
);
[Link]('✅ Slash commands registered.');
}
[Link]('ready', () => {
[Link](`🤖 Logged in as ${[Link]}`);
registerCommands();
});
[Link]('interactionCreate', async interaction => {
if (![Link]()) return;
// Handle /order
if ([Link] === 'order') {
const buyer = [Link]('buyer');
const product = [Link]('product');
const orderNo = [Link]('order_no');
const quantity = [Link]('quantity');
// Save order in memory
[Link]({ buyer, product, orderNo, quantity, time: new Date() });
const embed = new EmbedBuilder()
.setColor(0xFF8C00)
.setTitle('✅ Order Confirmed')
.setDescription(`**Order No:** \`${orderNo}\``)
.addFields(
{ name: 'Product', value: product, inline: true },
{ name: 'Quantity', value: `${quantity}x`, inline: true },
{ name: 'Buyer', value: buyer, inline: false }
)
.setThumbnail(STORE_IMAGE)
.setImage(STORE_IMAGE)
.setFooter({ text: 'Legit Store by Rattys', iconURL: STORE_IMAGE })
.setTimestamp();
await [Link]({ embeds: [embed] });
}
// Handle /todayorders
if ([Link] === 'todayorders') {
if ([Link] === 0) {
return [Link]({ content: '📭 No orders today.', ephemeral: true });
}
// Format orders
const orderList = [Link](o =>
`#${[Link]} | ${[Link]} (${[Link]}x) - Buyer: ${[Link]} - $
{[Link]()}`
).join('\n');
const embed = new EmbedBuilder()
.setColor(0xFF8C00)
.setTitle('📦 Today\'s Orders')
.setDescription(orderList)
.setFooter({ text: 'Legit Store by Rattys', iconURL: STORE_IMAGE })
.setTimestamp();
await [Link]({ embeds: [embed] });
}
});
// Reset orders at midnight
setInterval(() => {
const now = new Date();
if ([Link]() === 0 && [Link]() === 0) {
dailyOrders = [];
[Link]('🕛 Orders reset for the new day.');
}
}, 60000);
[Link]([Link].BOT_TOKEN);