Merge branch 'master' into indev-prism

This commit is contained in:
Amish Shah
2017-02-22 20:37:59 +00:00
48 changed files with 738 additions and 420 deletions

View File

@@ -5,7 +5,7 @@
// import the discord.js module
const Discord = require('discord.js');
// create an instance of a Discord Client, and call it bot
// create an instance of a Discord Client
const client = new Discord.Client();
// the token of your bot - https://discordapp.com/developers/applications/me

33
docs/examples/greeting.js Normal file
View File

@@ -0,0 +1,33 @@
/*
A bot that welcomes new guild members when they join
*/
// import the discord.js module
const Discord = require('discord.js');
// create an instance of a Discord Client
const client = new Discord.Client();
// the token of your bot - https://discordapp.com/developers/applications/me
const token = 'your bot token here';
// the ID of the channel in which the bot will greet new users
const channelID = 'your channel ID here';
// the ready event is vital, it means that your bot will only start reacting to information
// from Discord _after_ ready is emitted.
client.on('ready', () => {
console.log('I am ready!');
});
// create an event listener for new guild members
client.on('guildMemberAdd', member => {
// get the channel by its ID
const channel = client.channels.get(channelID);
// send the message, mentioning the member
channel.sendMessage(`Welcome to the server, ${member}!`);
});
// log our bot in
client.login(token);

View File

@@ -43,7 +43,7 @@ Using opusscript is only recommended for development environments where node-opu
For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.
### Optional packages
- [bufferutil](https://www.npmjs.com/package/bufferutil) to greatly speed up the `ws` WebSocket connection (`npm install bufferutil --save`)
- [bufferutil](https://www.npmjs.com/package/bufferutil) to greatly speed up the WebSocket when *not* using uws (`npm install bufferutil --save`)
- [erlpack](https://github.com/hammerandchisel/erlpack) for significantly faster WebSocket data (de)serialisation (`npm install hammerandchisel/erlpack --save`)
- [sodium](https://www.npmjs.com/package/sodium) for faster voice packet encryption/decryption (`npm install sodium --save`)
- [uws](https://www.npmjs.com/package/uws) for a much faster WebSocket connection (`npm install uws --save`)

View File

@@ -18,5 +18,7 @@
path: ping.js
- name: Avatars
path: avatars.js
- name: Server greeting
path: greeting.js
- name: Webhook
path: webhook.js