Added guildmember add, remove, and update events
This commit is contained in:
parent
6663b76e6d
commit
89dac73ab3
3 changed files with 82 additions and 0 deletions
25
events/guildMemberAdd.js
Normal file
25
events/guildMemberAdd.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { event } = require('vylbot-core');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
const embedColor = "0x3050ba";
|
||||
const logchannel = "logs";
|
||||
|
||||
class guildmemberadd extends event {
|
||||
constructor() {
|
||||
super("guildmemberadd");
|
||||
}
|
||||
|
||||
guildmemberadd(member) {
|
||||
let embed = new MessageEmbed()
|
||||
.setTitle("Member Joined")
|
||||
.setColor(embedColor)
|
||||
.addField("User", `${member} \`${member.user.tag}\``)
|
||||
.addField("Created", `${member.user.createdAt}`)
|
||||
.setFooter(`User ID: ${member.user.id}`)
|
||||
.setThumbnail(member.user.displayAvatarURL({ type: 'png', dynamic: true }));
|
||||
|
||||
member.guild.channels.cache.find(channel => channel.name == logchannel).send(embed);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = guildmemberadd;
|
25
events/guildMemberRemove.js
Normal file
25
events/guildMemberRemove.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { event } = require('vylbot-core');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
const embedColor = "0x3050ba";
|
||||
const logchannel = "logs";
|
||||
|
||||
class guildmemberremove extends event {
|
||||
constructor() {
|
||||
super("guildmemberremove");
|
||||
}
|
||||
|
||||
guildmemberremove(member) {
|
||||
let embed = new MessageEmbed()
|
||||
.setTitle("Member Left")
|
||||
.setColor(embedColor)
|
||||
.addField("User", `${member} \`${member.user.tag}\``)
|
||||
.addField("Joined", `${member.joinedAt}`)
|
||||
.setFooter(`User ID: ${member.user.id}`)
|
||||
.setThumbnail(member.user.displayAvatarURL({ type: 'png', dynamic: true }));
|
||||
|
||||
member.guild.channels.cache.find(channel => channel.name == logchannel).send(embed);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = guildmemberremove;
|
32
events/guildMemberUpdate.js
Normal file
32
events/guildMemberUpdate.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
const { event } = require('vylbot-core');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
const embedColor = "0x3050ba";
|
||||
const logchannel = "logs";
|
||||
|
||||
class guildmemberupdate extends event {
|
||||
constructor() {
|
||||
super("guildmemberupdate");
|
||||
}
|
||||
|
||||
guildmemberupdate(oldMember, newMember) {
|
||||
if (oldMember.nickname != newMember.nickname) {
|
||||
let memberName = newMember.user.tag;
|
||||
let oldNickname = oldMember.nickname || "*none*";
|
||||
let newNickname = newMember.nickname || "*none*";
|
||||
|
||||
let embed = new MessageEmbed()
|
||||
.setTitle("Nickname Changed")
|
||||
.setColor(embedColor)
|
||||
.addField("User", `${newMember} \`${newMember.user.tag}\``)
|
||||
.addField("Before", oldNickname, true)
|
||||
.addField("After", newNickname, true)
|
||||
.setFooter(`User ID: ${newMember.user.id}`)
|
||||
.setThumbnail(newMember.user.displayAvatarURL({ type: 'png', dynamic: true }));
|
||||
|
||||
newMember.guild.channels.cache.find(channel => channel.name == lgochannel).send(embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = guildmemberupdate;
|
Loading…
Reference in a new issue