mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
ajout du prefix dans le help
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
||||
const embedColor = require('../../fonctions/embedColor.js');
|
||||
const getPrefix = require('../../fonctions/getPrefix.js');
|
||||
|
||||
function commandsList (client, category) {
|
||||
function commandsList (client, category, prefix) {
|
||||
const casinoCommands = client.commands.filter(command => command.category === category).sort((a, b) => a.name.localeCompare(b.name));
|
||||
const uniqueCommands = new Map();
|
||||
|
||||
@@ -11,7 +12,7 @@ function commandsList (client, category) {
|
||||
|
||||
let commandsList = '';
|
||||
uniqueCommands.forEach((command, name) => {
|
||||
commandsList += `> ${command.emote} \`${name}${command.utilisation ? ' ' + command.utilisation : ''}\`\n> ┖ ${command.description}\n\n`;
|
||||
commandsList += `> ${command.emote} \`${prefix}${name}${command.utilisation ? ' ' + command.utilisation : ''}\`\n> ┖ ${command.description}\n\n`;
|
||||
});
|
||||
|
||||
return commandsList;
|
||||
@@ -25,10 +26,11 @@ module.exports = {
|
||||
permission: 0,
|
||||
|
||||
async execute(message, args, client) {
|
||||
const prefix = await getPrefix(message.guild.id);
|
||||
const embedPage1 = new EmbedBuilder()
|
||||
.setTitle('📚 ・Information')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(`Voici le panel d'aide du bot. Pour plus d'informations sur une commande, utilisez &help <commande>\n\n> **🎙️ Récompenses vocales :**\n> Vous gagnez \`100\` coins toutes les \`15\`minutes lorsque vous êtes en vocal (**NON MUTE** sinon c'est \`50\`coins).\n \n> **📺 Récompenses de streaming :**\n> Activer un stream vous fera gagner \`200\`.\n \n> **📷 Récompenses de caméra :**\n> Activer votre caméra vous fera gagner \`200\`.\n\n> Le coins est une monnaie fictive.`)
|
||||
.setDescription(`Voici le panel d'aide du bot. Pour plus d'informations sur une commande, utilisez ${prefix}help <commande>\n\n> **🎙️ Récompenses vocales :**\n> Vous gagnez \`100\` coins toutes les \`15\`minutes lorsque vous êtes en vocal (**NON MUTE** sinon c'est \`50\`coins).\n \n> **📺 Récompenses de streaming :**\n> Activer un stream vous fera gagner \`200\`.\n \n> **📷 Récompenses de caméra :**\n> Activer votre caméra vous fera gagner \`200\`.\n\n> Le coins est une monnaie fictive.`)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 1/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -67,7 +69,7 @@ module.exports = {
|
||||
const embedPage2 = new EmbedBuilder()
|
||||
.setTitle('💰・Casino')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'casino'))
|
||||
.setDescription(commandsList(client, 'casino', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 2/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -77,7 +79,7 @@ module.exports = {
|
||||
const embedPage3 = new EmbedBuilder()
|
||||
.setTitle('🎲・Jeux')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'jeux'))
|
||||
.setDescription(commandsList(client, 'jeux', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 3/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -87,7 +89,7 @@ module.exports = {
|
||||
const embedPage4 = new EmbedBuilder()
|
||||
.setTitle('🛍️・Achats')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'achats'))
|
||||
.setDescription(commandsList(client, 'achats', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 4/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -97,7 +99,7 @@ module.exports = {
|
||||
const embedPage5 = new EmbedBuilder()
|
||||
.setTitle('🏭・Metier et capacité')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'jobs'))
|
||||
.setDescription(commandsList(client, 'jobs', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 5/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -107,7 +109,7 @@ module.exports = {
|
||||
const embedPage6 = new EmbedBuilder()
|
||||
.setTitle('💼・Teams')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'teams'))
|
||||
.setDescription(commandsList(client, 'teams', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 6/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -117,7 +119,7 @@ module.exports = {
|
||||
const embedPage7 = new EmbedBuilder()
|
||||
.setTitle('🛡️・Teams administration')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'teams admin'))
|
||||
.setDescription(commandsList(client, 'teams admin', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 7/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -137,7 +139,7 @@ module.exports = {
|
||||
const embedPage9 = new EmbedBuilder()
|
||||
.setTitle('👑・Gestion')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'gestion'))
|
||||
.setDescription(commandsList(client, 'gestion', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 9/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
@@ -147,7 +149,7 @@ module.exports = {
|
||||
const embedPage10 = new EmbedBuilder()
|
||||
.setTitle('👑・Bot control')
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
.setDescription(commandsList(client, 'bot control'))
|
||||
.setDescription(commandsList(client, 'bot control', prefix))
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Page 10/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
const db = require('./database.js');
|
||||
|
||||
module.exports = async function getPrefix(serverId) {
|
||||
const prefix = await new Promise((resolve, reject) => {
|
||||
db.get(`SELECT * FROM config WHERE guildId = ? AND name = ?`, [serverId, 'prefix'], (err, row) => {
|
||||
if (err) reject(err);
|
||||
resolve(row);
|
||||
});
|
||||
});
|
||||
|
||||
return prefix ? prefix.value : '&';
|
||||
}
|
||||
Reference in New Issue
Block a user