Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!80
This commit is contained in:
35
events/server/guildMemberAdd/logNewJoins.js
Normal file
35
events/server/guildMemberAdd/logNewJoins.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const { userMention } = require('discord.js');
|
||||||
|
const { color, botLogChannel } = require('../../../config/options.json');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'logNewJoins',
|
||||||
|
description: 'Logs new joins',
|
||||||
|
type: 'event',
|
||||||
|
event: 'guildMemberAdd',
|
||||||
|
|
||||||
|
/** @param { import('discord.js').GuildMember } member */
|
||||||
|
execute(member) {
|
||||||
|
|
||||||
|
const channel = member.guild.channels.cache.get(botLogChannel);
|
||||||
|
const embedColor = Number(color.replace('#', '0x'));
|
||||||
|
|
||||||
|
if (!channel) {
|
||||||
|
console.log(`[ERROR] Could not find channel used for new join logging.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel.send({
|
||||||
|
embeds: [{
|
||||||
|
title: "New Member",
|
||||||
|
description: userMention(member.id) + " has joined the server.\n" +
|
||||||
|
"Account created: " + member.user.createdAt.toLocaleString(),
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: "ID: " + member.id
|
||||||
|
},
|
||||||
|
timestamp: new Date()
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,8 @@ module.exports = {
|
|||||||
event: 'ready',
|
event: 'ready',
|
||||||
|
|
||||||
execute(client) {
|
execute(client) {
|
||||||
if (process.env.NODE_ENV !== 'dev') {
|
if (process.env.NODE_ENV === 'dev') return
|
||||||
|
|
||||||
const channel = client.channels.cache.get(onlineLogChannel);
|
const channel = client.channels.cache.get(onlineLogChannel);
|
||||||
const embedColor = Number(color.replace('#', '0x'))
|
const embedColor = Number(color.replace('#', '0x'))
|
||||||
|
|
||||||
@@ -23,5 +24,4 @@ module.exports = {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,19 @@ module.exports = {
|
|||||||
|
|
||||||
execute(oldState, newState) {
|
execute(oldState, newState) {
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'dev') return
|
||||||
|
|
||||||
|
const channel = guild.channels.cache.get(botLogChannel)
|
||||||
|
const embedColor = Number(color.replace('#', '0x'))
|
||||||
|
|
||||||
|
if (!channel) {
|
||||||
|
console.log(`[ERROR] Could not find channel used for voice channel join/leave logging.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const oldChannel = oldState.channel
|
const oldChannel = oldState.channel
|
||||||
const newChannel = newState.channel
|
const newChannel = newState.channel
|
||||||
const guild = oldState.guild
|
const guild = oldState.guild
|
||||||
const channel = guild.channels.cache.get(botLogChannel)
|
|
||||||
const embedColor = Number(color.replace('#', '0x'))
|
|
||||||
|
|
||||||
if (oldChannel === null && newChannel !== null) {
|
if (oldChannel === null && newChannel !== null) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user