Finish roleinit command
This commit is contained in:
+4
-10
@@ -8,52 +8,44 @@ export default abstract class RoleService {
|
||||
colors: { primaryColor: "#58a9df" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 1,
|
||||
},
|
||||
"FEMOID": {
|
||||
name: "femoid",
|
||||
colors: { primaryColor: "#ffb2f4" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 2,
|
||||
},
|
||||
"NORMALFAG": {
|
||||
name: "normalfag",
|
||||
colors: { primaryColor: "#e26254" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 3,
|
||||
},
|
||||
"GAY": {
|
||||
name: "gay",
|
||||
colors: { primaryColor: "#71368a" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 4,
|
||||
},
|
||||
"TROID": {
|
||||
name: "troid",
|
||||
colors: { primaryColor: "#992d22" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 5,
|
||||
},
|
||||
"LURKER": {
|
||||
name: "lurker",
|
||||
colors: { primaryColor: "#546e7a" },
|
||||
hoist: true,
|
||||
mentionable: true,
|
||||
position: 6,
|
||||
},
|
||||
// Utility
|
||||
"NEWFAG": {
|
||||
name: "newfag",
|
||||
mentionable: true,
|
||||
position: 7,
|
||||
},
|
||||
"LIMBO": {
|
||||
name: "limbo",
|
||||
position: 8,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,10 +58,12 @@ export default abstract class RoleService {
|
||||
});
|
||||
}
|
||||
|
||||
static async createRoles(guild: Guild, roles: RoleCreateOptions[]) {
|
||||
static async createRolesIfNotExist(guild: Guild, roles: RoleCreateOptions[]) {
|
||||
for (const role of roles) {
|
||||
try {
|
||||
await guild.roles.create(role);
|
||||
if (!this.getRoleByName(guild, role.name)) {
|
||||
await guild.roles.create(role);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error(`Failed to create role: ${role.name}`, err);
|
||||
|
||||
Reference in New Issue
Block a user