mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-11 11:21:00 +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,34 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user