mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-16 08:12:36 +02:00
grand commit que tutur attend ( marche pas le raidmode en dev)
sinon il y a pleins de truc comme les anti raid , des coorectif ect
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||
const paginationEmbed = require('discordjs-button-pagination');
|
||||
|
||||
module.exports = {
|
||||
name: 'news',
|
||||
aliases: ['changelog'],
|
||||
description: 'Affiche tous les changements récents sur le bot',
|
||||
category: "utils" ,
|
||||
emote:"📌",
|
||||
utilisation: "changelog",
|
||||
async execute(message, args, client) {
|
||||
let changelogs = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT value FROM master WHERE id = ?', ["changelogGestion"], (err, row) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
reject(err);
|
||||
}
|
||||
resolve(row ? JSON.parse(row.value) : []);
|
||||
});
|
||||
});
|
||||
|
||||
if (changelogs.length === 0) {
|
||||
const noChangeLogEmbed = new EmbedBuilder()
|
||||
.setTitle('Aucun changement récent')
|
||||
.setDescription('Il n\'y a aucun changement récent à afficher.')
|
||||
.setColor('#0099ff');
|
||||
return message.channel.send({ embeds: [noChangeLogEmbed] });
|
||||
}
|
||||
|
||||
const embeds = changelogs.map((log, index) => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(new Date(log.timestamp).toLocaleDateString())
|
||||
.setDescription(log.text)
|
||||
.setColor('#0099ff');
|
||||
return embed;
|
||||
});
|
||||
|
||||
const backButton = new ButtonBuilder()
|
||||
.setCustomId('previousbtn')
|
||||
.setLabel('Précédent')
|
||||
.setStyle(ButtonStyle.Danger);
|
||||
|
||||
const nextButton = new ButtonBuilder()
|
||||
.setCustomId('nextbtn')
|
||||
.setLabel('Suivant')
|
||||
.setStyle(ButtonStyle.Success);
|
||||
|
||||
const buttonList = [backButton, nextButton];
|
||||
|
||||
const timeout = 15000;
|
||||
|
||||
paginationEmbed(message, embeds, buttonList, timeout);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user