This commit is contained in:
Isaac 2022-08-06 21:52:08 +01:00
parent 7b692facc1
commit 0a10d91f8d
No known key found for this signature in database
GPG Key ID: F4EAABEB0FFCC06A

View File

@ -9,7 +9,22 @@ module.exports = class extends Listener {
}); });
} }
run(guild) { /**
* @param {import("discord.js").Guild} guild
*/
async run(guild) {
/** @type {import("client")} */
const client = this.client;
this.client.log.success(`Added to guild "${guild.name}"`); this.client.log.success(`Added to guild "${guild.name}"`);
let settings = await client.prisma.guild.findUnique({ where: { id: guild.id } });
if (!settings) {
settings = await client.prisma.guild.create({
data: {
id: guild.id,
locale: client.i18n.locales.includes(guild.preferredLocale) ? guild.preferredLocale : 'en-GB',
},
});
}
} }
}; };