Implement limbomode command

This commit is contained in:
2026-08-22 18:22:27 -04:00
parent 20465abcaa
commit a744a95307
2 changed files with 21 additions and 2 deletions
+11
View File
@@ -1,10 +1,21 @@
import type { Message } from "discord.js";
import type { Command } from "../../models";
import RoleService from "../../services/role";
export default {
name: "limbomode",
description: "Toggles on/off limbo mode. When limbo mode is on, new members will be placed in #limbo. When off, new members will be placed in #chat-and-shitpost.",
usage: ".limbomode [on|off]",
execute: async (message: Message) => {
const ogState = RoleService.limboMode;
if (message.content.includes("on"))
RoleService.limboMode = true;
else if (message.content.includes("off"))
RoleService.limboMode = false;
else
RoleService.limboMode = !RoleService.limboMode;
await message.reply(`limbomode: *${ogState}* -> **${RoleService.limboMode}**`);
}
} satisfies Command;
+10 -2
View File
@@ -1,7 +1,7 @@
import type { Guild, GuildMember, Collection, RoleCreateOptions } from "discord.js";
export default abstract class RoleService {
static readonly ROLES: Record<string, RoleCreateOptions> = {
static readonly ROLES = {
// Main
"ROBOT": {
name: "robot",
@@ -47,10 +47,12 @@ export default abstract class RoleService {
"LIMBO": {
name: "limbo",
}
};
} satisfies Record<string, RoleCreateOptions>;
static readonly STARTER_ROLES = [RoleService.ROLES["LURKER"], RoleService.ROLES["NEWFAG"]];
public static limboMode = false;
static validate(guilds: Collection<string, Guild>): void {
guilds.forEach(guild => {
const missing = Object.values(RoleService.ROLES).filter(role => !this.getRoleByName(guild, role.name));
@@ -83,6 +85,12 @@ export default abstract class RoleService {
console.error(`Failed to add starter role: ${role.name}`, err);
}
}
if (this.limboMode) {
const limboRole = this.getRoleByName(guildMember.guild, this.ROLES["LIMBO"].name)
if (!limboRole) return;
await guildMember.roles.add(limboRole);
}
}
static getRoleByName(guild: Guild, roleName?: string) {