diff --git a/src/events/guildMemberAdd.js b/src/events/guildMemberAdd.js new file mode 100644 index 0000000..5da4c13 --- /dev/null +++ b/src/events/guildMemberAdd.js @@ -0,0 +1,20 @@ +const {GuildMember, MessageEmbed} = require('discord.js'); + +module.exports = { + name: "guildMemberAdd", + /** + * + * @param {GuildMember} member + */ + execute(member) { + member.guild.channels.cache.get("814661833642344520").send({ + embeds: [ + new MessageEmbed() + .setTitle("Moin") + .setDescription(`Moin ${member.toString()}! Wilkommen und viel Spaß.`) + .setThumbnail(member.user.displayAvatarURL()) + .setColor("BLURPLE") + ] + }) + } +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 5258f4c..57fcfe4 100644 --- a/src/index.js +++ b/src/index.js @@ -7,12 +7,17 @@ const client = new Client({intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_V client.commands = new Collection() const CommandFiles = fs.readdirSync("./src/commands").filter(file => file.endsWith(".js")) - CommandFiles.forEach(CommandFile => { const command = require(`./commands/${CommandFile}`) client.commands.set(command.data.name, command) }) +const EventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js")) +EventFiles.forEach(EventFile => { + const event = require(`./events/${EventFile}`) + client.on(event.name, (...args) => event.execute(...args)) +}) + client.once('ready', () => { console.log(`Ready! Logged in as ${client.user.tag}! I'm on ${client.guilds.cache.size} guild(s)!`); client.user.setActivity({