refactor: typo
This commit is contained in:
parent
5d3b2638cc
commit
72b6c21a3c
3 changed files with 68 additions and 60 deletions
|
@ -1,6 +1,5 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { Locale } from 'discord-api-types/v9';
|
||||
import { CategoryChannel, ChannelType, Client, CommandInteraction, EmbedBuilder, Guild } from 'discord.js';
|
||||
import { ChannelType, Client, CommandInteraction, EmbedBuilder } from 'discord.js';
|
||||
import { getLocale, getLocalizations } from '../../utils/locales';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
import '../../modules/string';
|
||||
|
@ -42,12 +41,14 @@ export default {
|
|||
if (!desired_cat) {
|
||||
|
||||
// Sends a list of commands sorted into categories
|
||||
return interaction.reply({ embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive1'))
|
||||
.setDescription(loc.get('c_archive2')),
|
||||
] });
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive1'))
|
||||
.setDescription(loc.get('c_archive2')),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// If a category is specified
|
||||
|
@ -74,16 +75,18 @@ export default {
|
|||
|
||||
const all_channel_desired = channel_guild.filter(chan => chan.type == 0).filter(chan => chan.parentId == cat_to_archive_id[0]);
|
||||
if (all_channel_desired.size == 0) {
|
||||
return interaction.reply({ embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive6'))
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
'Catégorie déjà nettoyée'
|
||||
),
|
||||
] });
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive6'))
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
loc.get('c_archive7')
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
const all_channel_desired_name = all_channel_desired.map(cg_d => cg_d.name);
|
||||
console.log(all_channel_desired_name);
|
||||
|
@ -92,16 +95,18 @@ export default {
|
|||
);
|
||||
|
||||
const list_cg_moved = all_channel_desired_name.toString().replaceAll(',', '\n');
|
||||
return interaction.reply({ embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive4') + cat_to_archive_name + loc.get('c_archive5') + cat_archived_name + '`')
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
list_cg_moved
|
||||
),
|
||||
] });
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_archive4') + cat_to_archive_name + loc.get('c_archive5') + cat_archived_name + '`')
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
list_cg_moved
|
||||
),
|
||||
],
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { Locale } from 'discord-api-types/v9';
|
||||
import { CategoryChannel, ChannelType, Client, CommandInteraction, EmbedBuilder, Guild } from 'discord.js';
|
||||
import { ChannelType, Client, CommandInteraction, EmbedBuilder } from 'discord.js';
|
||||
import { getLocale, getLocalizations } from '../../utils/locales';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
import '../../modules/string';
|
||||
|
@ -42,12 +41,14 @@ export default {
|
|||
if (!desired_cat) {
|
||||
|
||||
// Sends a list of commands sorted into categories
|
||||
return interaction.reply({ embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_prep1'))
|
||||
.setDescription(loc.get('c_prep2')),
|
||||
] });
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_prep1'))
|
||||
.setDescription(loc.get('c_prep2')),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// If a category is specified
|
||||
|
@ -68,50 +69,49 @@ export default {
|
|||
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_archived = channel_guild.filter(chan => chan.type == ChannelType.GuildCategory).filter(chan => chan.name == 'archive - ' + desired_cat);
|
||||
const cat_archived_id = cat_archived.map(cat => cat.id);
|
||||
const cat_archived_name = cat_archived.map(cat => cat.name);
|
||||
|
||||
// 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_name = all_channel_desired.map(c_d => c_d.name);
|
||||
|
||||
let desc = '';
|
||||
|
||||
if (all_channel_desired_name.filter(cdn => cdn == 'général').length == 0) {
|
||||
const general = 'général';
|
||||
if (all_channel_desired_name.filter(cdn => cdn == general).length == 0) {
|
||||
interaction.guild?.channels.create({
|
||||
name: 'général',
|
||||
name: general,
|
||||
type: 0,
|
||||
parent:cat_to_prep_id[0],
|
||||
parent: cat_to_prep_id[0],
|
||||
});
|
||||
desc = 'général créé \n';
|
||||
desc = general + loc.get('c_prep5') + '\n';
|
||||
}
|
||||
|
||||
|
||||
if (all_channel_desired_name.filter(cdn => cdn == 'informations').length == 0) {
|
||||
const info = 'informations';
|
||||
if (all_channel_desired_name.filter(cdn => cdn == info).length == 0) {
|
||||
interaction.guild?.channels.create({
|
||||
name: 'informations',
|
||||
name: info,
|
||||
type: 0,
|
||||
parent:cat_to_prep_id[0],
|
||||
parent: cat_to_prep_id[0],
|
||||
});
|
||||
|
||||
desc += 'informations créé \n';
|
||||
desc += info + loc.get('c_prep5') + '\n';
|
||||
}
|
||||
|
||||
if (desc == '') {
|
||||
desc = 'Pas besoin de préparation';
|
||||
desc = loc.get('c_prep6');
|
||||
}
|
||||
|
||||
return interaction.reply({ embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_prep4') + cat_to_prep_name)
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
desc,
|
||||
),
|
||||
] });
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Blurple')
|
||||
.setTitle(loc.get('c_prep4') + cat_to_prep_name)
|
||||
.setDescription(
|
||||
// Loads the description
|
||||
// according to the user's locals
|
||||
desc,
|
||||
),
|
||||
],
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"c_archive4": "Listes des Salons archivés de la catégorie `",
|
||||
"c_archive5": "` vers `",
|
||||
"c_archive6": "Nettoyage",
|
||||
"c_archive7": "Catégorie déjà nettoyée",
|
||||
|
||||
"c_prep_name": "Préparation",
|
||||
"c_prep_desc": "Préparation des salons généraux pour la nouvelle année",
|
||||
|
@ -33,6 +34,8 @@
|
|||
"c_prep2": "`L1`, `L2`, `L3`, `M1`, `M2`",
|
||||
"c_prep3": "Impossible de trouver/nettoyer le salon :",
|
||||
"c_prep4": "Listes des Salons préparés `",
|
||||
"c_prep5": "créé",
|
||||
"c_prep6": "Pas besoin de préparation",
|
||||
|
||||
|
||||
"u_time_at": "à"
|
||||
|
|
Loading…
Reference in a new issue