Skip to content

Commit 3846e89

Browse files
committed
fix: reaction collector's timer
1 parent b3db20b commit 3846e89

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

src/commands/calendar/addEvent.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ export const addEvent: Command = new Command(
1515

1616
// https://discord.com/channels/222078108977594368/824411059443204127/1124741436747813004
1717
new SlashCommandBuilder()
18-
.setName('add-event')
18+
.setName('new-event')
1919
.setDescription('Add an event to the calendar.')
2020
.addStringOption((option: SlashCommandStringOption) => option
2121
.setName('url')
22-
.setDescription('The url of the event.')
22+
.setDescription('🔗 url of the event')
2323
.setRequired(true),
2424
)
2525
.addStringOption((option: SlashCommandStringOption) => option
2626
.setName('type')
27-
.setDescription('The type of the event.')
27+
.setDescription('🧑‍💻 type of the event')
2828
.setRequired(true)
2929
.addChoices(
3030
// TODO: Find a way to make this dynamic
@@ -37,27 +37,27 @@ export const addEvent: Command = new Command(
3737
)
3838
.addStringOption((option: SlashCommandStringOption) => option
3939
.setName('start_time')
40-
.setDescription('The start date/time of the event. (Format: YYYY-MM-DD HH:mm)')
40+
.setDescription('🕑 start timestamp of the event 📢 Format: YYYY-MM-DD HH:mm')
4141
.setRequired(true),
4242
)
4343
.addStringOption((option: SlashCommandStringOption) => option
4444
.setName('end_time')
45-
.setDescription('The end date/time of the event. (Format: YYYY-MM-DD HH:mm)')
45+
.setDescription('🕝 end timestamp of the event 📢 Format: YYYY-MM-DD HH:mm')
4646
.setRequired(true),
4747
)
4848
.addStringOption((option: SlashCommandStringOption) => option
4949
.setName('location')
50-
.setDescription('The location of the event. (Default: Online)')
50+
.setDescription('📍 location of the event (Default: Online)')
5151
.setRequired(false),
5252
)
5353
.addStringOption((option: SlashCommandStringOption) => option
5454
.setName('title')
55-
.setDescription('Add a title to the event. (By default, the title is retrieved from the url.)')
55+
.setDescription('name of the event (By default, the title is retrieved from the url)')
5656
.setRequired(false),
5757
)
5858
.addBooleanOption((option: SlashCommandBooleanOption) => option
5959
.setName('free')
60-
.setDescription('Whether the event is free or not. (Default: Free)')
60+
.setDescription('free or not? (Default: Free)')
6161
.setRequired(false),
6262
) as SlashCommandBuilder,
6363

@@ -153,7 +153,7 @@ export const addEvent: Command = new Command(
153153
.addComponents(confirmButton, cancelButton);
154154

155155
const response: Message<boolean> = await interaction.editReply(
156-
{ embeds: [embed], components: [row] },
156+
{ content: 'Confirm your choice', embeds: [embed], components: [row] },
157157
);
158158

159159
const buttonCollectorFilter: CollectorFilter<any> = (i: any) => {
@@ -186,7 +186,8 @@ export const addEvent: Command = new Command(
186186
};
187187

188188
// Create a collector until the start date of the event
189-
const collector: ReactionCollector = message.createReactionCollector({ filter: reactionCollectorFilter, time: eventStartDate.diff(dayjs()) });
189+
const timer = (eventStartDate.diff(dayjs()) < 2147483647) ? eventStartDate.diff(dayjs()) : undefined;
190+
const collector: ReactionCollector = message.createReactionCollector({ filter: reactionCollectorFilter, time: timer });
190191

191192
collector.on('collect', async (reaction, user) => {
192193
if (reaction.emoji.name === '✅') {

src/commands/util/status.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@ export const status: Command = new Command(
1212
embeds: [new StatusEmbed(interaction.client as CustomClient, getServerStatus())],
1313
ephemeral: true,
1414
});
15-
16-
// const channel = interaction.channel;
17-
// console.log(channel?.threads);
1815
},
1916
);

0 commit comments

Comments
 (0)