From 29433e2f7dbd0e4a73d3c78ffe1005b922fb5982 Mon Sep 17 00:00:00 2001 From: Alee14 Date: Sun, 26 Mar 2017 15:18:10 -0400 Subject: Don't mind me i'm adding the discord.js files --- node_modules/discord.js/docs/README.md | 1 + node_modules/discord.js/docs/examples/avatars.js | 30 ++++++ node_modules/discord.js/docs/examples/ping.js | 30 ++++++ node_modules/discord.js/docs/examples/webhook.js | 12 +++ node_modules/discord.js/docs/general/faq.md | 23 ++++ node_modules/discord.js/docs/general/updating.md | 128 +++++++++++++++++++++++ node_modules/discord.js/docs/general/welcome.md | 72 +++++++++++++ node_modules/discord.js/docs/index.yml | 16 +++ node_modules/discord.js/docs/logo.svg | 19 ++++ 9 files changed, 331 insertions(+) create mode 100644 node_modules/discord.js/docs/README.md create mode 100644 node_modules/discord.js/docs/examples/avatars.js create mode 100644 node_modules/discord.js/docs/examples/ping.js create mode 100644 node_modules/discord.js/docs/examples/webhook.js create mode 100644 node_modules/discord.js/docs/general/faq.md create mode 100644 node_modules/discord.js/docs/general/updating.md create mode 100644 node_modules/discord.js/docs/general/welcome.md create mode 100644 node_modules/discord.js/docs/index.yml create mode 100644 node_modules/discord.js/docs/logo.svg (limited to 'node_modules/discord.js/docs') diff --git a/node_modules/discord.js/docs/README.md b/node_modules/discord.js/docs/README.md new file mode 100644 index 0000000..b5ac797 --- /dev/null +++ b/node_modules/discord.js/docs/README.md @@ -0,0 +1 @@ +## [View the documentation here.](https://discord.js.org/#/docs) diff --git a/node_modules/discord.js/docs/examples/avatars.js b/node_modules/discord.js/docs/examples/avatars.js new file mode 100644 index 0000000..796d942 --- /dev/null +++ b/node_modules/discord.js/docs/examples/avatars.js @@ -0,0 +1,30 @@ +/* + Send a user a link to their avatar +*/ + +// import the discord.js module +const Discord = require('discord.js'); + +// create an instance of a Discord Client, and call it bot +const bot = new Discord.Client(); + +// the token of your bot - https://discordapp.com/developers/applications/me +const token = 'your bot token here'; + +// the ready event is vital, it means that your bot will only start reacting to information +// from Discord _after_ ready is emitted. +bot.on('ready', () => { + console.log('I am ready!'); +}); + +// create an event listener for messages +bot.on('message', message => { + // if the message is "what is my avatar", + if (message.content === 'what is my avatar') { + // send the user's avatar URL + message.reply(message.author.avatarURL); + } +}); + +// log our bot in +bot.login(token); diff --git a/node_modules/discord.js/docs/examples/ping.js b/node_modules/discord.js/docs/examples/ping.js new file mode 100644 index 0000000..4cede6a --- /dev/null +++ b/node_modules/discord.js/docs/examples/ping.js @@ -0,0 +1,30 @@ +/* + A ping pong bot, whenever you send "ping", it replies "pong". +*/ + +// import the discord.js module +const Discord = require('discord.js'); + +// create an instance of a Discord Client, and call it bot +const bot = new Discord.Client(); + +// the token of your bot - https://discordapp.com/developers/applications/me +const token = 'your bot token here'; + +// the ready event is vital, it means that your bot will only start reacting to information +// from Discord _after_ ready is emitted. +bot.on('ready', () => { + console.log('I am ready!'); +}); + +// create an event listener for messages +bot.on('message', message => { + // if the message is "ping", + if (message.content === 'ping') { + // send "pong" to the same channel. + message.channel.sendMessage('pong'); + } +}); + +// log our bot in +bot.login(token); diff --git a/node_modules/discord.js/docs/examples/webhook.js b/node_modules/discord.js/docs/examples/webhook.js new file mode 100644 index 0000000..13cf7c8 --- /dev/null +++ b/node_modules/discord.js/docs/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!'); diff --git a/node_modules/discord.js/docs/general/faq.md b/node_modules/discord.js/docs/general/faq.md new file mode 100644 index 0000000..d7e4188 --- /dev/null +++ b/node_modules/discord.js/docs/general/faq.md @@ -0,0 +1,23 @@ +# Frequently Asked Questions +These are just questions that get asked frequently, that usually have a common resolution. +If you have issues not listed here, please ask in the [official Discord server](https://discord.gg/bRCvFy9). +Always make sure to read the documentation. + +## No matter what, I get `SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode`‽ +Update to Node.js 6.0.0 or newer. + +## How do I get voice working? +- Install FFMPEG. +- Install either the `node-opus` package or the `opusscript` package. + node-opus is greatly preferred, due to it having significantly better performance. + +## How do I install FFMPEG? +- **npm:** `npm install --save ffmpeg-binaries` +- **Ubuntu 16.04:** `sudo apt install ffmpeg` +- **Ubuntu 14.04:** `sudo apt-get install libav-tools` +- **Windows:** See the [FFMPEG section of AoDude's guide](https://github.com/bdistin/OhGodMusicBot/blob/master/README.md#download-ffmpeg). + +## How do I set up node-opus? +- **Ubuntu:** Simply run `npm install node-opus`, and it's done. Congrats! +- **Windows:** Run `npm install --global --production windows-build-tools` in an admin command prompt or PowerShell. + Then, running `npm install node-opus` in your bot's directory should successfully build it. Woo! diff --git a/node_modules/discord.js/docs/general/updating.md b/node_modules/discord.js/docs/general/updating.md new file mode 100644 index 0000000..2926691 --- /dev/null +++ b/node_modules/discord.js/docs/general/updating.md @@ -0,0 +1,128 @@ +# Version 10 +Version 10's non-BC changes focus on cleaning up some inconsistencies that exist in previous versions. +Upgrading from v9 should be quick and painless. + +## Client options +All client options have been converted to camelCase rather than snake_case, and `max_message_cache` was renamed to `messageCacheMaxSize`. + +v9 code example: +```js +const client = new Discord.Client({ + disable_everyone: true, + max_message_cache: 500, + message_cache_lifetime: 120, + message_sweep_interval: 60 +}); +``` + +v10 code example: +```js +const client = new Discord.Client({ + disableEveryone: true, + messageCacheMaxSize: 500, + messageCacheLifetime: 120, + messageSweepInterval: 60 +}); +``` + +## Presences +Presences have been completely restructured. +Previous versions of discord.js assumed that users had the same presence amongst all guilds - with the introduction of sharding, however, this is no longer the case. + +v9 discord.js code may look something like this: +```js +User.status; // the status of the user +User.game; // the game that the user is playing +ClientUser.setStatus(status, game, url); // set the new status for the user +``` + +v10 moves presences to GuildMember instances. For the sake of simplicity, though, User classes also expose presences. +When accessing a presence on a User object, it simply finds the first GuildMember for the user, and uses its presence. +Additionally, the introduction of the Presence class keeps all of the presence data organised. + +**It is strongly recommended that you use a GuildMember's presence where available, rather than a User. +A user may have an entirely different presence between two different guilds.** + +v10 code: +```js +MemberOrUser.presence.status; // the status of the member or user +MemberOrUser.presence.game; // the game that the member or user is playing +ClientUser.setStatus(status); // online, idle, dnd, offline +ClientUser.setGame(game, streamingURL); // a game +ClientUser.setPresence(fullPresence); // status and game combined +``` + +## Voice +Voice has been rewritten internally, but in a backwards-compatible manner. +There is only one breaking change here; the `disconnected` event was renamed to `disconnect`. +Several more events have been made available to a VoiceConnection, so see the documentation. + +## Events +Many events have been renamed or had their arguments change. + +### Client events +| Version 9 | Version 10 | +|------------------------------------------------------|-----------------------------------------------| +| guildMemberAdd(guild, member) | guildMemberAdd(member) | +| guildMemberAvailable(guild, member) | guildMemberAvailable(member) | +| guildMemberRemove(guild, member) | guildMemberRemove(member) | +| guildMembersChunk(guild, members) | guildMembersChunk(members) | +| guildMemberUpdate(guild, oldMember, newMember) | guildMemberUpdate(oldMember, newMember) | +| guildRoleCreate(guild, role) | roleCreate(role) | +| guildRoleDelete(guild, role) | roleDelete(role) | +| guildRoleUpdate(guild, oldRole, newRole) | roleUpdate(oldRole, newRole) | + +The guild parameter that has been dropped from the guild-related events can still be derived using `member.guild` or `role.guild`. + +### VoiceConnection events +| Version 9 | Version 10 | +|--------------|------------| +| disconnected | disconnect | + +## Dates and timestamps +All dates/timestamps on the structures have been refactored to have a consistent naming scheme and availability. +All of them are named similarly to this: +**Date:** `Message.createdAt` +**Timestamp:** `Message.createdTimestamp` +See the docs for each structure to see which date/timestamps are available on them. + + +# Version 9 +The version 9 (v9) rewrite takes a much more object-oriented approach than previous versions, +which allows your code to be much more readable and manageable. +It's been rebuilt from the ground up and should be much more stable, fixing caching issues that affected +older versions. It also has support for newer Discord Features, such as emojis. + +Version 9, while containing a sizable number of breaking changes, does not require much change in your code's logic - +most of the concepts are still the same, but loads of functions have been moved around. +The vast majority of methods you're used to using have been moved out of the Client class, +into other more relevant classes where they belong. +Because of this, you will need to convert most of your calls over to the new methods. + +Here are a few examples of methods that have changed: +* `Client.sendMessage(channel, message)` ==> `TextChannel.sendMessage(message)` + * `Client.sendMessage(user, message)` ==> `User.sendMessage(message)` +* `Client.updateMessage(message, "New content")` ==> `Message.edit("New Content")` +* `Client.getChannelLogs(channel, limit)` ==> `TextChannel.fetchMessages({options})` +* `Server.detailsOfUser(User)` ==> `Server.members.get(User).properties` (retrieving a member gives a GuildMember object) +* `Client.joinVoiceChannel(voicechannel)` => `VoiceChannel.join()` + +A couple more important details: +* `Client.loginWithToken("token")` ==> `client.login("token")` +* `Client.servers.length` ==> `client.guilds.size` (all instances of `server` are now `guild`) + +## No more callbacks! +Version 9 eschews callbacks in favour of Promises. This means all code relying on callbacks must be changed. +For example, the following code: + +```js +client.getChannelLogs(channel, 100, function(messages) { + console.log(`${messages.length} messages found`); +}); +``` + +```js +channel.fetchMessages({limit: 100}).then(messages => { + console.log(`${messages.size} messages found`); +}); +``` diff --git a/node_modules/discord.js/docs/general/welcome.md b/node_modules/discord.js/docs/general/welcome.md new file mode 100644 index 0000000..cb72c85 --- /dev/null +++ b/node_modules/discord.js/docs/general/welcome.md @@ -0,0 +1,72 @@ +
+
+

+ discord.js +

+
+

+ Discord server + NPM version + NPM downloads + Build status + Dependencies +

+

+ NPM info +

+
+ +# Welcome! +Welcome to the discord.js v10 documentation. +v10 is just a more consistent and stable iteration over v9, and contains loads of new and improved features, optimisations, and bug fixes. + +## About +discord.js is a powerful node.js module that allows you to interact with the +[Discord API](https://discordapp.com/developers/docs/intro) very easily. + +- Object-oriented +- Predictable abstractions +- Performant +- Nearly 100% coverage of the Discord API + +## Installation +**Node.js 6.0.0 or newer is required.** +Ignore any warnings about unmet peer dependencies - all of them are 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` + +### Audio engines +The preferred audio engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. +Using opusscript is only recommended for development environments where node-opus is tough to get working. +For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers. + +### Optional packages +- [uws](https://www.npmjs.com/package/uws) for much a much faster WebSocket connection (`npm install uws --save`) +- [erlpack](https://github.com/hammerandchisel/erlpack) for significantly faster WebSocket data (de)serialisation (`npm install hammerandchisel/erlpack --save`) + +## Web distributions +Web builds of discord.js that are fully capable of running in browsers are available [here](https://github.com/hydrabolt/discord.js/tree/webpack). +These are built by [Webpack 2](https://webpack.js.org/). The API is identical, but rather than using `require('discord.js')`, +the entire `Discord` object is available as a global (on the `window` object). +The ShardingManager and any voice-related functionality is unavailable in these builds. + +## 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](https://discord.js.org/) +* [Discord.js server](https://discord.gg/bRCvFy9) +* [Discord API server](https://discord.gg/rV4BwdK) +* [Documentation](https://discord.js.org/#/docs) +* [Legacy (v8) documentation](http://discordjs.readthedocs.io/en/8.2.0/docs_client.html) +* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/examples) +* [GitHub](https://github.com/hydrabolt/discord.js) +* [NPM](https://www.npmjs.com/package/discord.js) +* [Related libraries](https://discordapi.com/unofficial/libs.html) + +## 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). diff --git a/node_modules/discord.js/docs/index.yml b/node_modules/discord.js/docs/index.yml new file mode 100644 index 0000000..4bf13c7 --- /dev/null +++ b/node_modules/discord.js/docs/index.yml @@ -0,0 +1,16 @@ +- name: General + files: + - name: Welcome + path: welcome.md + - name: Updating your code + path: updating.md + - name: FAQ + path: faq.md +- name: Examples + files: + - name: Ping + path: ping.js + - name: Avatars + path: avatars.js + - name: Webhook + path: webhook.js diff --git a/node_modules/discord.js/docs/logo.svg b/node_modules/discord.js/docs/logo.svg new file mode 100644 index 0000000..81feb17 --- /dev/null +++ b/node_modules/discord.js/docs/logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3