import { QuickDB } from "quick.db";

export const name = "resetpoints";
export const description = "إعادة تعيين نقاط عضو (أدمن فقط)";

const db = new QuickDB();

export async function execute(message, args, ctx) {
  const config = ctx.config;
  if (!message.member.roles.cache.some(r => (config.adminRoles || []).includes(r.id))) {
    return message.reply("❌ معندكش صلاحية.");
  }

  const member = message.mentions.members.first();
  if (!member) return message.reply("❗ منشن العضو.");

  const key = `points_${message.guild.id}_${member.id}`;
  await db.delete(key);

  // delete legacy points too (optional)
  await db.delete(`points_${member.id}`).catch(() => {});

  message.reply(`🔁 تم تصفير النقاط للعضو ${member.user.tag}`);
}
