Réécriture complète 4.0
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { Events, Guild } from 'discord.js'
|
||||
import dbGuildInit from '../../utils/dbGuildInit'
|
||||
import dbGuild from '../../schemas/guild'
|
||||
|
||||
export default {
|
||||
name: Events.GuildUpdate,
|
||||
async execute(oldGuild: Guild, newGuild: Guild) {
|
||||
console.log(`Guild ${oldGuild.name} updated`)
|
||||
|
||||
let guildProfile = await dbGuild.findOne({ guildId: newGuild.id })
|
||||
if (!guildProfile) guildProfile = await dbGuildInit(newGuild)
|
||||
else {
|
||||
guildProfile.guildName = newGuild.name
|
||||
guildProfile.guildIcon = newGuild.iconURL() ?? 'None'
|
||||
await guildProfile.save().catch(console.error)
|
||||
}
|
||||
}
|
||||
}
|
||||
import { Events } from "discord.js"
|
||||
import type { Guild } from "discord.js"
|
||||
import dbGuildInit from "@/utils/dbGuildInit"
|
||||
import dbGuild from "@/schemas/guild"
|
||||
import { logConsole } from "@/utils/console"
|
||||
|
||||
export const name = Events.GuildUpdate
|
||||
export async function execute(oldGuild: Guild, newGuild: Guild) {
|
||||
logConsole('discordjs', 'guild_update', { name: oldGuild.name })
|
||||
|
||||
let guildProfile = await dbGuild.findOne({ guildId: newGuild.id })
|
||||
if (!guildProfile) guildProfile = await dbGuildInit(newGuild)
|
||||
else {
|
||||
guildProfile.guildName = newGuild.name
|
||||
guildProfile.guildIcon = newGuild.iconURL() ?? "None"
|
||||
await guildProfile.save().catch(console.error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user