From 55f4e33ada354f796c80ff3472190e6a2404d900 Mon Sep 17 00:00:00 2001 From: hydrabolt Date: Tue, 29 Sep 2015 17:26:33 +0100 Subject: [PATCH] Added channel documentation --- docs/docs_channel.rst | 75 +++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + docs/vars.rst | 2 +- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 docs/docs_channel.rst diff --git a/docs/docs_channel.rst b/docs/docs_channel.rst new file mode 100644 index 000000000..b81ee763f --- /dev/null +++ b/docs/docs_channel.rst @@ -0,0 +1,75 @@ +.. include:: ./vars.rst + +Channel Documentation +===================== + +The Channel Class is used to represent data about a Channel. + +Attributes +---------- + +client +~~~~~~ + +The Discord Client_ that cached the channel + +server +~~~~~~ + +The Server_ that the channel belongs to + +name +~~~~ + +The channel's name, as a `String`. + +id +~~ + +The channel's id, as a `String`. + +type +~~~~ + +The type of the channel as a `String`, either ``text`` or ``voice``. + +topic +~~~~~ + +A `String` that is the topic of the channel, if the channel doesn't have a topic this will be `null`. + +messages +~~~~~~~~ + +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. + +members +~~~~~~~ + +**Aliases** : `users` + +The members in the channel's server, an `Array` of User_ objects. + +----- + +Functions +--------- + +.. 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>`` + +getMessage(key, value) +~~~~~~~~~~~~~~~~~~~~~~ + +Gets a Message_ from the channel that matches the specified criteria. E.g: + +.. code-block:: js + + channel.getMessage("id", 1243987349) // returns a Channel where message.id === 1243987349 + +- **key** - a `String` that is the key +- **value** - a `String` that is the value + +equals(object) +~~~~~~~~~~~~~~ + +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``. diff --git a/docs/index.rst b/docs/index.rst index 4db5e17e2..2b08bfcca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -33,6 +33,7 @@ Contents: docs_client docs_user docs_server + docs_channel diff --git a/docs/vars.rst b/docs/vars.rst index ef98675e4..7a59d8007 100644 --- a/docs/vars.rst +++ b/docs/vars.rst @@ -2,7 +2,7 @@ .. _User : ./docs_user.html .. _ready : #ready .. _Server : ./docs_server.html -.. _Channel : #channel +.. _Channel : ./docs_channel.html .. _Message : #message .. _PMChannel : #PMChannel .. _Invite : #invite