From b19e055be6c0f9b08626c6af87e3a4444794783e Mon Sep 17 00:00:00 2001 From: hareshgoyal06 Date: Tue, 13 Jan 2026 14:28:14 -0500 Subject: [PATCH] chore: cleaned up codebase --- src/bot/commands/flower.ts | 7 ++++- src/bot/commands/ping.ts | 7 ----- src/bot/commands/poll.ts | 52 ---------------------------------- src/bot/commands/serverinfo.ts | 34 ---------------------- src/bot/commands/userinfo.ts | 47 ------------------------------ src/bot/commands/welcome.ts | 32 --------------------- src/bot/index.ts | 20 ------------- src/bot/registerCommands.ts | 14 +-------- 8 files changed, 7 insertions(+), 206 deletions(-) delete mode 100644 src/bot/commands/ping.ts delete mode 100644 src/bot/commands/poll.ts delete mode 100644 src/bot/commands/serverinfo.ts delete mode 100644 src/bot/commands/userinfo.ts delete mode 100644 src/bot/commands/welcome.ts diff --git a/src/bot/commands/flower.ts b/src/bot/commands/flower.ts index 28198e1..df3610b 100644 --- a/src/bot/commands/flower.ts +++ b/src/bot/commands/flower.ts @@ -371,11 +371,16 @@ function createFlowerEmbed( displayName: string, attachmentData?: { url: string; contentType: string; filename: string }, ): EmbedBuilder { + const footerText = + displayName === 'Anonymous' + ? 'Thank you for celebrating with us! 🌸' + : `Submitted by ${displayName}\nThank you for celebrating with us! 🌸`; + const embed = new EmbedBuilder() .setColor('#FF69B4') // Pink color for flowers .setTitle('🌸🌺🌼') .setDescription(message) - .setFooter({ text: `Submitted by ${displayName} • Thank you for celebrating with us! 🌸` }); + .setFooter({ text: footerText }); // Add image if provided if (attachmentData) { diff --git a/src/bot/commands/ping.ts b/src/bot/commands/ping.ts deleted file mode 100644 index 2e491c5..0000000 --- a/src/bot/commands/ping.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js'; - -export const ping = new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'); - -export async function pingCommand(interaction: ChatInputCommandInteraction) { - await interaction.reply('🏓 Pong!'); -} diff --git a/src/bot/commands/poll.ts b/src/bot/commands/poll.ts deleted file mode 100644 index 82e6699..0000000 --- a/src/bot/commands/poll.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } from 'discord.js'; - -export const poll = new SlashCommandBuilder() - .setName('poll') - .setDescription('Creates a poll with up to 5 options') - .addStringOption((option) => - option.setName('question').setDescription('The poll question').setRequired(true), - ) - .addStringOption((option) => - option.setName('option1').setDescription('First option').setRequired(true), - ) - .addStringOption((option) => - option.setName('option2').setDescription('Second option').setRequired(true), - ) - .addStringOption((option) => - option.setName('option3').setDescription('Third option').setRequired(false), - ) - .addStringOption((option) => - option.setName('option4').setDescription('Fourth option').setRequired(false), - ) - .addStringOption((option) => - option.setName('option5').setDescription('Fifth option').setRequired(false), - ); - -export async function pollCommand(interaction: ChatInputCommandInteraction) { - const question = interaction.options.getString('question', true); - const options: string[] = []; - - // Collect all provided options - for (let i = 1; i <= 5; i++) { - const option = interaction.options.getString(`option${i}`); - if (option) options.push(option); - } - - const emojis = ['1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣']; - - const description = options.map((opt, idx) => `${emojis[idx]} ${opt}`).join('\n'); - - const embed = new EmbedBuilder() - .setColor('#5865F2') - .setTitle(`📊 ${question}`) - .setDescription(description) - .setFooter({ text: `Poll created by ${interaction.user.tag}` }) - .setTimestamp(); - - const message = await interaction.reply({ embeds: [embed], fetchReply: true }); - - // Add reaction emojis - for (let i = 0; i < options.length; i++) { - await message.react(emojis[i]); - } -} diff --git a/src/bot/commands/serverinfo.ts b/src/bot/commands/serverinfo.ts deleted file mode 100644 index a32f70f..0000000 --- a/src/bot/commands/serverinfo.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } from 'discord.js'; - -export const serverinfo = new SlashCommandBuilder() - .setName('serverinfo') - .setDescription('Displays information about the server'); - -export async function serverinfoCommand(interaction: ChatInputCommandInteraction) { - const { guild } = interaction; - - if (!guild) { - await interaction.reply('This command can only be used in a server!'); - return; - } - - const embed = new EmbedBuilder() - .setColor('#5865F2') - .setTitle(`📊 ${guild.name} Server Information`) - .setThumbnail(guild.iconURL() ?? '') - .addFields( - { name: '🆔 Server ID', value: guild.id, inline: true }, - { name: '👑 Owner', value: `<@${guild.ownerId}>`, inline: true }, - { name: '👥 Members', value: `${guild.memberCount}`, inline: true }, - { - name: '📅 Created', - value: ``, - inline: true, - }, - { name: '💬 Channels', value: `${guild.channels.cache.size}`, inline: true }, - { name: '🎭 Roles', value: `${guild.roles.cache.size}`, inline: true }, - ) - .setTimestamp(); - - await interaction.reply({ embeds: [embed] }); -} diff --git a/src/bot/commands/userinfo.ts b/src/bot/commands/userinfo.ts deleted file mode 100644 index 0d5fb5b..0000000 --- a/src/bot/commands/userinfo.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } from 'discord.js'; - -export const userinfo = new SlashCommandBuilder() - .setName('userinfo') - .setDescription('Displays information about a user') - .addUserOption((option) => - option.setName('user').setDescription('The user to get info about').setRequired(false), - ); - -export async function userinfoCommand(interaction: ChatInputCommandInteraction) { - const targetUser = interaction.options.getUser('user') ?? interaction.user; - const member = interaction.guild?.members.cache.get(targetUser.id); - - const embed = new EmbedBuilder() - .setColor('#5865F2') - .setTitle(`👤 User Information`) - .setThumbnail(targetUser.displayAvatarURL({ size: 256 })) - .addFields( - { name: '👤 Username', value: targetUser.tag, inline: true }, - { name: '🆔 User ID', value: targetUser.id, inline: true }, - { name: '🤖 Bot?', value: targetUser.bot ? 'Yes' : 'No', inline: true }, - { - name: '📅 Account Created', - value: ``, - inline: true, - }, - ); - - if (member) { - embed.addFields( - { - name: '📥 Joined Server', - value: ``, - inline: true, - }, - { - name: '🎭 Roles', - value: member.roles.cache.size > 1 ? `${member.roles.cache.size - 1}` : 'None', - inline: true, - }, - ); - } - - embed.setTimestamp(); - - await interaction.reply({ embeds: [embed] }); -} diff --git a/src/bot/commands/welcome.ts b/src/bot/commands/welcome.ts deleted file mode 100644 index 9af567c..0000000 --- a/src/bot/commands/welcome.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder } from 'discord.js'; - -export const welcome = new SlashCommandBuilder() - .setName('welcome') - .setDescription('Sends a welcome message') - .addUserOption((option) => - option.setName('user').setDescription('User to welcome (defaults to you)').setRequired(false), - ); - -export async function welcomeCommand(interaction: ChatInputCommandInteraction) { - const targetUser = interaction.options.getUser('user') ?? interaction.user; - const { guild } = interaction; - - const embed = new EmbedBuilder() - .setColor('#57F287') - .setTitle(`🎉 Welcome to ${guild?.name ?? 'the server'}!`) - .setDescription(`Hey ${targetUser}, welcome aboard! We're glad to have you here.`) - .setThumbnail(targetUser.displayAvatarURL({ size: 256 })) - .addFields( - { - name: '📜 Read the Rules', - value: 'Make sure to check out our server rules!', - inline: true, - }, - { name: '💬 Say Hi', value: 'Introduce yourself to the community!', inline: true }, - { name: '🎮 Have Fun', value: 'Enjoy your time here!', inline: true }, - ) - .setFooter({ text: `Member #${guild?.memberCount ?? '???'}` }) - .setTimestamp(); - - await interaction.reply({ embeds: [embed] }); -} diff --git a/src/bot/index.ts b/src/bot/index.ts index 8d133bc..c4c9a54 100644 --- a/src/bot/index.ts +++ b/src/bot/index.ts @@ -8,11 +8,6 @@ import { handleFlowerConsentButton, handleFlowerShareUsernameButton, } from './commands/flower.js'; -import { pingCommand } from './commands/ping.js'; -import { pollCommand } from './commands/poll.js'; -import { serverinfoCommand } from './commands/serverinfo.js'; -import { userinfoCommand } from './commands/userinfo.js'; -import { welcomeCommand } from './commands/welcome.js'; import { handleFlowerChannelMessage, handleModerationApprove, @@ -105,21 +100,6 @@ client.on('interactionCreate', async (interaction: Interaction) => { try { switch (interaction.commandName) { - case 'ping': - await pingCommand(interaction); - break; - case 'serverinfo': - await serverinfoCommand(interaction); - break; - case 'userinfo': - await userinfoCommand(interaction); - break; - case 'poll': - await pollCommand(interaction); - break; - case 'welcome': - await welcomeCommand(interaction); - break; case 'flower': await flowerCommand(interaction); break; diff --git a/src/bot/registerCommands.ts b/src/bot/registerCommands.ts index 2cb185c..18a5d03 100644 --- a/src/bot/registerCommands.ts +++ b/src/bot/registerCommands.ts @@ -3,20 +3,8 @@ import 'dotenv/config'; import { REST, Routes } from 'discord.js'; import { flower } from './commands/flower.js'; -import { ping } from './commands/ping.js'; -import { poll } from './commands/poll.js'; -import { serverinfo } from './commands/serverinfo.js'; -import { userinfo } from './commands/userinfo.js'; -import { welcome } from './commands/welcome.js'; -const commands = [ - ping.toJSON(), - serverinfo.toJSON(), - userinfo.toJSON(), - poll.toJSON(), - welcome.toJSON(), - flower.toJSON(), -]; +const commands = [flower.toJSON()]; const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN!);