ev5y

salut je veux faire un bot tools pour mion serveur en commande prefix je veux je vais lheberger sur kaabump je veux dedans

-1 systeme de ticket pousser avc comoment v2 -2 systeme de moderation kick mute warn tumeout -3 jveux que TOUT! sois log -4comamnde utile genre help cleat message jte laisse faire tes propo -5 suysteme de permission on peux en cree metre des perm dessus

Kodari AI
KodariAug 22 at 11:45 pm 2
KaabumpToolbox
A Discord bot for Kaabump hosting with prefix commands. Features a ticket system with comments (v2), moderation commands including kick, mute, warn, and timeout, comprehensive logging for all actions, utility commands like help and clear messages, and a customizable permission system allowing creation and assignment of custom permissions to roles and users.
  1. Créer le socle Node.js/discord.js prêt pour Kaabump.

  2. Ajouter les commandes préfixées utiles et la modération.

  3. Ajouter les tickets avec boutons, modal, prise en charge, fermeture et transcript.

  4. Ajouter la journalisation des actions/événements et les permissions personnalisées.

  5. Ajouter la configuration, la persistance JSON et les instructions de déploiement.

Projet initialisé avec :

  • Bot Node.js/discord.js à commandes préfixées.

  • Tickets avancés avec bouton, modal, catégorie automatique, rôle support, prise en charge, fermeture, suppression et transcripts.

  • Modération : kick, ban, mute, timeout, unmute, warn, warnings, clear.

  • Logs des messages, suppressions, modifications, membres, bans, salons, rôles, vocaux, commandes et tickets.

  • Permissions personnalisées par rôle avec !perm add/remove/list et création de rôles.

  • Persistance automatique dans data/database.json.

  • Configuration Kaabump et instructions dans README.md.

Pour démarrer :

Shell
npm install
cp .env.example .env

Ajoute le token dans .env, puis lance :

Shell
npm start

Après invitation du bot :

Plain Text
!logs setup
!ticket setup
!ticket support @Support
!help
Kodari can make mistakes. Review important code before using.
Files
src
.gitignore
config.json
package.json
README.md
Code
14 793
src/index.js
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const config = require('./config');
const logger = require('./logger');
const permissions = require('./permissions');
const { parseArgs, truncate } = require('./utils');
const utility = require('./utility');
const moderation = require('./moderation');
const tickets = require('./tickets');
const permissionCommands = require('./permissions-command');

if (!config.token) {
  console.error('DISCORD_TOKEN est manquant dans le fichier .env.');
  process.exit(1);
}

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildBans,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildVoiceStates
  ],
  partials: [Partials.Message, Partials.Channel, Partials.GuildMember, Partials.User]
});

const commandList = [
  ...utility.createCommands(),
  ...moderation.createCommands(),
  ...tickets.createCommands(),
  ...permissionCommands.createCommands()
];
const commands = new Map();
for (const command of commandList) {
  commands.set(command.name, command);
  for (const alias of command.aliases || []) commands.set(alias, command);
}

client.once('ready', () => {
  console.log(`Bot prêt : ${client.user.tag} | préfixe ${config.prefix}`);
  client.user.setActivity(`${config.prefix}help`, { type: 0 });
});

client.on('messageCreate', async (message) => {
  if (message.author.bot || !message.guild) return;
  await logger.logMessage(message);
  if (!message.content.startsWith(config.prefix)) return;
  const content = message.content.slice(config.prefix.length).trim();
  if (!content) return;
  const args = parseArgs(content);
  const name = args.shift().toLowerCase();
  const command = commands.get(name);
  if (!command) return;
  if (command.permission && !(await permissions.requirePermission(message, command.permission))) {
    await logger.logEvent(message.guild, 'PERMISSION DENIED', `${message.author.tag} a tenté la commande ${config.prefix}${name}`, message.author);
    return;
  }
  try {
    await command.execute({ message, args, client, commands: commandList, commandName: name });
    await logger.logEvent(message.guild, 'COMMAND', `${message.author.tag} : ${truncate(message.content, 500)}`);
  } catch (error) {
    console.error(`Erreur commande ${name}:`, error);
    await logger.logEvent(message.guild, 'ERROR', `Commande ${name} : ${error.stack || error.message}`);
    if (!message.replied && !message.deferred) await message.reply('Une erreur est survenue pendant l’exécution de la commande.');
  }
});

client.on('interactionCreate', async (interaction) => {
  try {
    await tickets.handleInteraction(interaction);
  } catch (error) {
    console.error('Erreur interaction:', error);
    if (!interaction.replied && !interaction.deferred) await interaction.reply({ content: 'Une erreur est survenue.', ephemeral: true });
  }
});

client.on('messageDelete', async (message) => {
  if (message.guild && !message.author?.bot) await logger.logEvent(message.guild, 'MESSAGE DELETE', `#${message.channel?.name || 'inconnu'} — ${message.author?.tag || 'inconnu'}\n${truncate(message.content || '[sans texte]', 1800)}`);
});

client.on('messageUpdate', async (oldMessage, newMessage) => {
  if (!newMessage.guild || newMessage.author?.bot || oldMessage.content === newMessage.content) return;
  await logger.logEvent(newMessage.guild, 'MESSAGE EDIT', `#${newMessage.channel?.name || 'inconnu'} — ${newMessage.author?.tag || 'inconnu'}\nAvant : ${truncate(oldMessage.content, 800)}\nAprès : ${truncate(newMessage.content, 800)}`);
});

client.on('guildMemberAdd', (member) => logger.logEvent(member.guild, 'MEMBER JOIN', `${member.user.tag} (${member})`));
client.on('guildMemberRemove', (member) => logger.logEvent(member.guild, 'MEMBER LEAVE', `${member.user?.tag || member.id}`));
client.on('guildMemberUpdate', (oldMember, newMember) => {
  if (oldMember.nickname !== newMember.nickname) logger.logEvent(newMember.guild, 'MEMBER UPDATE', `${newMember.user.tag} — pseudo : ${oldMember.nickname || 'aucun'} → ${newMember.nickname || 'aucun'}`);
});
client.on('guildBanAdd', (ban) => logger.logEvent(ban.guild, 'BAN ADD', `${ban.user.tag}`));
client.on('guildBanRemove', (ban) => logger.logEvent(ban.guild, 'BAN REMOVE', `${ban.user.tag}`));
client.on('channelCreate', (channel) => channel.guild && logger.logEvent(channel.guild, 'CHANNEL CREATE', `${channel}`));
client.on('channelDelete', (channel) => channel.guild && logger.logEvent(channel.guild, 'CHANNEL DELETE', `#${channel.name}`));
client.on('channelUpdate', (oldChannel, newChannel) => newChannel.guild && oldChannel.name !== newChannel.name && logger.logEvent(newChannel.guild, 'CHANNEL UPDATE', `${oldChannel.name} → ${newChannel.name}`));
client.on('roleCreate', (role) => logger.logEvent(role.guild, 'ROLE CREATE', `${role}`));
client.on('roleDelete', (role) => logger.logEvent(role.guild, 'ROLE DELETE', `${role.name}`));
client.on('roleUpdate', (oldRole, newRole) => newRole.guild && oldRole.name !== newRole.name && logger.logEvent(newRole.guild, 'ROLE UPDATE', `${oldRole.name} → ${newRole.name}`));
client.on('voiceStateUpdate', (oldState, newState) => {
  if (!newState.guild || oldState.channelId === newState.channelId) return;
  const action = newState.channelId ? 'VOICE JOIN' : 'VOICE LEAVE';
  logger.logEvent(newState.guild, action, `${newState.member?.user.tag || newState.id} — ${newState.channel?.name || oldState.channel?.name || 'inconnu'}`);
});

client.on('error', (error) => console.error('Discord client error:', error));
client.on('warn', (warning) => console.warn('Discord warning:', warning));

client.login(config.token);