init: reminder list
This commit is contained in:
parent
159d3b1528
commit
4bac943011
4 changed files with 100 additions and 10 deletions
36
src/buttons/misc/reminderList-next.ts
Normal file
36
src/buttons/misc/reminderList-next.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, Client, Colors, EmbedBuilder } from 'discord.js';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
|
||||
export default {
|
||||
data: {
|
||||
name: getFilename(__filename),
|
||||
},
|
||||
interaction: async (interaction: ButtonInteraction, client: Client) => {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-prec')
|
||||
.setLabel('Prec')
|
||||
.setStyle(ButtonStyle.Primary))
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-next')
|
||||
.setLabel('Next')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true),
|
||||
);
|
||||
|
||||
|
||||
const list = new EmbedBuilder()
|
||||
.setColor(Colors.DarkGrey)
|
||||
.setTitle('List title')
|
||||
.setDescription('List desc');
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [list],
|
||||
components: [row],
|
||||
});
|
||||
},
|
||||
};
|
36
src/buttons/misc/reminderList-prec.ts
Normal file
36
src/buttons/misc/reminderList-prec.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, Client, Colors, EmbedBuilder } from 'discord.js';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
|
||||
export default {
|
||||
data: {
|
||||
name: getFilename(__filename),
|
||||
},
|
||||
interaction: async (interaction: ButtonInteraction, client: Client) => {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-prec')
|
||||
.setLabel('Prec')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true))
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-next')
|
||||
.setLabel('Next')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
|
||||
|
||||
const list = new EmbedBuilder()
|
||||
.setColor(Colors.DarkGrey)
|
||||
.setTitle('List title')
|
||||
.setDescription('List desc');
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [list],
|
||||
components: [row],
|
||||
});
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
import { ModalActionRowComponentBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { ActionRowBuilder, ChatInputCommandInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle } from 'discord.js';
|
||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, Client, Colors, EmbedBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from 'discord.js';
|
||||
import { getLocale, getLocalizations } from '../../utils/locales';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
import { checkOwnershipReminder, deleteReminder, getReminderInfo, newReminder } from '../../utils/reminder';
|
||||
|
@ -194,15 +194,32 @@ export default {
|
|||
// List reminders
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)
|
||||
?.toLowerCase() ?? '': {
|
||||
// TODO: Liste dans un embed, naviguez entre les pages à l'aide
|
||||
// de boutons à la place d'utiliser des réactions
|
||||
// cf. https://discordjs.guide/interactions/buttons.html#building-and-sending-buttons
|
||||
// Une option pour renseigné un utilisateur est disponible.
|
||||
// Quand aucun utilisateur est spécifié, il faut affiché ses
|
||||
// rappels, sinon affiché les rappels de la personne qui fait
|
||||
// la commande.
|
||||
// Which user to show
|
||||
let user = interaction.options.getUser(loc_default?.get(`c_${filename}_sub2_opt1_name`) as string);
|
||||
if (user == null) {
|
||||
user = interaction.user;
|
||||
}
|
||||
|
||||
return interaction.reply('TODO');
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-prec')
|
||||
.setLabel('Prec')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true))
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('reminderList-next')
|
||||
.setLabel('Next')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
|
||||
const list = new EmbedBuilder()
|
||||
.setColor(Colors.DarkGrey)
|
||||
.setTitle(`List title of ${user.tag}`)
|
||||
.setDescription('List desc');
|
||||
|
||||
return await interaction.reply({ ephemeral: true, embeds: [list], components: [row] });
|
||||
}
|
||||
// Delete a reminder
|
||||
case loc_default?.get(`c_${filename}_sub3_name`)
|
||||
|
|
|
@ -36,5 +36,6 @@
|
|||
"c_reminder_sub3_opt1_desc": "Rappel à supprimé",
|
||||
"c_reminder1": "Un rappel a été configuré pour dans",
|
||||
"c_reminder2": "L'ID renseigné n'est pas valide.",
|
||||
"c_reminder3": "Rappel non trouvé, pas sur le bon serveur ou qui ne vous appartiens pas."
|
||||
"c_reminder3": "Rappel non trouvé, pas sur le bon serveur ou qui ne vous appartiens pas.",
|
||||
"c_reminder4": "Utilisateur inconnu."
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue