Files
.gitignore
index.js
package.json
Code
3 165
index.js
const {
Client,
Events,
GatewayIntentBits,
REST,
Routes,
SlashCommandBuilder,
} = require('discord.js');
require('dotenv').config();
const token = process.env.DISCORD_TOKEN;
const clientId = process.env.DISCORD_CLIENT_ID;
const guildId = process.env.DISCORD_GUILD_ID;
if (!token || !clientId) {
throw new Error('Set DISCORD_TOKEN and DISCORD_CLIENT_ID before starting the bot.');
}
const commands = [
new SlashCommandBuilder()
.setName('shawarma')
.setDescription('Get a fresh serving of shawarma nonsense.'),
new SlashCommandBuilder()
.setName('order')
.setDescription('Place a deeply questionable fake shawarma order.'),
new SlashCommandBuilder()
.setName('menu')
.setDescription('Inspect today’s extremely unofficial menu.'),
new SlashCommandBuilder()
.setName('roast')
.setDescription('Receive a friendly, garlic-scented roast.')
.addUserOption(option =>
option.setName('person').setDescription('Who gets the gentle roast?'),
),
new SlashCommandBuilder()
.setName('fortune')
.setDescription('Ask the mysterious shawarma spit about your future.'),
].map(command => command.toJSON());
const shawarmaJokes = [
'A shawarma told me it was feeling wrapped up in its work. Honestly? Same.',
'My shawarma has excellent self-control. It only spills sauce on every single shirt.',
'The garlic sauce started a podcast. It already has a cult following.',
'I asked the shawarma for life advice. It said, “Stay grounded, stay wrapped.”',
'Breaking: local pita refuses to fold under pressure. More at 11.',
'The kebab skewer called in sick. It was feeling a little burnt out.',
'A shawarma walked into a server. It said, “Lettuce keep this between us.”',
'The pickles formed a band. Their first hit is “Crunch Time.”',
'Garlic sauce is just confidence you can dip fries into.',
'I tried to tell a food joke, but it was a little too well-done.',
];
const fakeOrders = [
'One shawarma with extra garlic sauce, a side of confidence, and absolutely no napkins. You are brave.',
'Order up: a pita stuffed with fries, pickles, and an ancient prophecy about lunch.',
'One “surprise me” wrap. The chef added seven pickles and a tiny fez. No refunds.',
'A shawarma, two fries, and a suspiciously wise cup of mint tea. Total: 3 good decisions.',
'Your order: extra spicy, extra sauce, and a receipt that just says “you know what you did.”',
'One wrap so tall it needs its own seatbelt. Please approach the counter carefully.',
'The kitchen made you a garlic-sauce smoothie. The kitchen has been asked to take a break.',
'One shawarma with everything on it. Yes, even the tiny paper umbrella. Enjoy your vacation wrap.',
];
const roasts = [
'has the strategic instincts of a falafel trying to use a revolving door.',
'would ask the garlic sauce for directions and still end up at the hummus.',
'has the energy of a pita that got left open overnight. Still lovable, though.',
'could burn toast in a restaurant that only serves cold food.',
'is proof that even the pickles can be the calm one in the group.',
'brings “forgot the napkins” energy to every important situation.',
'would lose a staring contest with a shawarma on a rotating spit.',
'has a brain running on one lentil and a very optimistic schedule.',
];
const fortunes = [
'A delicious opportunity approaches. It may be lunch. It may be a second lunch.',
'Beware a suspiciously quiet garlic sauce. It knows what it did.',
'Your future is bright, your pita is warm, and someone will ask for one bite.',
'A small pickle will bring you great wisdom. Do not question the pickle.',
'Today you will make an excellent choice. The sauce selection is critical.',
'The stars say: take a chance. Add the extra fries.',
'A mysterious stranger will soon say, “I’m not hungry.” They are lying.',
'Your lucky number is 3. Your lucky condiment is all of them.',
];
const menu = [
'**The Classic:** chicken, pickles, garlic sauce, and big main-character energy.',
'**The Chaos Wrap:** fries inside the shawarma. The rules are made up.',
'**The Garlic Situation:** a normal wrap, but the sauce gets its own chair.',
'**The Midnight Special:** mystery fillings selected by a very confident pigeon.',
'**The Vegetarian Plot Twist:** falafel, crunchy pickles, and absolutely no plot holes.',
];
function pick(items) {
return items[Math.floor(Math.random() * items.length)];
}
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, readyClient => {
console.log(`Wrapped and ready as ${readyClient.user.tag}.`);
});
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
switch (interaction.commandName) {
case 'shawarma':
await interaction.reply(pick(shawarmaJokes));
break;
case 'order':
await interaction.reply(`🥙 ${pick(fakeOrders)}`);
break;
case 'menu':
await interaction.reply(`**Today's extremely unofficial menu**\n${menu.map(item => `• ${item}`).join('\n')}`);
break;
case 'roast': {
const person = interaction.options.getUser('person') ?? interaction.user;
await interaction.reply(`${person} ${pick(roasts)}`);
break;
}
case 'fortune':
await interaction.reply(`🔮 ${pick(fortunes)}`);
break;
default:
break;
}
});
async function start() {
const rest = new REST({ version: '10' }).setToken(token);
const route = guildId
? Routes.applicationGuildCommands(clientId, guildId)
: Routes.applicationCommands(clientId);
await rest.put(route, { body: commands });
console.log(`Registered ${commands.length} slash commands${guildId ? ` for guild ${guildId}` : ' globally'}.`);
await client.login(token);
}
start().catch(error => {
console.error('The shawarma stand failed to open:', error);
process.exitCode = 1;
});