small fixes and additions to examples, added deepFilter to list

This commit is contained in:
hydrabolt
2015-08-12 16:35:17 +01:00
parent 0013891764
commit 3e4f0fb74c
6 changed files with 96 additions and 43 deletions

View File

@@ -3,16 +3,24 @@
* joining or leaving.
*/
var Discord = require( "discord.js" );
var Discord = require( "../" );
var myBot = new Discord.Client();
myBot.login( "hello@example.com", "password1" );
// The "ready" event is triggered after the bot successfully connected to
// Discord and is ready to send messages.
myBot.on( "ready", function() {
console.log( "Bot connected successfully." );
} );
// The "presence" event is triggered when a user joins a server, leaves it or
// goes away.
// The status parameter can be "online", "offline" or "idle", respectively.
myBot.on( "presence", function( user, status, server ) {
// Send a message on the default channel of the server, as presence updates
// are not restricted to one channel.
bot.sendMessage( server.getDefaultChannel(), user.mention() + " is " + status + "!" );
var message = user.mention() + " is " + status + " in " + server.name + "!";
console.log(message);
this.sendMessage( server.getDefaultChannel(), message );
} );