Skip to content

Commit c4fa467

Browse files
refactor: rename muted role
1 parent 10c037d commit c4fa467

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/modules/quoiFeur/quoiFeur.helpers.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { cache } from '../../core/cache';
1111
import { removeEmoji, removePunctuation } from '../../helpers/regex.helper';
1212

1313
const ONE_MINUTE = 1 * 60 * 1000;
14-
const MUTED_BY_BOT = 'Muted by bot';
14+
const MUTED_ON_COUBEH = 'Muted on Coubeh';
1515

1616
const quoiDetectorRegex = /\bquoi\s*$/i;
1717
const endWithQuoi = (text: string) => quoiDetectorRegex.test(removeEmoji(removePunctuation(text)));
@@ -32,7 +32,7 @@ const reactWithCoubeh = async (message: Message) => {
3232
await message.react('🇭');
3333
await message.react('🔇');
3434

35-
const mutedRole = message.guild?.roles.cache.find((r) => r.name === MUTED_BY_BOT);
35+
const mutedRole = message.guild?.roles.cache.find((r) => r.name === MUTED_ON_COUBEH);
3636

3737
if (!mutedRole?.id) return;
3838

@@ -59,24 +59,24 @@ export const reactOnEndWithQuoi = async (message: Message) => {
5959
}
6060
};
6161

62-
export const createRoleMutedByBot = async (guild: Guild | null): Promise<Role> => {
62+
export const createRoleMutedOnCoubeh = async (guild: Guild | null): Promise<Role> => {
6363
if (!guild) {
6464
throw new Error('Guild is null in createRoleMutedByBot');
6565
}
66-
const existingMutedByBot = guild.roles.cache.find((role) => role.name === MUTED_BY_BOT);
66+
const existingMutedByBot = guild.roles.cache.find((role) => role.name === MUTED_ON_COUBEH);
6767

6868
return (
6969
existingMutedByBot ??
7070
guild.roles.create({
71-
name: MUTED_BY_BOT,
71+
name: MUTED_ON_COUBEH,
7272
})
7373
);
7474
};
7575

76-
export const deleteRoleMutedByBot = async (client: Client<true>): Promise<void> => {
76+
export const deleteRoleMutedOnCoubeh = async (client: Client<true>): Promise<void> => {
7777
const guilds = await client.guilds.fetch().then((guilds) => guilds.map((guild) => guild.fetch()));
7878
const roles = await Promise.all(guilds).then((guilds) =>
79-
guilds.map((guild) => guild.roles.cache.find((role) => role.name === MUTED_BY_BOT)),
79+
guilds.map((guild) => guild.roles.cache.find((role) => role.name === MUTED_ON_COUBEH)),
8080
);
8181

8282
for (const role of roles) {
@@ -95,7 +95,7 @@ export const addQuoiFeurToChannel = async (interaction: ChatInputCommandInteract
9595
return;
9696
}
9797

98-
const role = await createRoleMutedByBot(interaction.guild);
98+
const role = await createRoleMutedOnCoubeh(interaction.guild);
9999
await channel.permissionOverwrites.create(role, {
100100
SendMessages: false,
101101
CreatePublicThreads: false,
@@ -118,7 +118,7 @@ export const removeQuoiFeurFromChannel = async (interaction: ChatInputCommandInt
118118
return;
119119
}
120120

121-
const role = interaction.guild?.roles.cache.find((r) => r.name === MUTED_BY_BOT);
121+
const role = interaction.guild?.roles.cache.find((r) => r.name === MUTED_ON_COUBEH);
122122
if (role) {
123123
await channel.permissionOverwrites.delete(role);
124124
}

src/modules/quoiFeur/quoiFeur.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SlashCommandBuilder } from 'discord.js';
33
import type { BotModule } from '../../types/bot';
44
import {
55
addQuoiFeurToChannel,
6-
deleteRoleMutedByBot,
6+
deleteRoleMutedOnCoubeh,
77
reactOnEndWithQuoi,
88
removeQuoiFeurFromChannel,
99
} from './quoiFeur.helpers';
@@ -29,7 +29,7 @@ export const quoiFeur: BotModule = {
2929
],
3030
eventHandlers: {
3131
// unmute everyone in every server on bot restart
32-
ready: deleteRoleMutedByBot,
32+
ready: deleteRoleMutedOnCoubeh,
3333
messageCreate: reactOnEndWithQuoi,
3434
},
3535
};

0 commit comments

Comments
 (0)