mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
Added message docs
This commit is contained in:
83
docs/docs_message.rst
Normal file
83
docs/docs_message.rst
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
Message
|
||||||
|
=======
|
||||||
|
|
||||||
|
**extends** Equality_
|
||||||
|
|
||||||
|
A Message object is used to represent the data of a message.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
|
channel
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
The channel the message sent in, either a TextChannel_ or PMChannel_.
|
||||||
|
|
||||||
|
client
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
The Client_ that cached the message.
|
||||||
|
|
||||||
|
attachments
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
A raw array of attachment objects.
|
||||||
|
|
||||||
|
tts
|
||||||
|
~~~
|
||||||
|
|
||||||
|
`Boolean`, true if the message was text-to-speech.
|
||||||
|
|
||||||
|
embeds
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
A raw array of embed objects.
|
||||||
|
|
||||||
|
timestamp
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
`Number`, timestamp of when the message was sent.
|
||||||
|
|
||||||
|
everyoneMentioned
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
`Boolean`, true if ``@everyone`` was mentioned.
|
||||||
|
|
||||||
|
id
|
||||||
|
~~
|
||||||
|
|
||||||
|
`String`, ID of the message.
|
||||||
|
|
||||||
|
editedTimestamp
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Timestamp on when the message was last edited, `Number`. Potentially null.
|
||||||
|
|
||||||
|
author
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
The User_ that sent the message.
|
||||||
|
|
||||||
|
content
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
`String`, content of the message.
|
||||||
|
|
||||||
|
mentions
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
A Cache_ of User_ objects that were mentioned in the message.
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Functions
|
||||||
|
---------
|
||||||
|
|
||||||
|
isMentioned(user)
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Returns true if the given user was mentioned in the message.
|
||||||
|
|
||||||
|
- **user** : A `User Resolvable`_
|
||||||
@@ -36,6 +36,7 @@ Contents:
|
|||||||
docs_client
|
docs_client
|
||||||
docs_server
|
docs_server
|
||||||
docs_user
|
docs_user
|
||||||
|
docs_message
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|||||||
@@ -5,5 +5,8 @@
|
|||||||
.. _Channel : ./docs_channel.html
|
.. _Channel : ./docs_channel.html
|
||||||
.. _ServerChannel : ./docs_serverchannel.html
|
.. _ServerChannel : ./docs_serverchannel.html
|
||||||
.. _TextChannel : ./docs_textchannel.html
|
.. _TextChannel : ./docs_textchannel.html
|
||||||
|
.. _VoiceChannel : ./docs_voicechannel.html
|
||||||
|
.. _PMChannel : ./docs_pmchannel.html
|
||||||
|
.. _Message : ./docs_message.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
|
||||||
@@ -2,16 +2,22 @@
|
|||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
var Cache = require("../Util/Cache.js");
|
var Cache = require("../Util/Cache.js");
|
||||||
var User = require("./User.js");
|
var User = require("./User.js");
|
||||||
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
||||||
|
var Equality = require("../Util/Equality");
|
||||||
|
|
||||||
|
var Message = (function (_Equality) {
|
||||||
|
_inherits(Message, _Equality);
|
||||||
|
|
||||||
var Message = (function () {
|
|
||||||
function Message(data, channel, client) {
|
function Message(data, channel, client) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
_classCallCheck(this, Message);
|
_classCallCheck(this, Message);
|
||||||
|
|
||||||
|
_Equality.call(this);
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.nonce = data.nonce;
|
this.nonce = data.nonce;
|
||||||
@@ -67,6 +73,6 @@ var Message = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return Message;
|
return Message;
|
||||||
})();
|
})(Equality);
|
||||||
|
|
||||||
module.exports = Message;
|
module.exports = Message;
|
||||||
@@ -3,9 +3,11 @@
|
|||||||
var Cache = require("../Util/Cache.js");
|
var Cache = require("../Util/Cache.js");
|
||||||
var User = require("./User.js");
|
var User = require("./User.js");
|
||||||
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
var reg = require("../Util/ArgumentRegulariser.js").reg;
|
||||||
|
var Equality = require("../Util/Equality");
|
||||||
|
|
||||||
class Message{
|
class Message extends Equality{
|
||||||
constructor(data, channel, client){
|
constructor(data, channel, client) {
|
||||||
|
super();
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.nonce = data.nonce;
|
this.nonce = data.nonce;
|
||||||
|
|||||||
Reference in New Issue
Block a user