mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
small fixes and additions to examples, added deepFilter to list
This commit is contained in:
@@ -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 );
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user