When a game bot posts a message that says a member has to wait N minutes before playing again, DM that member when the wait is over, and let members turn those DMs off with /remindme off
Watches for cooldown messages from game bots (like "wait 5 minutes") and sends you a DM when the cooldown is over, so you don't have to set timers yourself. Toggle reminders on/off with /remindme.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
⏰ Your cooldown with Dank Memer has expired — you can play again!
// Game cooldown reminder system — detects when game bots tell members to wait,
// then DMs them when the cooldown is over.
/** Whether a call was refused because the member has left the server. */
function hasLeft(err: unknown): boolean {
return String(err).includes('is not in this server');
}
// Toggle command: members can opt in/out of reminders
mee6.command(
'remindme',
{
description: 'Toggle cooldown reminder DMs on/off',
options: [
{
name: 'enabled',
type: 'string',
description: 'Turn reminders on or off',
required: true,
choices: [
{ name: 'On', value: 'on' },
{ name: 'Off', value: 'off' },
],
},
],
ephemeral: true,
},
async (ctx) => {
const enabled = ctx.option<string>('enabled') === 'on';
const m = mee6.store.member(ctx.author.id);
await m.set('reminders_enabled', enabled);
await ctx.reply(
enabled
? '✅ Cooldown reminders are now **on** — I will DM you when your game cooldowns expire.'
: '🔕 Cooldown reminders are now **off**.'
);
}
);
// Listen to other bots' messages for cooldown announcements: only the ones
// with one of these wordings wake the module, the patterns below read the delay
mee6.on('bot_message', { contains: ['wait ', 'cooldown', 'try again in ', 'available in '] }, async (ctx) => {
const content = ctx.message.content.toLowerCase();
const userId = extractMentionedUser(content, ctx.message.mentions);
// Look for patterns like "wait X minutes/hours/seconds" or "cooldown: X minutes"
const cooldownMatch =
content.match(/wait (\d+)\s*(second|minute|hour|min|sec|hr)s?/i) ||
content.match(/cooldown:?\s*(\d+)\s*(second|minute|hour|min|sec|hr)s?/i) ||
content.match(/try again in (\d+)\s*(second|minute|hour|min|sec|hr)s?/i) ||
content.match(/available in (\d+)\s*(second|minute|hour|min|sec|hr)s?/i);
if (!cooldownMatch || !userId) return;
// Check if this member wants reminders
const m = mee6.store.member(userId);
const enabled = await m.get<boolean>('reminders_enabled', true); // default: on
if (!enabled) return;
// Parse the cooldown duration
const amount = parseInt(cooldownMatch[1], 10);
const unit = cooldownMatch[2].toLowerCase();
let seconds = amount;
if (unit.startsWith('min')) seconds = amount * 60;
else if (unit.startsWith('hour') || unit.startsWith('hr')) seconds = amount * 3600;
// Schedule must be at least 30 seconds
if (seconds < 30) return;
// Cap at 24 hours to avoid extremely long schedules
if (seconds > 86400) return;
// Schedule the reminder (key per user so they don't overwrite each other)
await mee6.schedule.once(`cooldown_${userId}_${Date.now()}`, seconds, {
userId,
botName: ctx.author.username,
});
});
// When the schedule fires, DM the member
mee6.on('scheduled', async (ctx) => {
if (!ctx.scheduleKey.startsWith('cooldown_')) return;
const p = ctx.payload as { userId: string; botName: string } | null;
if (!p) return;
let delivered: boolean;
try {
delivered = await mee6.dm(p.userId, `⏰ Your cooldown with **${p.botName}** has expired — you can play again!`);
} catch (err) {
// Nobody to remind: the member has left the server
if (!hasLeft(err)) throw err;
return;
}
if (!delivered) {
mee6.log(`Could not DM ${p.userId} — DMs are closed`);
}
});
/**
* Extract the user ID being told to wait — could be mentioned in the message,
* or could be the person who just triggered the bot (harder to detect).
*/
function extractMentionedUser(content: string, mentions: { users: string[] }): string | null {
// If the message mentions exactly one user, assume it's them
if (mentions.users.length === 1) return mentions.users[0];
// Otherwise, look for a user ID pattern in the text
const match = content.match(/<@!?(\d+)>/);
return match ? match[1] : null;
}