move to constants
This commit is contained in:
parent
8bcdddccae
commit
f4252d57a3
2 changed files with 12 additions and 10 deletions
|
@ -24,3 +24,11 @@ export const COLORS = {
|
||||||
yellow: 0xfde047,
|
yellow: 0xfde047,
|
||||||
orange: 0xfb923c,
|
orange: 0xfb923c,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const ALLOWED_ROLES = [
|
||||||
|
'Alert',
|
||||||
|
'Events',
|
||||||
|
'Progress',
|
||||||
|
'Lenny is very special and thinks the UK needs a role',
|
||||||
|
'Roly Poly Cult',
|
||||||
|
];
|
||||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -39,14 +39,6 @@ const client = new Client({
|
||||||
partials: [Partials.Channel],
|
partials: [Partials.Channel],
|
||||||
});
|
});
|
||||||
|
|
||||||
const allowedRoles = [
|
|
||||||
'Alert',
|
|
||||||
'Events',
|
|
||||||
'Progress',
|
|
||||||
'Lenny is very special and thinks the UK needs a role',
|
|
||||||
'Roly Poly Cult',
|
|
||||||
];
|
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
console.log(green('Discord bot ready!'));
|
console.log(green('Discord bot ready!'));
|
||||||
|
|
||||||
|
@ -140,7 +132,9 @@ client.on('interactionCreate', async (interaction) => {
|
||||||
|
|
||||||
const roles = await interaction.guild.roles
|
const roles = await interaction.guild.roles
|
||||||
.fetch()
|
.fetch()
|
||||||
.then((a) => a.filter((b) => allowedRoles.includes(b.name)));
|
.then((a) =>
|
||||||
|
a.filter((b) => BuildConfig.ALLOWED_ROLES.includes(b.name))
|
||||||
|
);
|
||||||
|
|
||||||
const row = new ActionRowBuilder<SelectMenuBuilder>().addComponents(
|
const row = new ActionRowBuilder<SelectMenuBuilder>().addComponents(
|
||||||
new SelectMenuBuilder()
|
new SelectMenuBuilder()
|
||||||
|
@ -175,7 +169,7 @@ client.on('interactionCreate', async (interaction) => {
|
||||||
|
|
||||||
const roleManager = interaction.member.roles as GuildMemberRoleManager;
|
const roleManager = interaction.member.roles as GuildMemberRoleManager;
|
||||||
|
|
||||||
for (const role of allowedRoles) {
|
for (const role of BuildConfig.ALLOWED_ROLES) {
|
||||||
const roleID = interaction.guild.roles.cache
|
const roleID = interaction.guild.roles.cache
|
||||||
.find((a) => a.name === role)
|
.find((a) => a.name === role)
|
||||||
?.id.toString();
|
?.id.toString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue