refactor(events/guild): now using the new log system
This commit is contained in:
parent
a4c08eaae5
commit
3571cd8bb7
1 changed files with 14 additions and 7 deletions
|
|
@ -1,4 +1,10 @@
|
||||||
import { Events, Guild, EmbedBuilder, channelMention, Channel } from 'discord.js';
|
import {
|
||||||
|
Events,
|
||||||
|
Guild,
|
||||||
|
EmbedBuilder,
|
||||||
|
channelMention,
|
||||||
|
Channel,
|
||||||
|
} from 'discord.js';
|
||||||
import { prisma } from '@lib/prisma';
|
import { prisma } from '@lib/prisma';
|
||||||
import { Guild as GuildPrisma } from '@prisma/client';
|
import { Guild as GuildPrisma } from '@prisma/client';
|
||||||
|
|
||||||
|
|
@ -25,11 +31,14 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (guildData.logServer) {
|
if (guildData.logServer) {
|
||||||
let toPrint: string = 'The update of the guild had changes theses thing\n';
|
let toPrint: string =
|
||||||
const logChannel : Channel = await newGuild.client.channels
|
'The update of the guild had changes theses thing\n';
|
||||||
|
const logChannel: Channel = await newGuild.client.channels
|
||||||
.fetch(guildData.logServer)
|
.fetch(guildData.logServer)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
if (!logChannel.isTextBased()) {return;}
|
if (!logChannel.isTextBased()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (oldGuild.name !== newGuild.name) {
|
if (oldGuild.name !== newGuild.name) {
|
||||||
toPrint += `- Name:\n\`${oldGuild.name}\` => \`${newGuild.name}\`\n`;
|
toPrint += `- Name:\n\`${oldGuild.name}\` => \`${newGuild.name}\`\n`;
|
||||||
}
|
}
|
||||||
|
|
@ -61,9 +70,7 @@ export default {
|
||||||
})
|
})
|
||||||
.setDescription(toPrint);
|
.setDescription(toPrint);
|
||||||
logChannel.send({
|
logChannel.send({
|
||||||
embeds: [
|
embeds: [toRep],
|
||||||
toRep,
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue