Revert "Update event (deso grose pagaille)"

This reverts commit 16d357208f.
This commit is contained in:
*x1
2024-05-28 21:46:20 +02:00
parent eaebe1f3db
commit c82c7ff03a
7 changed files with 20 additions and 46 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
const { Events } = require('discord.js');
const db = require('../fonctions/database.js');
module.exports = {
name: 'guildCreate',
name: Events.GuildCreate,
async execute(guild) {
db.run(`INSERT OR IGNORE INTO config (guildId, name, value) VALUES (?, ?, ?)`, [guild.id, 'prefix', '&']);
guild.members.cache.forEach(member => {
+2 -1
View File
@@ -1,7 +1,8 @@
const { Events } = require('discord.js');
const db = require('../fonctions/database.js');
module.exports = {
name: 'guildMemberAdd',
name: Events.GuildMemberAdd,
async execute(member) {
db.run(`INSERT INTO users (guildId, userId) VALUES (?, ?)`, [member.guild.id, member.id]);
},
+2 -3
View File
@@ -1,13 +1,12 @@
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js")
const { Events } = require('discord.js');
const db = require('../fonctions/database.js');
const embedColor = require('../fonctions/embedColor.js');
module.exports = {
name: 'interactionCreate',
name: Events.InteractionCreate,
async execute(client, interaction) {
if (interaction.customId === "lvl_Recomp_Rep") {
console.log('test ok')
const lvl = interaction.message.embeds[0].fields[0].value
const serv = interaction.message.embeds[0].fields[1].value
+4 -3
View File
@@ -1,10 +1,11 @@
const { Message, Events } = require("discord.js");
const db = require('../fonctions/database.js');
//const getPermissionLevel = require("../fonctions/getPermissionLevel");
module.exports = {
name: 'messageCreate',
async execute(client, message) {
if (message.channel.isDMBased() || message.author.bot) return;
name: Events.MessageCreate,
async execute(message, client) {
if (message.author.bot) return;
const prefix = db.get(`SELECT value FROM config WHERE guildId = ? AND name = ?`, [message.guild.id, 'prefix'])?.value || '&';
if (message.content.startsWith(prefix)) {
+4 -5
View File
@@ -1,10 +1,9 @@
const { ActionRowBuilder, ActionRow, ButtonBuilder, ButtonStyle, EmbedBuilder } = require("discord.js");
const { Message, Events, ActionRowBuilder, ActionRow, ButtonBuilder, EmbedBuilder } = require("discord.js");
const db = require('../fonctions/database.js');
const embedColor = require('../fonctions/embedColor.js');
module.exports = {
name: 'messageCreate',
async execute(client, message, args) {
name: Events.MessageCreate,
async execute(message, client) {
if (message.author.bot) return;
if (message.content.length < 50) {
@@ -26,7 +25,7 @@ module.exports = {
const embedlvl = new EmbedBuilder()
.setTitle('Nouveau niveau !')
.setDescription('Vous avez passé(e) un niveau sur **__' + message.guild.name + '__** !!\n\nVeuillez choisir une recompense :')
.setDescription('Vous avez passé(e) un niveau sur ' + message.guild.name + ' !!\n\nVeuillez choisir une recompense :')
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.addFields({ name: 'Le niveau passé :', value: `${user.lvl}`, inline: true })
+2 -2
View File
@@ -1,8 +1,8 @@
const { ActivityType } = require('discord.js');
const { Events, ActivityType } = require('discord.js');
const db = require('../fonctions/database.js');
module.exports = {
name: 'clientReady',
name: Events.ClientReady,
async execute(client) {
console.log(`[READY] ${client.user.tag} est prêt ||| ${client.guilds.cache.size.toLocaleString('fr-FR')} serveurs | ${client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0).toLocaleString('fr-FR')} utilisateurs\n`.green);
+4 -31
View File
@@ -1,42 +1,15 @@
const { Client, IntentsBitField, Collection } = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildWebhooks, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.GuildScheduledEvents, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
partials: [Partials.Channel, Partials.GuildMember, Partials.GuildScheduledEvent, Partials.Message, Partials.Reaction, Partials.ThreadMember, Partials.User],
restTimeOffset: 0,
failIfNotExists: false,
presence: {
activities: [{
name: `starting...`,
type: ActivityType.Custom,
}],
},
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: false
}
});
require('dotenv').config();
const color = require('colors')
const fs = require('fs')
const { Client, IntentsBitField, Collection } = require("discord.js");
const loadCommands = require("./fonctions/loadCommands");
const loadEvents = require("./fonctions/loadEvents");
const client = new Client({intents: new IntentsBitField(3276799)});
const color = require('colors')
client.events = new Collection();
client.commands = new Collection();
client.config = require("./config.json");
console.log(`${loadEvents(client, '..\\events')} events loaded`.grey);
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(client, ...args));
} else {
client.on(event.name, (...args) => event.execute(client, ...args));
}
}
console.log(`${loadCommands(client, '..\\commands')} commands loaded`.grey);
client.login(process.env.TOKEN);