guildMemberAdd Updated

This commit is contained in:
ItzEmerald committed 2020-06-20 16:10:27 +01:00
1 parent 3077772aff
commit 63b08f8c12
1 file changed
+6 -6
+6 -6
View File
@@ -7,25 +7,25 @@ const fs = require("fs");
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
module.exports = async (bot, member) => {
module.exports = async (bot) => {
if (supportbot.SystemMessages === "true") { if (supportbot.SystemMessages === "true") {
const SystemChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel)
if (!SystemChannel) return; if (!SystemChannel) return;
if (supportbot.SystemMessage_Type === "embed") { if (supportbot.SystemMessage_Type === "embed") {
const GuildAddMember = new Discord.MessageEmbed() const GuildAddMember = new Discord.MessageEmbed()
.setTitle(supportbot.Welcome_Title) .setTitle(supportbot.Welcome_Title)
.setDescription(supportbot.WelcomeMessage.replace(/%member%/g, message.member.user.username).replace(/%guildname%/g, guild.name)) .setDescription(supportbot.WelcomeMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if (supportbot.WelcomeMessage_Icon === "BOT") { if (supportbot.WelcomeMessage_Icon === "BOT") {
GuildAddMember.setThumbnail(message.author.displayAvatarURL()) GuildAddMember.setThumbnail(bot.displayAvatarURL())
} }
if (supportbot.WelcomeMessage_Icon === "USER") { if (supportbot.WelcomeMessage_Icon === "USER") {
GuildAddMember.setThumbnail(message.member.displayAvatarURL()) GuildAddMember.setThumbnail(member.displayAvatarURL())
} }
@@ -38,7 +38,7 @@ module.exports = async (bot) => {
} }
if (supportbot.SystemMessage_Type === "normal") { if (supportbot.SystemMessage_Type === "normal") {
SystemChannel.send(supportbot.WelcomeMessage.replace(/%member%/g, message.member.user.username).replace(/%guildname%/g, guild.name)) SystemChannel.send(supportbot.WelcomeMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
if (supportbot.AutoRole === "true") { if (supportbot.AutoRole === "true") {
member.roles.add(supportbot.AutoRole_Role) member.roles.add(supportbot.AutoRole_Role)