diff --git a/src/listeners/client/guildCreate.js b/src/listeners/client/guildCreate.js index 5cfbb4c..6867f0f 100644 --- a/src/listeners/client/guildCreate.js +++ b/src/listeners/client/guildCreate.js @@ -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}"`); + 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', + }, + }); + } } };