more documentation

This commit is contained in:
hydrabolt
2015-09-28 17:23:24 +01:00
parent afb2a66fe2
commit 00083e96ed
3 changed files with 58 additions and 2 deletions

View File

@@ -151,10 +151,56 @@ createServer(name, region, `callback`)
Creates a server with the specified name or region. See valid regions below:
- **name** - A `String` that will be the name of your server.
- **region** - A `String` that is a valid Discord region. Currently **``us-west``**, **``us-east``**, **``singapore``**, **``london``**, **``sydney``** or **``amsterdam``**. Providing an invalid region will result in an error. To find the latest available regions, check the `official API here`_.
- **region** - A `String` that is a valid Discord region. Currently **us-west**, **us-east**, **singapore**, **london**, **sydney** or **amsterdam**. Providing an invalid region will result in an error. To find the latest available regions, check the `official API here`_.
- **callback** - A `function` that can take the following parameters:
- **error** - An error if one occurred, otherwise it is null.
- **server** - A Server_ that represents the created Server.
joinServer(invite, `callback`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Accepts a given invite to join a server. The server is automatically cached ASAP.
- **invite** - An `Invite Resolvable`_ which is the invite that should be accepted.
- **callback** - A `function` that can take the following parameters:
- **error** - An error if one occurred, otherwise it is null.
- **server** - A Server_ that represents the joined Server.
leaveServer(server, `callback`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Leaves the given server.
- **server** - A `Server Resolvable`_ that represents the server you want to leave.
- **callback** - A `function` that can take the following parameters:
- **error** - An error if one occurred, otherwise it is null.
createInvite(channel, options, `callback`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Creates an invite for the given channel and returns an Invite_.
- **channel** - A `Channel Resolvable`_ that is the channel you want to create an invite for.
- **options** - An `object` containing configurable options for the invite. See below for possible configurations.
- **callback** - A `function` that can take the following parameters:
- **error** - An error if one occurred, otherwise it is null.
- **invite** - An Invite_ object that contains the details about the created invite.
.. code-block:: js
// default configuration of the options variable:
options = {
max_age : 0, //A number signifying the expiry time for the invite. 0 means infinite.
max_uses : 0, //A number signifying the amount of uses of the invite. 0 means infinite.
temporary : false, //boolean - whether users who use it are kicked unless promoted within 24h.
xkcd : false //boolean - whether the invite's URL should be human-readable
}
.. _official API here : https://discordapp.com/api/voice/regions

View File

@@ -5,6 +5,8 @@ Resolvable Documentation
To be robust, discord.js needs to handle a wide amount of ambiguous data that is supplied to it. This means you can use functions much more easily. Anything that is resolvable means it can be normalised without you having to do it explicitly.
Resolvables are not objects or classes, they are just ways of expressing what type of data is expected.
Channel Resolvable
------------------
@@ -16,4 +18,10 @@ A Channel Resolvable is data that can be resolved to a channel ID. Here is what
- A Message_ (the channel the message was sent in will be used)
- A User_ (will get the PM channel with the specified user)
.. note:: A User cannot always be specified in certain cases. For example, if using `bot.setTopic`, a User or PM Channel can't be specified as these do not support channel topics.
.. note:: A User cannot always be specified in certain cases. For example, if using `bot.setTopic`, a User or PM Channel can't be specified as these do not support channel topics.
Server Resolvable
-----------------
Invite Resolvable
-----------------

View File

@@ -4,5 +4,7 @@
.. _Channel : #channel
.. _Message : #message
.. _PMChannel : #PMChannel
.. _Invite : #invite
.. _Channel Resolvable : ./docs_resolvable.html#channel-resolvable
.. _Invite Resolvable : ./docs_resolvable.html#invite-resolvable
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise