A powerful JavaScript library for interacting with the Discord API
Find a file
2015-08-14 16:02:40 +01:00
examples Fixed crucial bug in example 2015-08-13 23:05:21 +01:00
hydrabot Added more functionality 2015-08-14 16:02:40 +01:00
lib Added more properties to the server 2015-08-14 11:48:44 +01:00
.gitignore ignore hydrabot auth details 2015-08-14 13:25:47 +01:00
index.js Allow the class objects to be accessed 2015-08-14 13:37:07 +01:00
LICENSE Initial commit 2015-08-10 14:36:26 +01:00
package.json 2.2.2 2015-08-14 00:01:54 +01:00
README.md nice readme! :D 2015-08-14 00:01:30 +01:00

discord.js

Discord.js is a node module that allows you to interface with the Discord API for creation of things such as bots or loggers.

The aim of this API is to make it really simple to start developing your bots. This API has server, channel and user tracking, as well as tools to make identification really simple.

For more information, click here.

Installation

npm install discord.js

Features

  • Send, Receive and Delete messages from channels and DMs! Auto-initiates DMs for you!
  • Create, Delete and Leave servers and channels
  • Create invites for Servers
  • Silent Mention - trigger mention notification without actually @mentioning a user!
  • Get complete metadata on users, channels and servers - including avatars.
  • Get limitless logs from channels.

Example usage

/*
 * A basic bot that shows how to connect to a Discord account,
 * how to listen to messages and how to send messages.
 *
 * This bot responds to every "ping" message with a "pong".
 */

var Discord = require( "discord.js" );

// Create the bot
var myBot = new Discord.Client();

// Login with an example email and password
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." );
} );

// Add a listener to the "message" event, which triggers upon receiving
// any message
myBot.on( "message", function( message ) {
	// message.content accesses the content of the message as a string.
	// If it is equal to "ping", then the bot should respond with "pong".
	if ( message.content === "ping" ) {
		// Send a message ("pong") to the channel the message was sent in,
		// which is accessed by message.channel.
		this.sendMessage( message.channel, "pong" );
	}
} );

TODO

  • Joining servers from an invite
  • Stealthy Ninja support