mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Finished channels
This commit is contained in:
28
docs/docs_pmchannel.rst
Normal file
28
docs/docs_pmchannel.rst
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
PMChannel
|
||||||
|
=========
|
||||||
|
|
||||||
|
**extends** Channel_
|
||||||
|
|
||||||
|
A PMChannel is a Private/Direct channel between the Client and another user.
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
|
messages
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
A Cache_ of Message_ objects.
|
||||||
|
|
||||||
|
recipient
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
The User_ that is the recipient of the Channel.
|
||||||
|
|
||||||
|
lastMessage
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
The last Message_ sent in the channel, may be null if no messages have been sent during the time the bound Client_ has been online.
|
||||||
49
docs/docs_serverchannel.rst
Normal file
49
docs/docs_serverchannel.rst
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
ServerChannel
|
||||||
|
=============
|
||||||
|
|
||||||
|
A ServerChannel is a Channel_ that belongs to a Server_.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
|
name
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
`String`, name of the channel.
|
||||||
|
|
||||||
|
type
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
`String`, either ``voice`` or ``text``.
|
||||||
|
|
||||||
|
position
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
`Number`, position in the channel list.
|
||||||
|
|
||||||
|
permissionOverwrites
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Cache_ of all the PermissionOverwrite_ objects affecting the channel.
|
||||||
|
|
||||||
|
server
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
Server_ the channel belongs to.
|
||||||
|
|
||||||
|
Functions
|
||||||
|
---------
|
||||||
|
|
||||||
|
permissionsOf(user)
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
**Aliases:** permsOf
|
||||||
|
|
||||||
|
Returns a ChannelPermissions_ object of a user's permissions in that channel.
|
||||||
|
|
||||||
|
mention()
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
Returns a `string` that can be used in discord messages to mention a channel. ``serverChannel.toString()` defaults to this.
|
||||||
28
docs/docs_textchannel.rst
Normal file
28
docs/docs_textchannel.rst
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
TextChannel
|
||||||
|
===========
|
||||||
|
|
||||||
|
**extends** ServerChannel_
|
||||||
|
|
||||||
|
A text channel of a server.
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
|
topic
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
The topic of the channel, a `String`.
|
||||||
|
|
||||||
|
lastMessage
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
Last Message_ sent in the channel. May be null if no messages sent whilst the Client was online.
|
||||||
|
|
||||||
|
messages
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
A Cache_ of Message_ objects.
|
||||||
10
docs/docs_voicechannel.rst.txt
Normal file
10
docs/docs_voicechannel.rst.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
VoiceChannel
|
||||||
|
============
|
||||||
|
|
||||||
|
**extends** ServerChannel_
|
||||||
|
|
||||||
|
A voice channel of a server. Currently, the voice channel class has no differences to the ServerChannel class.
|
||||||
|
|
||||||
|
------
|
||||||
@@ -24,6 +24,10 @@ Contents:
|
|||||||
:caption: Channel Documentation
|
:caption: Channel Documentation
|
||||||
|
|
||||||
docs_channel
|
docs_channel
|
||||||
|
docs_pmchannel
|
||||||
|
docs_serverchannel
|
||||||
|
docs_textchannel
|
||||||
|
docs_voicechannel
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|||||||
@@ -3,5 +3,7 @@
|
|||||||
.. _User : ./docs_user.html
|
.. _User : ./docs_user.html
|
||||||
.. _Server : ./docs_server.html
|
.. _Server : ./docs_server.html
|
||||||
.. _Channel : ./docs_channel.html
|
.. _Channel : ./docs_channel.html
|
||||||
|
.. _ServerChannel : ./docs_serverchannel.html
|
||||||
|
.. _TextChannel : ./docs_textchannel.html
|
||||||
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||||
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||||
@@ -12,17 +12,15 @@ var Equality = require("../Util/Equality.js");
|
|||||||
var Cache = require("../Util/Cache.js");
|
var Cache = require("../Util/Cache.js");
|
||||||
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
||||||
|
|
||||||
var PMChannel = (function (_Equality) {
|
var PMChannel = (function (_Channel) {
|
||||||
_inherits(PMChannel, _Equality);
|
_inherits(PMChannel, _Channel);
|
||||||
|
|
||||||
function PMChannel(data, client) {
|
function PMChannel(data, client) {
|
||||||
_classCallCheck(this, PMChannel);
|
_classCallCheck(this, PMChannel);
|
||||||
|
|
||||||
_Equality.call(this);
|
_Channel.call(this, data, client);
|
||||||
this.client = client;
|
|
||||||
|
|
||||||
this.type = data.type || "text";
|
this.type = data.type || "text";
|
||||||
this.id = data.id;
|
|
||||||
this.lastMessageId = data.last_message_id;
|
this.lastMessageId = data.last_message_id;
|
||||||
this.messages = new Cache("id", 1000);
|
this.messages = new Cache("id", 1000);
|
||||||
this.recipient = this.client.internal.users.add(new User(data.recipient, this.client));
|
this.recipient = this.client.internal.users.add(new User(data.recipient, this.client));
|
||||||
@@ -50,6 +48,6 @@ var PMChannel = (function (_Equality) {
|
|||||||
}]);
|
}]);
|
||||||
|
|
||||||
return PMChannel;
|
return PMChannel;
|
||||||
})(Equality);
|
})(Channel);
|
||||||
|
|
||||||
module.exports = PMChannel;
|
module.exports = PMChannel;
|
||||||
@@ -18,9 +18,7 @@ var TextChannel = (function (_ServerChannel) {
|
|||||||
|
|
||||||
_ServerChannel.call(this, data, client, server);
|
_ServerChannel.call(this, data, client, server);
|
||||||
|
|
||||||
this.name = data.name;
|
|
||||||
this.topic = data.topic;
|
this.topic = data.topic;
|
||||||
this.position = data.position;
|
|
||||||
this.lastMessageID = data.last_message_id;
|
this.lastMessageID = data.last_message_id;
|
||||||
this.messages = new Cache("id", client.options.maximumMessages);
|
this.messages = new Cache("id", client.options.maximumMessages);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ var Equality = require("../Util/Equality.js");
|
|||||||
var Cache = require("../Util/Cache.js");
|
var Cache = require("../Util/Cache.js");
|
||||||
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
||||||
|
|
||||||
class PMChannel extends Equality{
|
class PMChannel extends Channel{
|
||||||
constructor(data, client){
|
constructor(data, client){
|
||||||
super();
|
super(data, client);
|
||||||
this.client = client;
|
|
||||||
|
|
||||||
this.type = data.type || "text";
|
this.type = data.type || "text";
|
||||||
this.id = data.id;
|
|
||||||
this.lastMessageId = data.last_message_id;
|
this.lastMessageId = data.last_message_id;
|
||||||
this.messages = new Cache("id", 1000);
|
this.messages = new Cache("id", 1000);
|
||||||
this.recipient = this.client.internal.users.add(new User(data.recipient, this.client));
|
this.recipient = this.client.internal.users.add(new User(data.recipient, this.client));
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ class TextChannel extends ServerChannel{
|
|||||||
constructor(data, client, server){
|
constructor(data, client, server){
|
||||||
super(data, client, server);
|
super(data, client, server);
|
||||||
|
|
||||||
this.name = data.name;
|
|
||||||
this.topic = data.topic;
|
this.topic = data.topic;
|
||||||
this.position = data.position;
|
|
||||||
this.lastMessageID = data.last_message_id;
|
this.lastMessageID = data.last_message_id;
|
||||||
this.messages = new Cache("id", client.options.maximumMessages);
|
this.messages = new Cache("id", client.options.maximumMessages);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user