chore: merge dev to main #172

Merged
Anri merged 11 commits from dev into main 2024-09-18 18:25:04 +02:00
11 changed files with 27 additions and 27 deletions
Showing only changes of commit a9163f110b - Show all commits

View file

@ -23,7 +23,7 @@ export default {
// Retrieve Pages // Retrieve Pages
const pageMax = Number(/(\d+)(?!.*\d)/gm.exec(embed_desc)?.[0]); const pageMax = Number(/(\d+)(?!.*\d)/gm.exec(embed_desc)?.[0]);
let page = Number(/(?!• \s+)\d(?=\/)/gm.exec(embed_desc)?.[0]); let page = Number(/(?!• \s+)\d(?=\/)/gm.exec(embed_desc)?.[0]);
if (page - 1 == 0) { if (page - 1 === 0) {
page = pageMax; page = pageMax;
} else { } else {
page--; page--;

View file

@ -24,7 +24,7 @@ export default {
// Retrieve Pages // Retrieve Pages
const pageMax = Number(/(\d+)(?!.*\d)/gm.exec(embed_desc)?.[0]); const pageMax = Number(/(\d+)(?!.*\d)/gm.exec(embed_desc)?.[0]);
let page = Number(/(?!• \s+)\d(?=\/)/gm.exec(embed_desc)?.[0]); let page = Number(/(?!• \s+)\d(?=\/)/gm.exec(embed_desc)?.[0]);
if (page - 1 == 0) { if (page - 1 === 0) {
page = pageMax; page = pageMax;
} else { } else {
page--; page--;

View file

@ -70,7 +70,7 @@ export default async (client: Client) => {
); );
// Send global commands to Discord // Send global commands to Discord
const globalCommands = commands.filter((c) => c.scope().length == 0); const globalCommands = commands.filter((c) => c.scope().length === 0);
return await rest.put(Routes.applicationCommands(client.user?.id as string), { return await rest.put(Routes.applicationCommands(client.user?.id as string), {
body: globalCommands.map((c) => c.data.toJSON()), body: globalCommands.map((c) => c.data.toJSON()),
}); });

View file

@ -74,14 +74,14 @@ export default {
allChannel?.then(async (channelGuild) => { allChannel?.then(async (channelGuild) => {
// Retrieve category to archive // Retrieve category to archive
const catToArchive = channelGuild const catToArchive = channelGuild
.filter((chan) => chan?.type == ChannelType.GuildCategory) .filter((chan) => chan?.type === ChannelType.GuildCategory)
.filter((chan) => chan?.name == desiredCat); .filter((chan) => chan?.name === desiredCat);
// Create/Retrieve the archive category // Create/Retrieve the archive category
const catArchivedName = "archive - " + desiredCat; const catArchivedName = "archive - " + desiredCat;
const catArchivedMap = channelGuild const catArchivedMap = channelGuild
.filter((chan) => chan?.type == ChannelType.GuildCategory) .filter((chan) => chan?.type === ChannelType.GuildCategory)
.filter((chan) => chan?.name == catArchivedName); .filter((chan) => chan?.name === catArchivedName);
let catArchived: NonThreadGuildBasedChannel | null | undefined; let catArchived: NonThreadGuildBasedChannel | null | undefined;
if (catArchivedMap.size > 0) { if (catArchivedMap.size > 0) {
@ -94,11 +94,11 @@ export default {
} }
const allChannelDesired = channelGuild const allChannelDesired = channelGuild
.filter((chan) => chan?.type == 0) .filter((chan) => chan?.type === 0)
.filter((chan) => chan?.parentId == catToArchive.map((cat) => cat?.id)[0]); .filter((chan) => chan?.parentId === catToArchive.map((cat) => cat?.id)[0]);
// If no channels in the source category // If no channels in the source category
if (allChannelDesired.size == 0) { if (allChannelDesired.size === 0) {
return interaction.reply({ return interaction.reply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()

View file

@ -67,21 +67,21 @@ export default {
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 const cat_to_prep = channel_guild
.filter((chan) => chan?.type == ChannelType.GuildCategory) .filter((chan) => chan?.type === ChannelType.GuildCategory)
.filter((chan) => chan?.name == desired_cat); .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 const all_channel_desired = channel_guild
.filter((chan) => chan?.type == 0) .filter((chan) => chan?.type === 0)
.filter((chan) => chan?.parentId == cat_to_prep_id[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 = "";
const general = "général"; const general = "général";
if (all_channel_desired_name.filter((cdn) => cdn == general).length == 0) { if (all_channel_desired_name.filter((cdn) => cdn === general).length === 0) {
interaction.guild?.channels.create({ interaction.guild?.channels.create({
name: general, name: general,
type: 0, type: 0,
@ -91,7 +91,7 @@ export default {
} }
const info = "informations"; const info = "informations";
if (all_channel_desired_name.filter((cdn) => cdn == info).length == 0) { if (all_channel_desired_name.filter((cdn) => cdn === info).length === 0) {
interaction.guild?.channels.create({ interaction.guild?.channels.create({
name: info, name: info,
type: 0, type: 0,
@ -101,7 +101,7 @@ export default {
desc += "`" + info + "` " + loc.get("c_prep5") + "\n"; desc += "`" + info + "` " + loc.get("c_prep5") + "\n";
} }
if (desc == "") { if (desc === "") {
desc = loc.get("c_prep6"); desc = loc.get("c_prep6");
} }

View file

@ -205,7 +205,7 @@ export default {
let user = interaction.options.getUser( 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) { if (user === null) {
user = interaction.user; user = interaction.user;
} }

View file

@ -85,7 +85,7 @@ export default {
const queue = useQueue(interaction.guildId!); const queue = useQueue(interaction.guildId!);
if (request) { if (request) {
if ( if (
interaction.options.getSubcommand() == interaction.options.getSubcommand() ===
loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase()
) { ) {
// Romanized // Romanized
@ -111,7 +111,7 @@ export default {
} }
if ( if (
interaction.options.getSubcommand() == interaction.options.getSubcommand() ===
loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase()
) { ) {
if (queue === null) { if (queue === null) {

View file

@ -26,7 +26,7 @@ export default async (client: Client) => {
throw `Unknown file in ${event_category}: ${event_file}`; throw `Unknown file in ${event_category}: ${event_file}`;
} }
if (event_category == "player") { if (event_category === "player") {
const player = useMainPlayer() as Player; const player = useMainPlayer() as Player;
if (once) { if (once) {
// eslint-disable-next-line // eslint-disable-next-line

View file

@ -82,7 +82,7 @@ export default async (message: Message, client: Client) => {
// If message doesn't exist or empty // If message doesn't exist or empty
if ( if (
!quoted_message || !quoted_message ||
(!quoted_message.content && quoted_message.attachments.size == 0) (!quoted_message.content && quoted_message.attachments.size === 0)
) { ) {
return; return;
} }
@ -143,7 +143,7 @@ export default async (message: Message, client: Client) => {
} }
let author = "Auteur"; let author = "Auteur";
if (message.author == quoted_post?.author) { if (message.author === quoted_post?.author) {
author += " & Citateur"; author += " & Citateur";
} else { } else {
footer += `\nCité par ${userWithNickname(message.member as GuildMember) ?? "?"} le ${showDate( footer += `\nCité par ${userWithNickname(message.member as GuildMember) ?? "?"} le ${showDate(

View file

@ -25,10 +25,10 @@ export const embedListQueue = (
embed.setFooter({ text: `${printRepeatMode(queue.repeatMode, loc)}` }); embed.setFooter({ text: `${printRepeatMode(queue.repeatMode, loc)}` });
tracks.slice((page - 1) * limit_fields, page * limit_fields).forEach((t, idx) => { tracks.slice((page - 1) * limit_fields, page * limit_fields).forEach((t, idx) => {
const now_playing = idx == 0 && page == 1; const now_playing = idx === 0 && page === 1;
const name = now_playing const name = now_playing
? loc.get("c_queue10") ? loc.get("c_queue10")
: (idx == 1 && page == 1) || (idx == 0 && page > 1) : (idx === 1 && page === 1) || (idx === 0 && page > 1)
? loc.get("c_queue11") ? loc.get("c_queue11")
: "\u200b"; : "\u200b";
const idx_track = now_playing ? "" : `${idx + limit_fields * (page - 1)}. `; const idx_track = now_playing ? "" : `${idx + limit_fields * (page - 1)}. `;

View file

@ -166,7 +166,7 @@ export const sendReminder = (client: Client, info: infoReminder, option: OptionR
} }
} }
if (option == OptionReminder.DirectMessage || !channelOk || !guildOk) { if (option === OptionReminder.DirectMessage || !channelOk || !guildOk) {
// Direct message // Direct message
const user = client.users.cache.get(info.userId); const user = client.users.cache.get(info.userId);
if (user !== undefined) { if (user !== undefined) {
@ -182,7 +182,7 @@ export const sendReminder = (client: Client, info: infoReminder, option: OptionR
}); });
// Mention everybody if needed // Mention everybody if needed
if (option == OptionReminder.Mention) { if (option === OptionReminder.Mention) {
(info.message?.match(/<@\d+>/g) ?? []).forEach((mention) => { (info.message?.match(/<@\d+>/g) ?? []).forEach((mention) => {
content += " " + mention; content += " " + mention;
}); });