Implement limbomode command
This commit is contained in:
+10
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user