mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
small fixes and additions to examples, added deepFilter to list
This commit is contained in:
@@ -3,11 +3,17 @@
|
||||
* access user avatars.
|
||||
*/
|
||||
|
||||
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." );
|
||||
} );
|
||||
|
||||
myBot.on( "message", function( message ) {
|
||||
// React to all messages with the content "$avatar"
|
||||
if ( message.content === "$avatar" ) {
|
||||
@@ -22,10 +28,10 @@ myBot.on( "message", function( message ) {
|
||||
// A user can be mentioned in a message by inserting the string obtained
|
||||
// by user.mention() into the message.
|
||||
// Note that simply writing "@user" will NOT work.
|
||||
bot.sendMessage( message.channel, message.author.mention() + ", here's your avatar: " + url );
|
||||
this.sendMessage( message.channel, message.author.mention() + ", here's your avatar: " + url );
|
||||
} else {
|
||||
// Nothing should be done if the user has not set an avatar.
|
||||
bot.sendMessage( message.channel, message.author.mention() + ", you don't have an avatar!" );
|
||||
this.sendMessage( message.channel, message.author.mention() + ", you don't have an avatar!" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user