mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 15:07:26 +02:00
9bd39c69ca
sinon il y a pleins de truc comme les anti raid , des coorectif ect
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
const { EmbedBuilder } = require('discord.js');
|
|
const sqlite3 = require('sqlite3').verbose();
|
|
const db = new sqlite3.Database('myDatabase.db');
|
|
module.exports = {
|
|
name: 'invite',
|
|
description: 'Affiche le nombre d\'invitations d\'un utilisateur.',
|
|
emote: '📈',
|
|
utilisation: 'invite [@user/id]',
|
|
category: 'invitation',
|
|
|
|
async execute(message, args, client) {
|
|
let memberId = message.mentions.users.first()?.id ||client.users.cache.get(args[0])?.id || message.author.id;
|
|
|
|
getInviteCount(message.guild.id, memberId, (inviteCount) => {
|
|
const embed = new EmbedBuilder()
|
|
.setColor('#0099ff')
|
|
.setTitle('Nombre d\'invitations')
|
|
.setDescription(`<@${memberId}> a invité ${inviteCount} personnes.`);
|
|
|
|
message.reply({ embeds: [embed] });
|
|
});
|
|
},
|
|
};
|
|
|
|
function getInviteCount(guildId, memberId, callback) {
|
|
const db = new sqlite3.Database('myDatabase.db');
|
|
db.get(`SELECT invite_count FROM invitations WHERE guild_id = ? AND member_id = ?`,
|
|
[guildId, memberId], (err, row) => {
|
|
if (err) {
|
|
return console.error(err.message);
|
|
}
|
|
callback(row ? row.invite_count : 0);
|
|
});
|
|
} |