async function getMember(client, userId) {
	const guild = client.guilds.cache.get(process.env.D_GuildID);
	if (!guild) return null;

	// cache first (fast path)
	let member = guild.members.cache.get(userId);

	// fallback (safe path)
	if (!member) {
		member = await guild.members.fetch(userId).catch(() => null);
	}

	return member;
}

module.exports = {
	name: 'timer24h',

	async execute(timer, client) {
		const member = await getMember(client, timer.assignedUser);
		if (!member) return;

		await member.send(
			`⚠️ Less than 24 hours remaining for: **${timer.topic}**`
		).catch(() => {});
	}
};