Add new features for giveaways, tickets, self-roles, tags, starboard, suggestions, and birthdays
- Integrated new command modules for managing giveaways, tickets, self-roles, tags, starboard, suggestions, and birthdays, enhancing the bot's capabilities. - Implemented job handling for giveaway endings, ticket management, and birthday role expirations, improving automation and user experience. - Updated command definitions and interaction handling to support new features, ensuring smooth user interactions. - Enhanced the job processing system with dedicated workers for managing various tasks, including auto-closing tickets and running birthday checks. - Documented the new features and their setup processes in PHASE-TRACKING.md for clarity on implementation steps.
This commit is contained in:
@@ -39,6 +39,29 @@ import {
|
||||
registerUtilityEvents
|
||||
} from './modules/utility/index.js';
|
||||
import { handleFunButton, isFunButton } from './modules/fun/index.js';
|
||||
import { handleGiveawayButton, isGiveawayButton } from './modules/giveaways/index.js';
|
||||
import {
|
||||
handleTicketInteraction,
|
||||
isTicketInteraction,
|
||||
registerTicketEvents
|
||||
} from './modules/tickets/index.js';
|
||||
import {
|
||||
handleSelfRoleInteraction,
|
||||
isSelfRoleInteraction,
|
||||
registerSelfRoleEvents
|
||||
} from './modules/selfroles/index.js';
|
||||
import { registerTagEvents } from './modules/tags/index.js';
|
||||
import { registerStarboardEvents } from './modules/starboard/index.js';
|
||||
import {
|
||||
handleSuggestionButton,
|
||||
isSuggestionButton
|
||||
} from './modules/suggestions/index.js';
|
||||
import {
|
||||
handleTempVoiceInteraction,
|
||||
isTempVoiceInteraction,
|
||||
isTempVoiceModal,
|
||||
registerTempVoiceEvents
|
||||
} from './modules/tempvoice/index.js';
|
||||
|
||||
const isShard = process.argv.includes('--shard');
|
||||
|
||||
@@ -57,13 +80,19 @@ if (!isShard) {
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildModeration,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildEmojisAndStickers,
|
||||
GatewayIntentBits.GuildInvites,
|
||||
GatewayIntentBits.MessageContent
|
||||
],
|
||||
partials: [Partials.Channel, Partials.Message, Partials.GuildMember]
|
||||
partials: [
|
||||
Partials.Channel,
|
||||
Partials.Message,
|
||||
Partials.GuildMember,
|
||||
Partials.Reaction
|
||||
]
|
||||
});
|
||||
|
||||
const context: BotContext = { client, prisma, redis };
|
||||
@@ -74,10 +103,19 @@ if (!isShard) {
|
||||
registerVerificationEvents(context);
|
||||
registerLevelingEvents(context);
|
||||
registerUtilityEvents(context);
|
||||
registerTicketEvents(context);
|
||||
registerSelfRoleEvents(client, context);
|
||||
registerTagEvents(client, context);
|
||||
registerStarboardEvents(context);
|
||||
registerTempVoiceEvents(context);
|
||||
|
||||
client.on(Events.ClientReady, async () => {
|
||||
logger.info({ tag: client.user?.tag }, 'Bot ready');
|
||||
await registerCommands();
|
||||
try {
|
||||
await registerCommands();
|
||||
} catch (error) {
|
||||
logger.error({ error }, 'Failed to register application commands');
|
||||
}
|
||||
});
|
||||
|
||||
client.on(Events.MessageCreate, async (message) => {
|
||||
@@ -125,6 +163,44 @@ if (!isShard) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.isButton() && isGiveawayButton(interaction.customId)) {
|
||||
await handleGiveawayButton(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(interaction.isButton() ||
|
||||
interaction.isStringSelectMenu() ||
|
||||
interaction.isModalSubmit()) &&
|
||||
isTicketInteraction(interaction.customId)
|
||||
) {
|
||||
await handleTicketInteraction(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(interaction.isButton() || interaction.isStringSelectMenu()) &&
|
||||
isSelfRoleInteraction(interaction.customId)
|
||||
) {
|
||||
await handleSelfRoleInteraction(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.isButton() && isSuggestionButton(interaction.customId)) {
|
||||
await handleSuggestionButton(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.isButton() && isTempVoiceInteraction(interaction.customId)) {
|
||||
await handleTempVoiceInteraction(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.isModalSubmit() && isTempVoiceModal(interaction.customId)) {
|
||||
await handleTempVoiceInteraction(interaction, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.isModalSubmit() && isEmbedModal(interaction.customId)) {
|
||||
await handleEmbedModal(interaction, context);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user