Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/bot/commands/flower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,16 @@
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) {
Expand Down Expand Up @@ -411,7 +416,7 @@
}
}

async function processFlowerSubmission(

Check warning on line 419 in src/bot/commands/flower.ts

View workflow job for this annotation

GitHub Actions / lint

Refactor this function to reduce its Cognitive Complexity from 36 to the 15 allowed

Check warning on line 419 in src/bot/commands/flower.ts

View workflow job for this annotation

GitHub Actions / lint

Refactor this function to reduce its Cognitive Complexity from 36 to the 15 allowed
interaction: ButtonInteraction,
submissionData: {
attachment?: { url: string; contentType: string; filename: string };
Expand Down Expand Up @@ -593,7 +598,7 @@
// If already deferred/replied, use editReply or followUp
if (interaction.deferred) {
await interaction.editReply({
content: '❌ An error occurred while submitting your flower. Please try again.',

Check warning on line 601 in src/bot/commands/flower.ts

View workflow job for this annotation

GitHub Actions / lint

Define a constant instead of duplicating this literal 3 times

Check warning on line 601 in src/bot/commands/flower.ts

View workflow job for this annotation

GitHub Actions / lint

Define a constant instead of duplicating this literal 3 times
components: [],
});
} else {
Expand Down
7 changes: 0 additions & 7 deletions src/bot/commands/ping.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/bot/commands/poll.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/bot/commands/serverinfo.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/bot/commands/userinfo.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/bot/commands/welcome.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
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,
Expand Down Expand Up @@ -42,7 +37,7 @@
}
});

client.on('interactionCreate', async (interaction: Interaction) => {

Check warning on line 40 in src/bot/index.ts

View workflow job for this annotation

GitHub Actions / lint

Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed

Check warning on line 40 in src/bot/index.ts

View workflow job for this annotation

GitHub Actions / lint

Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed
// Handle button interactions
if (interaction.isButton()) {
try {
Expand All @@ -60,7 +55,7 @@
try {
if (interaction.deferred) {
await interaction.editReply({
content: 'An error occurred while processing your interaction.',

Check warning on line 58 in src/bot/index.ts

View workflow job for this annotation

GitHub Actions / lint

Define a constant instead of duplicating this literal 3 times

Check warning on line 58 in src/bot/index.ts

View workflow job for this annotation

GitHub Actions / lint

Define a constant instead of duplicating this literal 3 times
components: [],
});
} else if (!interaction.replied) {
Expand Down Expand Up @@ -105,21 +100,6 @@

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;
Expand Down
14 changes: 1 addition & 13 deletions src/bot/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!);

Expand Down
Loading