Skip to content

Commit

Permalink
v10 prep
Browse files Browse the repository at this point in the history
  • Loading branch information
amishshah committed Oct 26, 2016
2 parents c7c5e5e + ecee076 commit 62cfa10
Show file tree
Hide file tree
Showing 91 changed files with 3,394 additions and 1,093 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -35,4 +35,8 @@ build/Release
node_modules
test/auth.json
examples/auth.json
docs/_build
docs/_build

# Secret keys
docs/deploy/deploy_key
docs/deploy/deploy_key.pub
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -5,3 +5,9 @@ cache:
directories:
- node_modules
install: npm install
script: bash ./docs/deploy/deploy.sh
env:
global:
- ENCRYPTION_LABEL: "af862fa96d3e"
- COMMIT_AUTHOR_EMAIL: "amishshah.2k@gmail.com"

8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Expand Up @@ -7,8 +7,8 @@ is a great boon to your coding process.
To get ready to work on the codebase, please do the following:

1. Fork & clone the repository
2. Run `npm install`, or `npm install --no-optional` if you're not working on voice
3. Code your heart out!
4. Run `npm test` to run ESLint
5. Run `npm run docs` to build any documentation changes
2. Run `npm install`
3. If you're working on voice, also run `npm install node-opus` or `npm install opusscript`
4. Code your heart out!
5. Run `npm test` to run ESLint and ensure any JSDoc changes are valid
6. [Submit a pull request](https://github.com/hydrabolt/discord.js/compare)
37 changes: 23 additions & 14 deletions README.md
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://hydrabolt.github.io/discord.js">
<img alt="discord.js" src="http://i.imgur.com/sPOLh9y.png" width="546"><br />
<img alt="discord.js" src="http://i.imgur.com/0af7LDs.png" width="546"><br />
</a>
</p>

Expand All @@ -16,12 +16,14 @@ discord.js is a powerful node.js module that allows you to interact with the [Di

## Installation
**Node.js 6.0.0 or newer is required.**
With voice support: `npm install --save discord.js --production`
Without voice support: `npm install --save discord.js --production --no-optional`
Without voice support: `npm install discord.js --save`
With voice support ([node-opus](https://www.npmjs.com/package/node-opus)): `npm install discord.js node-opus --save`
With voice support ([opusscript](https://www.npmjs.com/package/opusscript)): `npm install discord.js opusscript --save`
If both audio packages are installed, discord.js will automatically choose node-opus.

By default, discord.js uses [opusscript](https://www.npmjs.com/package/opusscript) when playing audio over voice connections.
If you're looking to play over multiple voice connections, it might be better to install [node-opus](https://www.npmjs.com/package/node-opus).
discord.js will automatically prefer node-opus over opusscript.
The preferred audio engine is node-opus, as it performs significantly better than opusscript.
Using opusscript is only recommended for development on Windows, since getting node-opus to build there can be a bit of a challenge.
For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.

## Example Usage
```js
Expand All @@ -41,17 +43,24 @@ client.on('message', message => {
client.login('your token');
```

A bot template using discord.js can be generated using [generator-discordbot](https://www.npmjs.com/package/generator-discordbot).

## Links
* [Website](http://hydrabolt.github.io/discord.js/)
* [Discord.js Server](https://discord.gg/bRCvFy9)
* [Discord API Server](https://discord.gg/rV4BwdK)
* [Discord.js server](https://discord.gg/bRCvFy9)
* [Discord API server](https://discord.gg/rV4BwdK)
* [Documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master)
* [Legacy Documentation](http://discordjs.readthedocs.io/en/8.1.0/docs_client.html)
* [Legacy (v8) documentation](http://discordjs.readthedocs.io/en/8.2.0/docs_client.html)
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
* [GitHub](https://github.com/hydrabolt/discord.js)
* [NPM](https://www.npmjs.com/package/discord.js)
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
* [Related Libraries](https://discordapi.com/unofficial/libs.html)
* [Related libraries](https://discordapi.com/unofficial/libs.html)

## Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
[documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master).
See [the contributing guide](CONTRIBUTING.md) if you'd like to submit a PR.

## Contact
Before reporting an issue, please read the [documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master).
If you can't find help there, you can ask in the official [Discord.js Server](https://discord.gg/bRCvFy9).
## Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
nudge in the right direction, please don't hesitate to join our official [Discord.js Server](https://discord.gg/bRCvFy9).
2 changes: 2 additions & 0 deletions docs/README.md
@@ -0,0 +1,2 @@
# discord.js docs
[View documentation here](http://hydrabolt.github.io/discord.js/#!/docs/)
24 changes: 13 additions & 11 deletions docs/custom/documents/welcome.md
Expand Up @@ -20,28 +20,30 @@ stable and performant than previous versions.

## Installation
**Node.js 6.0.0 or newer is required.**
With voice support: `npm install --save discord.js --production`
Without voice support: `npm install --save discord.js --production --no-optional`
Without voice support: `npm install discord.js --save`
With voice support ([node-opus](https://www.npmjs.com/package/node-opus)): `npm install discord.js node-opus --save`
With voice support ([opusscript](https://www.npmjs.com/package/opusscript)): `npm install discord.js opusscript --save`
If both audio packages are installed, discord.js will automatically prefer node-opus.

By default, discord.js uses [opusscript](https://www.npmjs.com/package/opusscript) when playing audio over voice connections.
If you're looking to play over multiple voice connections, it might be better to install [node-opus](https://www.npmjs.com/package/node-opus).
discord.js will automatically prefer node-opus over opusscript.
The preferred audio engine is node-opus, as it performs significantly better than opusscript.
Using opusscript is only recommended for development on Windows, since getting node-opus to build there can be a bit of a challenge.
For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.

## Guides
* [LuckyEvie's general guide](https://eslachance.gitbooks.io/discord-js-bot-guide/content/)
* [York's v9 upgrade guide](https://yorkaargh.wordpress.com/2016/09/03/updating-discord-js-bots/)

## Links
* [Website](http://hydrabolt.github.io/discord.js/)
* [Discord.js Server](https://discord.gg/bRCvFy9)
* [Discord API Server](https://discord.gg/rV4BwdK)
* [Discord.js server](https://discord.gg/bRCvFy9)
* [Discord API server](https://discord.gg/rV4BwdK)
* [Documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master)
* [Legacy Documentation](http://discordjs.readthedocs.io/en/8.1.0/docs_client.html)
* [Legacy (v8) documentation](http://discordjs.readthedocs.io/en/8.2.0/docs_client.html)
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
* [GitHub](https://github.com/hydrabolt/discord.js)
* [NPM](https://www.npmjs.com/package/discord.js)
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
* [Related Libraries](https://discordapi.com/unofficial/libs.html)
* [Related libraries](https://discordapi.com/unofficial/libs.html)

## Help
If you don't understand something in this documentation, you are experiencing problems, or you just need a gentle
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
nudge in the right direction, please don't hesitate to join our official [Discord.js Server](https://discord.gg/bRCvFy9).
12 changes: 12 additions & 0 deletions docs/custom/examples/webhook.js
@@ -0,0 +1,12 @@
/*
Send a message using a webhook
*/

// import the discord.js module
const Discord = require('discord.js');

// create a new webhook
const hook = new Discord.WebhookClient('webhook id', 'webhook token');

// send a message using the webhook
hook.sendMessage('I am now alive!');
10 changes: 10 additions & 0 deletions docs/custom/webhook.js
@@ -0,0 +1,10 @@
const fs = require('fs');

module.exports = {
category: 'Examples',
name: 'Webhooks',
data:
`\`\`\`js
${fs.readFileSync('./docs/custom/examples/webhook.js').toString('utf-8')}
\`\`\``,
};
68 changes: 68 additions & 0 deletions docs/deploy/deploy.sh
@@ -0,0 +1,68 @@
#!/bin/bash
# Adapted from https://gist.github.com/domenic/ec8b0fc8ab45f39403dd.

set -e

function build {
node docs/generator/generator.js
}

# Ignore Travis checking PRs
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "deploy.sh: Ignoring PR build"
build
exit 0
fi

# Ignore travis checking other branches irrelevant to users
if [ "$TRAVIS_BRANCH" != "master" -a "$TRAVIS_BRANCH" != "indev" ]; then
echo "deploy.sh: Ignoring push to another branch than master/indev"
build
exit 0
fi

SOURCE=$TRAVIS_BRANCH

# Make sure tag pushes are handled
if [ -n "$TRAVIS_TAG" ]; then
echo "deploy.sh: This is a tag build, proceeding accordingly"
SOURCE=$TRAVIS_TAG
fi

REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`

TARGET_BRANCH="docs"

# Checkout the repo in the target branch so we can build docs and push to it
git clone $REPO out -b $TARGET_BRANCH
cd out
cd ..

# Build the docs
build

# Move the generated JSON file to the newly-checked-out repo, to be committed
# and pushed
mv docs/docs.json out/$SOURCE.json

# Commit and push
cd out
git config user.name "Travis CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"

git add .
git commit -m "Docs build: ${SHA}"

ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../docs/deploy/deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key

# Now that we're all set up, we can push.
git push $SSH_REPO $TARGET_BRANCH
Binary file added docs/deploy/deploy_key.enc
Binary file not shown.
1 change: 0 additions & 1 deletion docs/docs.json

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "discord.js",
"version": "9.3.1",
"version": "10.0.0",
"description": "A powerful library for interacting with the Discord API",
"main": "./src/index",
"scripts": {
Expand Down Expand Up @@ -28,17 +28,17 @@
"dependencies": {
"superagent": "^2.2.0",
"tweetnacl": "^0.14.3",
"ws": "^1.1.1",
"ws": "^1.1.1"
},
"peerDependencies": {
"node-opus": "^0.2.1",
"opusscript": "^0.0.1"
},
"devDependencies": {
"fs-extra": "^0.30.0",
"jsdoc-parse": "^1.2.0",
"eslint": "^3.4.0"
},
"optionalDependencies": {
"node-opus": "^0.2.1"
},
"engines": {
"node": ">=6.0.0"
}
Expand Down

0 comments on commit 62cfa10

Please sign in to comment.