This commit is contained in:
parent
b0015925d0
commit
83520eb6b5
28 changed files with 138 additions and 138 deletions
|
@ -6,7 +6,7 @@ import { getLocale } from "../utils/locales";
|
|||
export default async (client: Client) => {
|
||||
// Dossier des buttons
|
||||
const buttons_categories = (await readdir(__dirname)).filter(
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts")
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
|
@ -26,9 +26,9 @@ export default async (client: Client) => {
|
|||
// Add it to the collection so the interaction will work
|
||||
client.buttons.list.set(button.data.name, button);
|
||||
return button.data;
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ export const collect = (
|
|||
client: Client,
|
||||
interaction: ChatInputCommandInteraction | MessageComponentInteraction,
|
||||
id: string,
|
||||
deferUpdate = false
|
||||
deferUpdate = false,
|
||||
) => {
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
const button = client.buttons.list.get(id.split("_")[0]);
|
||||
|
|
|
@ -39,7 +39,7 @@ export default {
|
|||
user,
|
||||
interaction.guildId,
|
||||
page,
|
||||
interaction.locale
|
||||
interaction.locale,
|
||||
);
|
||||
|
||||
const idPrec = "reminderList-prec_" + uuidv4();
|
||||
|
@ -49,13 +49,13 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get("c_reminder12"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get("c_reminder13"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
|
|
@ -39,7 +39,7 @@ export default {
|
|||
user,
|
||||
interaction.guildId,
|
||||
page,
|
||||
interaction.locale
|
||||
interaction.locale,
|
||||
);
|
||||
|
||||
const idPrec = "reminderList-prec_" + uuidv4();
|
||||
|
@ -49,13 +49,13 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get("c_reminder12"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get("c_reminder13"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
|
|
@ -48,14 +48,14 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get("c_queue8"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get("c_queue9"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
|
|
@ -48,14 +48,14 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get("c_queue8"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get("c_queue9"))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
|
|
@ -9,7 +9,7 @@ export default async (client: Client) => {
|
|||
const rest = new REST({ version: "10" }).setToken(client.token ?? "");
|
||||
|
||||
const command_categories = (await readdir(__dirname)).filter(
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts")
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
|
||||
);
|
||||
|
||||
const commands = (
|
||||
|
@ -33,9 +33,9 @@ export default async (client: Client) => {
|
|||
client.commands.list.set(command.data.name, command);
|
||||
|
||||
return command;
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
)
|
||||
).flat(2);
|
||||
|
||||
|
@ -66,7 +66,7 @@ export default async (client: Client) => {
|
|||
async (command, guild) =>
|
||||
await rest.put(Routes.applicationGuildCommands(client.user?.id as string, guild), {
|
||||
body: command,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
// Send global commands to Discord
|
||||
|
|
|
@ -20,7 +20,7 @@ export default {
|
|||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
@ -29,13 +29,13 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
|
||||
)
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -45,7 +45,7 @@ export default {
|
|||
const desiredCat = interaction.options.get(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ""
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
)?.value as string;
|
||||
|
||||
// If a category isn't specified
|
||||
|
@ -126,13 +126,13 @@ export default {
|
|||
loc.get("c_archive5") +
|
||||
" `" +
|
||||
catArchivedName +
|
||||
"`"
|
||||
"`",
|
||||
)
|
||||
.setDescription(
|
||||
allChannelDesired
|
||||
.map((cgD) => cgD?.name)
|
||||
.toString()
|
||||
.replaceAll(",", "\n")
|
||||
.replaceAll(",", "\n"),
|
||||
),
|
||||
],
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ export default {
|
|||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
@ -23,13 +23,13 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
|
||||
)
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -39,7 +39,7 @@ export default {
|
|||
const desired_command = interaction.options.getString(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ""
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
);
|
||||
|
||||
// If a command isn't specified
|
||||
|
@ -96,7 +96,7 @@ export default {
|
|||
// Loads the description
|
||||
// according to the user's locals
|
||||
command.data.description_localizations?.[interaction.locale as Locale] ??
|
||||
command.data.description
|
||||
command.data.description,
|
||||
),
|
||||
],
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
|||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
|
@ -28,7 +28,7 @@ export default {
|
|||
interaction.editReply(
|
||||
`${loc?.get("c_ping1")}: \
|
||||
${sent.createdTimestamp - interaction.createdTimestamp}ms
|
||||
${loc?.get("c_ping2")}: ${client.ws.ping}ms.`
|
||||
${loc?.get("c_ping2")}: ${client.ws.ping}ms.`,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ export default {
|
|||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
@ -22,13 +22,13 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
|
||||
)
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? ""
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
|
||||
)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ export default {
|
|||
const desired_cat = interaction.options.get(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ""
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
)?.value as string;
|
||||
|
||||
// If a category isn't specified
|
||||
|
|
|
@ -53,11 +53,11 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_desc`)
|
||||
)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_desc`),
|
||||
),
|
||||
)
|
||||
|
||||
// Specified message (not required)
|
||||
|
@ -66,12 +66,12 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub1_opt2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_desc`)
|
||||
)
|
||||
)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_desc`),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// List reminders
|
||||
|
@ -88,11 +88,11 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub2_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_desc`)
|
||||
)
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_desc`),
|
||||
),
|
||||
)
|
||||
|
||||
// Page
|
||||
|
@ -101,12 +101,12 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub2_opt2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt2_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub2_opt2_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt2_desc`)
|
||||
)
|
||||
)
|
||||
getLocalizations(client, `c_${filename}_sub2_opt2_desc`),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// Delete a reminder
|
||||
|
@ -123,13 +123,13 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_desc`)
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_desc`),
|
||||
)
|
||||
.setRequired(true)
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -145,14 +145,14 @@ export default {
|
|||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
|
||||
// If time is already renseigned
|
||||
const time = interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
|
||||
);
|
||||
if (time != null) {
|
||||
// Use the cli because we already have enough data
|
||||
return newReminder(client, time, {
|
||||
locale: interaction.locale,
|
||||
message: interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_sub1_opt2_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub1_opt2_name`) as string,
|
||||
),
|
||||
createdAt: interaction.createdAt.getTime(),
|
||||
channelId: interaction.channelId,
|
||||
|
@ -162,7 +162,7 @@ export default {
|
|||
interaction.reply({
|
||||
content: msg as string,
|
||||
ephemeral: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
// Show modal to user to get at least the time
|
||||
|
@ -186,7 +186,7 @@ export default {
|
|||
|
||||
modal.addComponents(
|
||||
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(timeGUI),
|
||||
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(messageGUI)
|
||||
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(messageGUI),
|
||||
);
|
||||
|
||||
return interaction.showModal(modal);
|
||||
|
@ -196,7 +196,7 @@ export default {
|
|||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
|
||||
// Which user to show
|
||||
let user = interaction.options.getUser(
|
||||
loc_default?.get(`c_${filename}_sub2_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub2_opt1_name`) as string,
|
||||
);
|
||||
if (user == null) {
|
||||
user = interaction.user;
|
||||
|
@ -204,14 +204,14 @@ export default {
|
|||
|
||||
const page =
|
||||
interaction.options.getInteger(
|
||||
loc_default?.get(`c_${filename}_sub2_opt2_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub2_opt2_name`) as string,
|
||||
) ?? 1;
|
||||
const list = await embedListReminders(
|
||||
client,
|
||||
user,
|
||||
interaction.guildId,
|
||||
page,
|
||||
interaction.locale
|
||||
interaction.locale,
|
||||
);
|
||||
|
||||
const idPrec = "reminderList-prec_" + uuidv4();
|
||||
|
@ -221,13 +221,13 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get(`c_${filename}12`))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get(`c_${filename}13`))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
@ -243,7 +243,7 @@ export default {
|
|||
// Delete a reminder
|
||||
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
|
||||
const id = interaction.options.getInteger(
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
|
||||
);
|
||||
if (id === null) {
|
||||
return interaction.reply({
|
||||
|
@ -271,7 +271,7 @@ export default {
|
|||
interaction.reply({
|
||||
content: `Reminder **#${id}** supprimé !`,
|
||||
ephemeral: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -35,8 +35,8 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
)
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
),
|
||||
)
|
||||
|
||||
// Romanized
|
||||
|
@ -53,8 +53,8 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
)
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ export default {
|
|||
const loc = getLocale(client, interaction.locale);
|
||||
|
||||
let request = interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_opt1_name`) as string,
|
||||
);
|
||||
|
||||
let data = null;
|
||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
|||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setAutocomplete(true)
|
||||
.setAutocomplete(true),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ export default {
|
|||
}
|
||||
|
||||
const query = interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_opt1_name`) as string,
|
||||
);
|
||||
|
||||
const player = useMainPlayer() as Player;
|
||||
|
@ -82,7 +82,7 @@ export default {
|
|||
if (track) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(
|
||||
`${queue.node.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}`
|
||||
`${queue.node.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}`,
|
||||
)
|
||||
.setTitle(track.title + " • " + track.author)
|
||||
.setURL(track.url)
|
||||
|
@ -158,7 +158,7 @@ export default {
|
|||
const player = useMainPlayer() as Player;
|
||||
const query = interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_opt1_name`) as string,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const limit_value_discord = 100;
|
||||
|
@ -225,7 +225,7 @@ export default {
|
|||
name,
|
||||
value: t.url,
|
||||
};
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_desc`)
|
||||
)
|
||||
)
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_desc`),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// Shuffle Queue
|
||||
|
@ -59,7 +59,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
|
||||
)
|
||||
|
||||
// Remove <ID>
|
||||
|
@ -77,13 +77,13 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true)
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
|
||||
)
|
||||
.setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_desc`)
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_desc`),
|
||||
)
|
||||
.setRequired(true)
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -105,7 +105,7 @@ export default {
|
|||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
|
||||
const page =
|
||||
interaction.options.getNumber(
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
|
||||
) ?? 1;
|
||||
|
||||
embedListQueue(client, embed, queue, page, interaction.locale);
|
||||
|
@ -118,14 +118,14 @@ export default {
|
|||
new ButtonBuilder()
|
||||
.setCustomId(idPrec)
|
||||
.setLabel(loc.get(`c_${filename}8`))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(idNext)
|
||||
.setLabel(loc.get(`c_${filename}9`))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
),
|
||||
);
|
||||
|
||||
// Buttons interactions
|
||||
|
@ -146,14 +146,14 @@ export default {
|
|||
// Remove <ID>
|
||||
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
|
||||
const id = interaction.options.getNumber(
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
|
||||
) as number;
|
||||
|
||||
const track = queue.removeTrack(id - 1);
|
||||
|
||||
if (track) {
|
||||
embed.setDescription(
|
||||
`${loc.get("c_queue4")} #${id} \`${track.title}\` ${loc.get("c_queue5")}`
|
||||
`${loc.get("c_queue4")} #${id} \`${track.title}\` ${loc.get("c_queue5")}`,
|
||||
);
|
||||
} else {
|
||||
embed.setDescription(loc.get("c_queue6"));
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)),
|
||||
)
|
||||
|
||||
// Repeat current track
|
||||
|
@ -36,7 +36,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
|
||||
)
|
||||
|
||||
// Repeat queue
|
||||
|
@ -45,7 +45,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
|
||||
)
|
||||
|
||||
// Enable autoplay
|
||||
|
@ -54,7 +54,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
@ -91,7 +91,7 @@ export default {
|
|||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
|
||||
queue.setRepeatMode(QueueRepeatMode.TRACK);
|
||||
return interaction.reply(
|
||||
`${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`
|
||||
`${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
)
|
||||
);
|
||||
},
|
||||
|
|
|
@ -55,7 +55,7 @@ export default async (client: Client) => {
|
|||
client,
|
||||
info,
|
||||
element.option_id,
|
||||
(element.expiration_date - now) / 1000
|
||||
(element.expiration_date - now) / 1000,
|
||||
);
|
||||
|
||||
// Update timeout in database
|
||||
|
|
|
@ -5,7 +5,7 @@ import { readdir } from "fs/promises";
|
|||
/** Load all the events. */
|
||||
export default async (client: Client) => {
|
||||
const events_categories = (await readdir(__dirname)).filter(
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts")
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
|
||||
);
|
||||
|
||||
events_categories.forEach(async (event_category) => {
|
||||
|
@ -50,7 +50,7 @@ export default async (client: Client) => {
|
|||
return client.on(event_type, (...args) => {
|
||||
execute(...args, client);
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -40,10 +40,10 @@ export default async (message: Message, client: Client) => {
|
|||
message_id: string;
|
||||
channel: TextBasedChannel;
|
||||
}[] = [],
|
||||
match
|
||||
match,
|
||||
) => {
|
||||
const [, guild_id, channel_id, message_id] = new RegExp(regex).exec(
|
||||
match
|
||||
match,
|
||||
) as RegExpExecArray;
|
||||
|
||||
// If message posted in another guild
|
||||
|
@ -62,7 +62,7 @@ export default async (message: Message, client: Client) => {
|
|||
|
||||
return data;
|
||||
},
|
||||
[]
|
||||
[],
|
||||
)
|
||||
.map(async ({ message_id, channel }) => {
|
||||
const quoted_message = await channel.messages.fetch(message_id).catch(() => undefined);
|
||||
|
@ -76,7 +76,7 @@ export default async (message: Message, client: Client) => {
|
|||
}
|
||||
|
||||
return quoted_message;
|
||||
})
|
||||
}),
|
||||
)
|
||||
)
|
||||
// Remove undefined elements
|
||||
|
@ -124,7 +124,7 @@ export default async (message: Message, client: Client) => {
|
|||
let footer = `Posté le ${showDate(
|
||||
client.config.default_lang,
|
||||
loc,
|
||||
quoted_post?.createdAt as Date
|
||||
quoted_post?.createdAt as Date,
|
||||
)}`;
|
||||
if (quoted_post?.editedAt) {
|
||||
footer += ` et modifié le ${showDate(client.config.default_lang, loc, quoted_post.editedAt)}`;
|
||||
|
@ -137,7 +137,7 @@ export default async (message: Message, client: Client) => {
|
|||
footer += `\nCité par ${userWithNickname(message.member as GuildMember) ?? "?"} le ${showDate(
|
||||
client.config.default_lang,
|
||||
loc,
|
||||
message.createdAt
|
||||
message.createdAt,
|
||||
)}`;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ export default async (message: Message, client: Client) => {
|
|||
name: "Message",
|
||||
value: `${quoted_post?.channel} - [Lien Message](${quoted_post?.url})`,
|
||||
inline: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Delete source message if no content when removing links
|
||||
|
|
|
@ -5,7 +5,7 @@ import { removeExtension } from "../utils/misc";
|
|||
export default async (client: Client) => {
|
||||
// Dossier des modals
|
||||
const modals_categories = (await readdir(__dirname)).filter(
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts")
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
|
@ -25,8 +25,8 @@ export default async (client: Client) => {
|
|||
// Add it to the collection so the interaction will work
|
||||
client.modals.list.set(modal.data.name, modal);
|
||||
return modal.data;
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
|
|
@ -18,6 +18,6 @@ export default {
|
|||
interaction.reply({
|
||||
content: msg as string,
|
||||
ephemeral: true,
|
||||
})
|
||||
}),
|
||||
),
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ declare module "discord.js" {
|
|||
/** How the button interact */
|
||||
interaction: (
|
||||
interaction: MessageComponentInteraction,
|
||||
client: Client
|
||||
client: Client,
|
||||
) => Promise<InteractionUpdateOptions>;
|
||||
}
|
||||
>;
|
||||
|
|
|
@ -88,6 +88,6 @@ const initDatabase = (db: Database) => {
|
|||
guild_id TEXT, \
|
||||
locale TEXT, \
|
||||
timeout_id TEXT \
|
||||
);"
|
||||
);",
|
||||
);
|
||||
};
|
||||
|
|
|
@ -33,10 +33,10 @@ export const loadLocales = async (default_lang: string) => {
|
|||
.filter((str) => str !== "default")
|
||||
.map((str) => {
|
||||
return [str, content[str]];
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
// Check locales sanity
|
||||
|
@ -130,7 +130,7 @@ const checkLocales = async (locales: Map<string, Map<string, string>>, default_l
|
|||
// and the security is poor, but it's better than nothing.
|
||||
throw new Error(
|
||||
`The default locale (${default_lang} = ${default_lang_size}) isn't complete ` +
|
||||
`(${max_size_name} = ${max_size}).`
|
||||
`(${max_size_name} = ${max_size}).`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ const checkLocales = async (locales: Map<string, Map<string, string>>, default_l
|
|||
const padding = " ".repeat(lang.length === 5 ? 1 : 4);
|
||||
|
||||
console.log(
|
||||
`${padding}${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%`
|
||||
`${padding}${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%`,
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ export const cleanCodeBlock = (text: string) => {
|
|||
/(http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)/g,
|
||||
function (url: string) {
|
||||
return `\`${url}\``;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Fix issues
|
||||
|
|
|
@ -8,7 +8,7 @@ export const embedListQueue = (
|
|||
embed: EmbedBuilder,
|
||||
queue: GuildQueue,
|
||||
page: number,
|
||||
local: string
|
||||
local: string,
|
||||
) => {
|
||||
const loc = getLocale(client, local);
|
||||
const tracks = queue.tracks.toArray();
|
||||
|
@ -29,8 +29,8 @@ export const embedListQueue = (
|
|||
const name = now_playing
|
||||
? loc.get("c_queue10")
|
||||
: (idx == 1 && page == 1) || (idx == 0 && page > 1)
|
||||
? loc.get("c_queue11")
|
||||
: "\u200b";
|
||||
? loc.get("c_queue11")
|
||||
: "\u200b";
|
||||
const idx_track = now_playing ? "" : `${idx + limit_fields * (page - 1)}. `;
|
||||
embed.addFields({
|
||||
name,
|
||||
|
|
|
@ -92,7 +92,7 @@ export const newReminder = async (client: Client, time: string, info: infoRemind
|
|||
// Send confirmation to user
|
||||
const loc = getLocale(client, info.locale);
|
||||
ok(`${loc.get("c_reminder1")} ${data.time}.`);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -117,7 +117,7 @@ export const deleteReminder = (client: Client, createdAt: string, userId: string
|
|||
|
||||
// Send confirmation to user
|
||||
ok(true);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -200,7 +200,7 @@ export const setTimeoutReminder = (
|
|||
client: Client,
|
||||
info: infoReminder,
|
||||
option: OptionReminder,
|
||||
timeout: number
|
||||
timeout: number,
|
||||
) => {
|
||||
return Number(
|
||||
setTimeout(() => {
|
||||
|
@ -211,7 +211,7 @@ export const setTimeoutReminder = (
|
|||
|
||||
sendReminder(client, info, option);
|
||||
});
|
||||
}, timeout * 1000)
|
||||
}, timeout * 1000),
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -226,7 +226,7 @@ export const checkOwnershipReminder = async (
|
|||
client: Client,
|
||||
id: number,
|
||||
userId: string,
|
||||
guildId: string
|
||||
guildId: string,
|
||||
) => {
|
||||
type returnData = { [key: string]: number };
|
||||
|
||||
|
@ -247,7 +247,7 @@ export const checkOwnershipReminder = async (
|
|||
|
||||
// Send all the current reminders
|
||||
ok(row[0]);
|
||||
}
|
||||
},
|
||||
);
|
||||
})) as returnData;
|
||||
return Object.keys(data).map((key) => data[key])[0] === 0 ? true : false;
|
||||
|
@ -272,7 +272,7 @@ export const getReminderInfo = async (client: Client, id: number) => {
|
|||
|
||||
// Send all the current reminders
|
||||
ok(row[0]);
|
||||
}
|
||||
},
|
||||
);
|
||||
})) as dbReminder;
|
||||
};
|
||||
|
@ -316,7 +316,7 @@ export const updateReminder = (client: Client, data: dbReminder) => {
|
|||
}
|
||||
|
||||
ok(true);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -342,7 +342,7 @@ const listReminders = async (client: Client, userId: string, guildId: string | n
|
|||
|
||||
// Send all the current reminders
|
||||
ok(row);
|
||||
}
|
||||
},
|
||||
);
|
||||
})) as dbReminder[];
|
||||
};
|
||||
|
@ -361,7 +361,7 @@ export const embedListReminders = async (
|
|||
user: User,
|
||||
guildId: string | null,
|
||||
page: number,
|
||||
local: string
|
||||
local: string,
|
||||
) => {
|
||||
const loc = getLocale(client, local);
|
||||
const reminders = await listReminders(client, user.id, guildId);
|
||||
|
@ -376,7 +376,7 @@ export const embedListReminders = async (
|
|||
const embed = new EmbedBuilder()
|
||||
.setColor(Colors.DarkGrey)
|
||||
.setDescription(
|
||||
`${loc.get("c_reminder5")} ${user} • ${loc.get("c_reminder6")} ${page}/${pageMax}`
|
||||
`${loc.get("c_reminder5")} ${user} • ${loc.get("c_reminder6")} ${page}/${pageMax}`,
|
||||
)
|
||||
.setThumbnail(user.displayAvatarURL());
|
||||
|
||||
|
@ -396,7 +396,7 @@ export const embedListReminders = async (
|
|||
name: `#${remind.id} • ${loc.get("c_reminder9")} ${showDate(
|
||||
local,
|
||||
loc,
|
||||
new Date(Number(remind.creation_date))
|
||||
new Date(Number(remind.creation_date)),
|
||||
)}\n${expiration}`,
|
||||
value: text,
|
||||
inline: false,
|
||||
|
|
|
@ -31,7 +31,7 @@ export const strToSeconds = (time: string) => {
|
|||
TimeSecond[TimeSecond.Hour]
|
||||
}>[0-9]+(?=[h]))|(?<${TimeSecond[TimeSecond.Minute]}>[0-9]+(?=[m]))|(?<${
|
||||
TimeSecond[TimeSecond.Second]
|
||||
}>[0-9]+(?=[s]?))`
|
||||
}>[0-9]+(?=[s]?))`,
|
||||
);
|
||||
|
||||
const data = Object.assign({}, regex.exec(time)?.groups);
|
||||
|
|
Loading…
Reference in a new issue