nuno 已修改 3 weeks ago. 還原成這個修訂版本
1 file changed, 37 insertions
gistfile1.txt(檔案已創建)
| @@ -0,0 +1,37 @@ | |||
| 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 | + | } | |
上一頁
下一頁