Push du programme

This commit is contained in:
2022-03-04 14:26:14 +01:00
parent bf2efcc1ed
commit e49f26cbf5
13 changed files with 1453 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
module.exports = {
name: 'reboot',
aliases: [],
utilisation: '{prefix}reboot',
async execute(client, message) {
const Members = client.config.admin;
if (!Members.includes(message.author.id))
return message.channel.send("Cette commande est réservé au développeur de LanBot");
await message.channel.send("Reboot en cours...");
await process.exit();
},
};

24
commands/core/help.js Normal file
View File

@@ -0,0 +1,24 @@
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'help',
aliases: ['h'],
showHelp: false,
utilisation: '{prefix}help',
execute(client, message, args) {
const embed = new MessageEmbed();
embed.setColor('RED');
embed.setAuthor(client.user.username, client.user.displayAvatarURL({ size: 1024, dynamic: true }));
const commands = client.commands.filter(x => x.showHelp !== false);
embed.setDescription('Bienvenue sur la page d\'aide !');
embed.addField(`Actifs - ${commands.size}`, commands.map(x => `\`${x.name}${x.aliases[0] ? ` (${x.aliases.map(y => y).join(', ')})\`` : '\`'}`).join(' | '));
embed.setTimestamp();
message.channel.send({ embeds: [embed] });
},
};

47
commands/core/menuadd.js Normal file
View File

@@ -0,0 +1,47 @@
const { MessageAttachment } = require("discord.js");
const wget = require("node-wget");
const fs = require("fs");
module.exports = {
name: "menu",
aliases: ["menu", "menuadd"],
utilisation: [
"Pour télécharger un fichier, renseignez soit le lien google drive ou juste l'ID",
"{prefix}menu <link_GDrive>",
"{prefix}menuadd <ID>"
],
async execute(client, message, args) {
if (!args[0])
return message.channel.send("Merci de me préciser un lien ! ");
const id = args[0].split("/")[5];
wget(
{
url: `https://drive.google.com/uc?export=download&id=${id}`,
dest: "./Files/menu.pdf", // destination path or path with filenname, default is ./
},
function (error, response, body) {
if (error) {
console.log("--- error:");
console.log(error); // error encountered
}
}
);
// attendre que le fichier menu.pdf soit téléchargé puis l'envoyer dans le salon
setTimeout(() => {
const attachment = new MessageAttachment("./Files/menu.pdf");
message.channel.send({ files: [attachment] });
}, 5000);
// supprimer le fichier menu.pdf
setTimeout(() => {
fs.unlink("./Files/menu.pdf", (err) => {
if (err) throw err;
console.log("File deleted!");
});
}, 10000);
},
};

14
commands/core/ping.js Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
name: 'ping',
aliases: [],
utilisation: '{prefix}ping',
async execute(client, message) {
const msg = await message.channel.send("Pong ! ");
msg.edit(
`Pong !
Latence du bot: ${msg.createdTimestamp - message.createdTimestamp}ms
Latence de l'API: ${Math.round(client.ws.ping)}ms`
)
},
};