Add guildName et userName (pour facilité la lecture de la bd)

This commit is contained in:
*x1
2024-06-18 08:28:06 +02:00
parent 3194771634
commit ba95973f1b
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ module.exports = {
async execute(guild) {
db.run(`INSERT OR IGNORE INTO config (guildId, name, value) VALUES (?, ?, ?)`, [guild.id, 'prefix', '&']);
guild.members.cache.forEach(member => {
db.run(`INSERT OR IGNORE INTO users (guildId, userId) VALUES (?, ?)`, [guild.id, member.id]);
db.run(`INSERT OR IGNORE INTO users (guildId, guildName, userId, userName) VALUES (?, ?)`, [guild.id, guild.name, member.id, member.name]);
});
},
};
+1 -1
View File
@@ -4,6 +4,6 @@ const db = require('../fonctions/database.js');
module.exports = {
name: Events.GuildMemberAdd,
async execute(member) {
db.run(`INSERT INTO users (guildId, userId) VALUES (?, ?)`, [member.guild.id, member.id]);
db.run(`INSERT INTO users (guildId, guildName, userId, userName) VALUES (?, ?)`, [member.guild.id, member.guild.name, member.id, member.name]);
},
};
+2
View File
@@ -11,7 +11,9 @@ db.run(`CREATE TABLE IF NOT EXISTS config (
db.run(`CREATE TABLE IF NOT EXISTS users (
guildId TEXT,
guildName TEXT,
userId TEXT,
userName TEXT,
pocket INTEGER DEFAULT 0,
bank INTEGER DEFAULT 0,
reputation INTEGER DEFAULT 0,