fix: fix/archive
#56
2 changed files with 11 additions and 13 deletions
|
@ -1,8 +1,8 @@
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
import { ChannelType, Client, CommandInteraction, EmbedBuilder } from 'discord.js';
|
import { ChannelType, Client, CommandInteraction, EmbedBuilder } from 'discord.js';
|
||||||
|
import '../../modules/string';
|
||||||
import { getLocale, getLocalizations } from '../../utils/locales';
|
import { getLocale, getLocalizations } from '../../utils/locales';
|
||||||
import { getFilename } from '../../utils/misc';
|
import { getFilename } from '../../utils/misc';
|
||||||
import '../../modules/string';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: (client: Client) => {
|
data: (client: Client) => {
|
||||||
|
@ -52,10 +52,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a category is specified
|
// If a category is specified
|
||||||
const clean_cat = ['L1', 'L2', 'L3', 'M1', 'M2'];
|
const allowedCategories = ['L1', 'L2', 'L3', 'M1', 'M2'];
|
||||||
const channel = clean_cat.includes(desired_cat);
|
const channel = allowedCategories.includes(desired_cat);
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
// Category doesn't exist or is not included
|
// Category doesn't exist or is not allowed
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${loc.get('c_prep3')} \`${desired_cat}\``,
|
content: `${loc.get('c_prep3')} \`${desired_cat}\``,
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
|
@ -65,13 +65,13 @@ export default {
|
||||||
// Send information about the command
|
// Send information about the command
|
||||||
const allChannel = interaction.guild?.channels.fetch();
|
const allChannel = interaction.guild?.channels.fetch();
|
||||||
allChannel?.then(channel_guild => {
|
allChannel?.then(channel_guild => {
|
||||||
const cat_to_prep = channel_guild.filter(chan => chan.type == ChannelType.GuildCategory).filter(chan => chan.name == desired_cat);
|
const cat_to_prep = channel_guild.filter(chan => chan?.type == ChannelType.GuildCategory).filter(chan => chan?.name == desired_cat);
|
||||||
const cat_to_prep_id = cat_to_prep.map(cat => cat.id);
|
const cat_to_prep_id = cat_to_prep.map(cat => cat?.id);
|
||||||
const cat_to_prep_name = cat_to_prep.map(cat => cat.name);
|
const cat_to_prep_name = cat_to_prep.map(cat => cat?.name);
|
||||||
|
|
||||||
// console.log(cat_to_prep);
|
// console.log(cat_to_prep);
|
||||||
const all_channel_desired = channel_guild.filter(chan => chan.type == 0).filter(chan => chan.parentId == cat_to_prep_id[0]);
|
const all_channel_desired = channel_guild.filter(chan => chan?.type == 0).filter(chan => chan?.parentId == cat_to_prep_id[0]);
|
||||||
const all_channel_desired_name = all_channel_desired.map(c_d => c_d.name);
|
const all_channel_desired_name = all_channel_desired.map(c_d => c_d?.name);
|
||||||
|
|
||||||
let desc = '';
|
let desc = '';
|
||||||
|
|
||||||
|
@ -106,8 +106,6 @@ export default {
|
||||||
.setColor('Blurple')
|
.setColor('Blurple')
|
||||||
.setTitle(loc.get('c_prep4') + cat_to_prep_name)
|
.setTitle(loc.get('c_prep4') + cat_to_prep_name)
|
||||||
.setDescription(
|
.setDescription(
|
||||||
// Loads the description
|
|
||||||
// according to the user's locals
|
|
||||||
desc,
|
desc,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
"c_archive1": "Liste des catégories soumis au nettoyage",
|
"c_archive1": "Liste des catégories soumis au nettoyage",
|
||||||
"c_archive2": "`L1`, `L2`, `L3`, `M1`, `M2`",
|
"c_archive2": "`L1`, `L2`, `L3`, `M1`, `M2`",
|
||||||
"c_archive3": "Impossible de trouver/nettoyer le salon :",
|
"c_archive3": "Impossible de trouver/nettoyer le salon :",
|
||||||
"c_archive4": "Listes des Salons archivés de la catégorie `",
|
"c_archive4": "Liste des salons archivés de la catégorie",
|
||||||
"c_archive5": "` vers `",
|
"c_archive5": "vers",
|
||||||
"c_archive6": "Nettoyage",
|
"c_archive6": "Nettoyage",
|
||||||
"c_archive7": "Catégorie déjà nettoyée",
|
"c_archive7": "Catégorie déjà nettoyée",
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue