mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-12 15:56:25 +02:00
trop de truc pour tout ecrire
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
const { Events } = require("discord.js");
|
||||
module.exports = {
|
||||
name: Events.MessageCreate,
|
||||
async execute(message) {
|
||||
if (message.author.bot) return;
|
||||
db.get('SELECT value FROM gestion WHERE id = ?', [message.client.user.id], async (err, row) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = row ? JSON.parse(row.value) : {};
|
||||
const guildData = data[message.guild.id];
|
||||
|
||||
if (guildData && guildData.autoreact && guildData.autoreact[message.channel.id]) {
|
||||
const emojis = guildData.autoreact[message.channel.id];
|
||||
|
||||
try {
|
||||
await Promise.all(emojis.map(emoji => message.react(emoji)));
|
||||
} catch (error) {
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user