Skip to content

Commit f0d42ca

Browse files
committed
Merge branch 'rewrite'
2 parents 7616f90 + 389b89f commit f0d42ca

File tree

131 files changed

+22581
-10480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+22581
-10480
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ build/Release
3636
node_modules
3737
test/auth.json
3838
examples/auth.json
39+
test/spotify.js

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ language: node_js
22
node_js:
33
- "stable"
44
cache:
5-
directories:
6-
- node_modules
5+
directories:
6+
- node_modules
7+
branches:
8+
only:
9+
- master

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
// Place your settings in this file to overwrite default and user settings.
2-
{ "editor.wrappingColumn": 0 }
2+
{
3+
"editor.wrappingColumn": 0,
4+
"editor.formatOnType": true
5+
}

README.md

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</a>
55
</p>
66

7-
# The API is being rewritten for stability, have a look [here](https://github.com/hydrabolt/discord.js/tree/rewrite) for more. It will feature voice!
7+
# Did v5.0.0 break your code? [Look here.](http://discordjs.readthedocs.org/en/rewrite-docs/migrating.html)
88

99
[![Build Status](https://travis-ci.org/hydrabolt/discord.js.svg)](https://travis-ci.org/hydrabolt/discord.js) [![Documentation Status](https://readthedocs.org/projects/discordjs/badge/?version=latest)](http://discordjs.readthedocs.org/en/latest/?badge=latest)
1010

@@ -37,31 +37,11 @@ mybot.login("email", "password");
3737
```
3838
---
3939

40-
### What's new in 3.9.0?
40+
### What's new in 5.0.0?
4141

42-
Amongst some fixes to web distribution creation, you can now opt for easier string formatting! However, it does modify String globally so you'll have to run:
42+
Stability in general! The API has been rewritten completely for much better stability, and it seems to have worked! There are now no random crashes and everything caches properly. The API is also a bit cleaner!
4343

44-
```js
45-
Discord.patchStrings()
46-
```
47-
48-
After you have run this, you can do:
49-
```
50-
51-
"message".bold.underline.italic
52-
// generates "*__**message**__*"
53-
54-
```
55-
56-
A full list of modifiers (all chainable):
57-
58-
* bold `**`
59-
* italic `*`
60-
* underline `__`
61-
* strike `~`
62-
* code `` ` ``
63-
* codeblock ```` ``` ````
64-
* newline `\n`
44+
However, it is a breaking change if you are updating (potentially, basic code should be fine) you should look [here](http://discordjs.readthedocs.org/en/rewrite-docs/migrating.html) for help updating.
6545

6646
---
6747

@@ -108,4 +88,4 @@ If you have an issue or want to know if a feature exists, [read the documentatio
10888

10989

11090
If you would like to contact me, you can create an issue on the GitHub repo, e-mail me via the one available on my NPM profile.
111-
Or you could just send a DM to **hydrabolt** in [**Discord API**](https://discord.gg/0SBTUU1wZTYd2XyW).
91+
Or you could just send a DM to **hydrabolt** in [**Discord API**](https://discord.gg/0SBTUU1wZTYd2XyW).

docs/create_simple_bot.rst

Lines changed: 0 additions & 132 deletions
This file was deleted.

docs/docs_cache.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. include:: ./vars.rst
2+
3+
Cache
4+
=====
5+
6+
**extends Array**
7+
8+
A Cache object extends an Array (so it can be used like a regular array) but introduces helper functions to make it more useful when developing with discord.js. Unlike a regular array, it doesn't care about the instance or prototype of an object, it works purely on properties.
9+
10+
-----
11+
12+
Functions
13+
---------
14+
15+
get(key, value)
16+
~~~~~~~~~~~~~~~
17+
18+
Returns a contained object where ``object[key] == value``. Returns the first object found that matches the criteria.
19+
20+
getAll(key, value)
21+
~~~~~~~~~~~~~~~~~~
22+
23+
Similar to ``cache.get(key, value)``, but returns a Cache of any objects that meet the criteria.
24+
25+
has(key, value)
26+
~~~~~~~~~~~~~~~
27+
28+
Returns `true` if there is an object that meets the condition ``object[key] == value`` in the cache
29+
30+
add(data)
31+
~~~~~~~~~
32+
33+
Adds an object to the Cache as long as all the other objects in the cache don't have the same ID as it.
34+
35+
update(old, data)
36+
~~~~~~~~~~~~~~~~~
37+
38+
Updates an old object in the Cache (if it exists) with the new one.
39+
40+
remove(data)
41+
~~~~~~~~~~~~
42+
43+
Removes an object from the cache if it exists.

docs/docs_channel.rst

Lines changed: 23 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,23 @@
1-
.. include:: ./vars.rst
2-
3-
Channels
4-
========
5-
6-
The Channel Class is used to represent data about a Channel.
7-
8-
Attributes
9-
----------
10-
11-
client
12-
~~~~~~
13-
14-
The Discord Client_ that cached the channel
15-
16-
server
17-
~~~~~~
18-
19-
The Server_ that the channel belongs to
20-
21-
name
22-
~~~~
23-
24-
The channel's name, as a `String`.
25-
26-
id
27-
~~
28-
29-
The channel's id, as a `String`.
30-
31-
type
32-
~~~~
33-
34-
The type of the channel as a `String`, either ``text`` or ``voice``.
35-
36-
topic
37-
~~~~~
38-
39-
A `String` that is the topic of the channel, if the channel doesn't have a topic this will be `null`.
40-
41-
messages
42-
~~~~~~~~
43-
44-
An `Array` of Message_ objects received from the channel. There are up to a 1000 messages here, and the older messages will be deleted if necessary.
45-
46-
members
47-
~~~~~~~
48-
49-
**Aliases** : `users`
50-
51-
The members in the channel's server, an `Array` of User_ objects.
52-
53-
-----
54-
55-
Functions
56-
---------
57-
58-
.. note:: When concatenated with a String, the object will become the channel's embed code, e.g. ``"this is " + channel`` would be ``this is <#channelid>``
59-
60-
getMessage(key, value)
61-
~~~~~~~~~~~~~~~~~~~~~~
62-
63-
Gets a Message_ from the channel that matches the specified criteria. E.g:
64-
65-
.. code-block:: js
66-
67-
channel.getMessage("id", 1243987349) // returns a Message where message.id === 1243987349
68-
69-
- **key** - a `String` that is the key
70-
- **value** - a `String` that is the value
71-
72-
permissionsOf(user)
73-
~~~~~~~~~~~~~~~~~~~
74-
75-
Gets the EvaluatedPermissions_ of a User in the channel.
76-
77-
- **user** - A User_ or Member_ you want to get the permissions of.
78-
79-
equals(object)
80-
~~~~~~~~~~~~~~
81-
82-
Returns a `Boolean` depending on whether the Channel's ID (``channel.id``) equals the object's ID (``object.id``). You should **always**, always use this if you want to compare channels. **NEVER** do ``channel1 == channel2``.
1+
.. include:: ./vars.rst
2+
3+
Channel
4+
=======
5+
6+
**extends** Equality_
7+
8+
The Channel class is the base class for all types of channel.
9+
10+
Attributes
11+
----------
12+
13+
--------
14+
15+
id
16+
~~
17+
18+
The ID of the channel, a `String`.
19+
20+
client
21+
~~~~~~
22+
23+
The Client_ that cached the channel.

0 commit comments

Comments
 (0)