Add /event create with a title, a date and time and an optional weekly repeat, which posts one Components V2 card in a channel I choose, updated in place: a heading with the title, the date and a countdown, a separator, who is Going, Maybe and Can\'t with counts, and the Going, Maybe and Can\'t buttons inside the card; it closes once the event has taken place. It pings the Going members 15 minutes before, and /event list shows what is coming
Schedule events with live RSVP tracking and automatic reminders.
Commands:
/event create โ Create a new event with title, date/time, and optional weekly repeat/event list โ See all upcoming eventsFeatures:
Setup: Set the event announcements channel in settings.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
~~Tuesday, September 15, 2026, 07:00 PM~~ โ this event has taken place.
โ Going (3) @Alex, @Jordan, @Sam
๐ค Maybe (0) Nobody yet
โ Can't Make It (0) Nobody yet
Event ID: evt_1789371695236_lfs1utmnh
โฐ Reminder: @Alex @Jordan @Sam Game Night starts in 15 minutes!
// Event Scheduler: create events with RSVPs and automated reminders
interface Event {
id: string;
title: string;
timestamp: number; // Unix seconds
weekly: boolean;
channelId: string;
messageId: string;
going: string[]; // user IDs
maybe: string[];
cant: string[];
}
mee6.settings({
event_channel: {
type: 'channel',
label: 'Event announcements channel',
required: true,
sample: 'events',
},
});
// Parse a date/time string into Unix timestamp
function parseDateTime(dateStr: string): number | null {
// Try ISO format first (2024-01-15 14:30, 2024-01-15T14:30)
const iso = Date.parse(dateStr.replace(' ', 'T'));
if (!isNaN(iso)) return Math.floor(iso / 1000);
// Try relative formats like "tomorrow 3pm", "next friday 7pm"
const now = new Date();
const lower = dateStr.toLowerCase().trim();
// Match patterns like "tomorrow", "next monday", etc.
let targetDate = new Date(now);
if (lower.includes('tomorrow')) {
targetDate.setDate(targetDate.getDate() + 1);
} else if (lower.includes('next')) {
const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
for (let i = 0; i < days.length; i++) {
if (lower.includes(days[i])) {
const currentDay = targetDate.getDay();
const targetDay = i;
let daysToAdd = targetDay - currentDay;
if (daysToAdd <= 0) daysToAdd += 7;
targetDate.setDate(targetDate.getDate() + daysToAdd);
break;
}
}
}
// Extract time (3pm, 14:30, etc.)
const timeMatch = lower.match(/(\d{1,2})(?::(\d{2}))?\s*(am|pm)?/);
if (timeMatch) {
let hours = parseInt(timeMatch[1]);
const minutes = timeMatch[2] ? parseInt(timeMatch[2]) : 0;
const period = timeMatch[3];
if (period === 'pm' && hours < 12) hours += 12;
if (period === 'am' && hours === 12) hours = 0;
targetDate.setHours(hours, minutes, 0, 0);
return Math.floor(targetDate.getTime() / 1000);
}
return null;
}
// Format timestamp for display
function formatTime(timestamp: number): string {
const date = new Date(timestamp * 1000);
return `<t:${timestamp}:F>`;
}
const BLURPLE = 0x5865f2;
const GREY = 0x747f8d;
// Mentions shown per answer: the card holds 4000 characters in all
const MAX_SHOWN = 40;
/** Who answered one way: a count and their mentions */
function rsvpText(label: string, ids: string[]): string {
const shown = ids.slice(0, MAX_SHOWN).map((id) => `<@${id}>`);
if (ids.length > MAX_SHOWN) shown.push(`and ${ids.length - MAX_SHOWN} more`);
return `**${label} (${ids.length})**\n${shown.join(', ') || '_Nobody yet_'}`;
}
/** The RSVP buttons โ the same ids as on every event already posted */
function rsvpButtons(eventId: string): LayoutBlock {
return {
type: 'buttons',
buttons: [
{ label: 'Going', customId: `rsvp_${eventId}_going`, style: 'success' },
{ label: 'Maybe', customId: `rsvp_${eventId}_maybe`, style: 'primary' },
{ label: "Can't", customId: `rsvp_${eventId}_cant`, style: 'secondary' },
],
};
}
// The event card: one Components V2 message, rewritten after every RSVP
function eventCard(event: Event, status: 'open' | 'over' = 'open'): MessagePayload {
const when =
status === 'over'
? `~~${formatTime(event.timestamp)}~~ โ this event has taken place.`
: `๐๏ธ ${formatTime(event.timestamp)} ยท <t:${event.timestamp}:R>${event.weekly ? '\n๐ _Repeats weekly_' : ''}`;
const blocks: LayoutBlock[] = [
{ type: 'text', text: `## ๐
${event.title}\n${when}` },
{ type: 'separator' },
{
type: 'text',
text: [
rsvpText('โ
Going', event.going),
rsvpText('๐ค Maybe', event.maybe),
rsvpText("โ Can't Make It", event.cant),
].join('\n\n'),
},
{ type: 'text', text: `-# Event ID: ${event.id}` },
];
if (status === 'open') blocks.push(rsvpButtons(event.id));
return { layout: [{ type: 'container', color: status === 'open' ? BLURPLE : GREY, blocks }] };
}
/** Close a past occurrence's card: its buttons go (the message may be gone) */
async function closeCard(event: Event): Promise<void> {
if (!event.messageId) return;
await mee6.editMessage(event.channelId, event.messageId, eventCard(event, 'over')).catch(() => {});
}
mee6.command(
'event create',
{
description: 'Create a new event with RSVPs',
options: [
{ name: 'title', type: 'string', description: 'Event name', required: true },
{
name: 'datetime',
type: 'string',
description: 'When (e.g. "2024-12-25 18:00", "tomorrow 7pm")',
required: true,
},
{ name: 'weekly', type: 'boolean', description: 'Repeat every week?' },
],
},
async (ctx) => {
const channelId = ctx.settings.event_channel;
if (!channelId) {
await ctx.reply('An admin needs to set the event channel in the dashboard first.');
return;
}
const title = ctx.option<string>('title');
const dateStr = ctx.option<string>('datetime');
const weekly = ctx.option<boolean>('weekly', false);
const timestamp = parseDateTime(dateStr);
if (!timestamp) {
await ctx.reply('Could not parse that date/time. Try formats like "2024-12-25 18:00" or "tomorrow 7pm".');
return;
}
const now = Math.floor(Date.now() / 1000);
if (timestamp < now + 60) {
await ctx.reply('Event time must be at least 1 minute in the future.');
return;
}
// Create event
const eventId = `evt_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
const event: Event = {
id: eventId,
title,
timestamp,
weekly,
channelId,
messageId: '',
going: [],
maybe: [],
cant: [],
};
// Post the event
const sent = await ctx.send(channelId, eventCard(event));
event.messageId = sent.messageId;
await mee6.store.set(`event_${eventId}`, event);
// Schedule reminder 15 minutes before
const reminderTime = timestamp - 900; // 15 minutes = 900 seconds
if (reminderTime > now + 30) {
await mee6.schedule.once(`remind_${eventId}`, reminderTime - now, {
eventId,
channelId,
});
}
// Schedule the event itself (to handle weekly repeats)
await mee6.schedule.once(`event_${eventId}`, timestamp - now, {
eventId,
weekly,
});
await ctx.reply({ content: `โ
Event created! Check <#${channelId}>`, ephemeral: true });
}
);
mee6.command(
'event list',
{
description: 'Show upcoming events',
},
async (ctx) => {
const keys = await mee6.store.keys();
const eventKeys = keys.filter((k) => k.startsWith('event_evt_'));
if (eventKeys.length === 0) {
await ctx.reply('No upcoming events.');
return;
}
const events: Event[] = [];
for (const key of eventKeys) {
const event = await mee6.store.get<Event>(key);
if (event) events.push(event);
}
// Sort by timestamp
events.sort((a, b) => a.timestamp - b.timestamp);
const now = Math.floor(Date.now() / 1000);
const upcoming = events.filter((e) => e.timestamp > now || e.weekly);
if (upcoming.length === 0) {
await ctx.reply('No upcoming events.');
return;
}
const lines = upcoming.slice(0, 10).map((e) => {
const attendees = e.going.length + e.maybe.length;
const repeat = e.weekly ? ' ๐' : '';
return `โข **${e.title}**${repeat} โ ${formatTime(e.timestamp)} (${attendees} interested)`;
});
await ctx.reply({
layout: [
{
type: 'container',
color: BLURPLE,
blocks: [
{ type: 'text', text: '## ๐
Upcoming Events' },
{ type: 'separator' },
{ type: 'text', text: lines.join('\n') },
],
},
],
});
}
);
// Handle RSVP button clicks
mee6.on('button', async (ctx) => {
if (!ctx.customId.startsWith('rsvp_')) return;
const parts = ctx.customId.split('_');
const eventId = parts.slice(1, -1).join('_');
const response = parts[parts.length - 1] as 'going' | 'maybe' | 'cant';
const event = await mee6.store.get<Event>(`event_${eventId}`);
if (!event) {
await ctx.reply({ content: 'This event no longer exists.', ephemeral: true });
return;
}
const userId = ctx.author.id;
// Remove from all lists first
event.going = event.going.filter((id) => id !== userId);
event.maybe = event.maybe.filter((id) => id !== userId);
event.cant = event.cant.filter((id) => id !== userId);
// Add to the selected list
event[response].push(userId);
// Update storage and message
await mee6.store.set(`event_${eventId}`, event);
await ctx.editOriginal(eventCard(event));
const labels = { going: 'โ
Going', maybe: '๐ค Maybe', cant: "โ Can't make it" };
await ctx.reply({ content: `${labels[response]} to **${event.title}**`, ephemeral: true });
});
// Handle scheduled reminders and events
mee6.on('scheduled', async (ctx) => {
if (ctx.scheduleKey.startsWith('remind_')) {
const eventId = ctx.scheduleKey.replace('remind_', '');
const event = await mee6.store.get<Event>(`event_${eventId}`);
if (event && event.going.length > 0) {
const mentions = event.going.map((id) => `<@${id}>`).join(' ');
await ctx.send(event.channelId, {
content: `โฐ **Reminder:** ${mentions}\n**${event.title}** starts in 15 minutes!`,
});
}
} else if (ctx.scheduleKey.startsWith('event_')) {
const eventId = ctx.scheduleKey.replace('event_', '');
const event = await mee6.store.get<Event>(`event_${eventId}`);
if (event && event.weekly) {
// This week's card closes; next week's gets a fresh one
await closeCard(event);
// Schedule next week's occurrence
const nextTimestamp = event.timestamp + 604800; // +7 days
event.timestamp = nextTimestamp;
// Reset RSVPs for the new week
event.going = [];
event.maybe = [];
event.cant = [];
// Post new event message
const sent = await ctx.send(event.channelId, eventCard(event));
event.messageId = sent.messageId;
await mee6.store.set(`event_${eventId}`, event);
// Schedule next reminder and event
const now = Math.floor(Date.now() / 1000);
const reminderTime = nextTimestamp - 900;
if (reminderTime > now + 30) {
await mee6.schedule.once(`remind_${eventId}`, reminderTime - now, {
eventId,
channelId: event.channelId,
});
}
await mee6.schedule.once(`event_${eventId}`, nextTimestamp - now, {
eventId,
weekly: true,
});
} else if (event) {
// One-time event finished: close its card, clean up
await closeCard(event);
await mee6.store.delete(`event_${eventId}`);
}
}
});