Skip to content
12 changes: 12 additions & 0 deletions bot/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,16 @@ client.on('message', (message) => {
}
});

// Event listener for new members
client.on('guildMemberAdd', (member) => {
// Send welcome message to members who join
member.sendMessage(`${member}, Welcome to the Full Sail Armada! These are the terms of service...`);
Copy link

@mattpezzente mattpezzente May 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sendMessage" is being deprecated, please change those methods to just "send" before continuing.

// Send message to specific channel on the server
const channel = member.guild.channels.find('name', 'general');
// If channel is not found do nothing
if (!channel) return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a non-intuitive way to 'do nothing'.

// Send message with members name
channel.sendMessage(`Welcome to the Full Sail Armada ${member}! for more information use !help`);
});

client.login(process.env.TOKEN);
24 changes: 24 additions & 0 deletions bot/controllers/welcome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const BaseController = require('../baseController.js');
const Command = require('../baseCommand.js');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in the default comments found across the controllers to your welcome.js file.

class WelcomeController extends BaseController {
constructor(message) {
super(message);
const controller = this;
this.commands = [
new Command(
'!welcome',
'!welcome',
'Welcome Message',
'Replays welcome message.',
this.welcomeAction.bind(controller),
'dm',
),
];
}
welcomeAction() {
const { message } = this;
return `${message.author.username}, Welcome to the Full Sail Armada! These are the terms of service...`;
}
}
module.exports = WelcomeController;