mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 03:31:03 +00:00
Add some more comments to the example
This commit is contained in:
parent
bbb5d4c7a1
commit
4a18ac72ce
1 changed files with 2 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ client.on('ready', () => {
|
||||||
|
|
||||||
// Create an event listener for new guild members
|
// Create an event listener for new guild members
|
||||||
client.on('guildMemberAdd', member => {
|
client.on('guildMemberAdd', member => {
|
||||||
// Send the message, mentioning the member
|
// Send the message, mentioning the member to the guilds default channel (usually #general)
|
||||||
member.guild.defaultChannel.send(`Welcome to the server, ${member}!`);
|
member.guild.defaultChannel.send(`Welcome to the server, ${member}!`);
|
||||||
|
|
||||||
// If you want to send the message to a designated channel on a server instead
|
// If you want to send the message to a designated channel on a server instead
|
||||||
|
|
@ -27,6 +27,7 @@ client.on('guildMemberAdd', member => {
|
||||||
const channel = member.guild.channels.find('name', 'member-log');
|
const channel = member.guild.channels.find('name', 'member-log');
|
||||||
// Do nothing if the channel wasn't found on this server
|
// Do nothing if the channel wasn't found on this server
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
// Send the message, mentioning the member
|
||||||
channel.send(`Welcome to the server, ${member}`);
|
channel.send(`Welcome to the server, ${member}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue