gistfile1.txt
· 3.0 KiB · Text
Brut
// ── slot ───────────────────────────────────────────────────────────────────
if (group === "slot") {
if (sub === "add") {
const hour = interaction.options.getInteger("hour", true);
const pollOpens = interaction.options.getString("poll_opens", true);
const slots = Config.get({ section: "poll", key: "slots" });
if (slots.some((s) => s.tgHour === hour)) return void replyAndDelete(interaction, `❌ Slot ${hour}:00 already exists.`);
slots.push({ tgHour: hour, pollOpens, closesAfter: Config.get({ section: "tg", key: "durationMinutes" }), active: true });
Config.set({ section: "poll", key: "slots", value: slots });
return void replyAndDelete(interaction, `✅ Slot ${hour}:00 added (poll opens at ${pollOpens}).`);
}
if (sub === "remove") {
const hour = interaction.options.getInteger("hour", true);
const slots = Config.get({ section: "poll", key: "slots" }).filter((s) => s.tgHour !== hour);
Config.set({ section: "poll", key: "slots", value: slots });
return void replyAndDelete(interaction, `✅ Slot ${hour}:00 removed.`);
}
}
// ── wrank ──────────────────────────────────────────────────────────────────
if (group === "wrank") {
if (sub === "set-goal") { setCfg("wRankGoal", interaction.options.getInteger("goal", true)); return void replyAndDelete(interaction, "✅ W.Rank goal updated."); }
if (sub === "set-post-on-reset") { setCfg("wRankPostOnReset", interaction.options.getBoolean("enabled", true)); return void replyAndDelete(interaction, "✅ W.Rank post on reset updated."); }
}
// ── tg ─────────────────────────────────────────────────────────────────────
if (group === "tg") {
if (sub === "set-score-window") { setCfg("scoreWindowHours", interaction.options.getNumber("hours", true)); return void replyAndDelete(interaction, "✅ Score window updated."); }
if (sub === "set-duration") { setCfg("tgDurationMinutes", interaction.options.getInteger("minutes", true)); return void replyAndDelete(interaction, "✅ TG duration updated."); }
if (sub === "set-no-display") { setCfg("showNoInNationField" as any, interaction.options.getString("mode", true) === "inline"); return void replyAndDelete(interaction, "✅ No voter display updated."); }
if (sub === "set-nation-source"){ setCfg("nationSource", interaction.options.getString("nation", true) as Nation); return void replyAndDelete(interaction, "✅ Nation source updated."); }
}
if (group === "poll") {
if (sub === "set-layout") return handleSetLayout(interaction);
}
}
| 1 | // ── slot ─────────────────────────────────────────────────────────────────── |
| 2 | if (group === "slot") { |
| 3 | if (sub === "add") { |
| 4 | const hour = interaction.options.getInteger("hour", true); |
| 5 | const pollOpens = interaction.options.getString("poll_opens", true); |
| 6 | const slots = Config.get({ section: "poll", key: "slots" }); |
| 7 | if (slots.some((s) => s.tgHour === hour)) return void replyAndDelete(interaction, `❌ Slot ${hour}:00 already exists.`); |
| 8 | slots.push({ tgHour: hour, pollOpens, closesAfter: Config.get({ section: "tg", key: "durationMinutes" }), active: true }); |
| 9 | Config.set({ section: "poll", key: "slots", value: slots }); |
| 10 | return void replyAndDelete(interaction, `✅ Slot ${hour}:00 added (poll opens at ${pollOpens}).`); |
| 11 | } |
| 12 | if (sub === "remove") { |
| 13 | const hour = interaction.options.getInteger("hour", true); |
| 14 | const slots = Config.get({ section: "poll", key: "slots" }).filter((s) => s.tgHour !== hour); |
| 15 | Config.set({ section: "poll", key: "slots", value: slots }); |
| 16 | return void replyAndDelete(interaction, `✅ Slot ${hour}:00 removed.`); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // ── wrank ────────────────────────────────────────────────────────────────── |
| 21 | if (group === "wrank") { |
| 22 | if (sub === "set-goal") { setCfg("wRankGoal", interaction.options.getInteger("goal", true)); return void replyAndDelete(interaction, "✅ W.Rank goal updated."); } |
| 23 | if (sub === "set-post-on-reset") { setCfg("wRankPostOnReset", interaction.options.getBoolean("enabled", true)); return void replyAndDelete(interaction, "✅ W.Rank post on reset updated."); } |
| 24 | } |
| 25 | |
| 26 | // ── tg ───────────────────────────────────────────────────────────────────── |
| 27 | if (group === "tg") { |
| 28 | if (sub === "set-score-window") { setCfg("scoreWindowHours", interaction.options.getNumber("hours", true)); return void replyAndDelete(interaction, "✅ Score window updated."); } |
| 29 | if (sub === "set-duration") { setCfg("tgDurationMinutes", interaction.options.getInteger("minutes", true)); return void replyAndDelete(interaction, "✅ TG duration updated."); } |
| 30 | if (sub === "set-no-display") { setCfg("showNoInNationField" as any, interaction.options.getString("mode", true) === "inline"); return void replyAndDelete(interaction, "✅ No voter display updated."); } |
| 31 | if (sub === "set-nation-source"){ setCfg("nationSource", interaction.options.getString("nation", true) as Nation); return void replyAndDelete(interaction, "✅ Nation source updated."); } |
| 32 | } |
| 33 | |
| 34 | if (group === "poll") { |
| 35 | if (sub === "set-layout") return handleSetLayout(interaction); |
| 36 | } |
| 37 | } |