mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
add webhooks v8 (#759)
* add webhook structure and getChannelWebhooks as well as getServerWebhooks * add sendMessage * add the ability to edit create and delete hooks * remove server wide cache and add getter.
This commit is contained in:
@@ -450,6 +450,20 @@ var Server = (function (_Equality) {
|
||||
};
|
||||
|
||||
_createClass(Server, [{
|
||||
key: "webhooks",
|
||||
get: function get() {
|
||||
return this.channels.map(function (c) {
|
||||
return c.webhooks;
|
||||
}).reduce(function (previousChannel, currentChannel) {
|
||||
if (currentChannel) {
|
||||
currentChannel.forEach(function (webhook) {
|
||||
previousChannel.add(webhook);
|
||||
});
|
||||
}
|
||||
return previousChannel;
|
||||
}, new _UtilCache2["default"]("id"));
|
||||
}
|
||||
}, {
|
||||
key: "createdAt",
|
||||
get: function get() {
|
||||
return new Date(+this.id / 4194304 + 1420070400000);
|
||||
|
||||
@@ -30,6 +30,7 @@ var TextChannel = (function (_ServerChannel) {
|
||||
|
||||
this.topic = data.topic;
|
||||
this.lastMessageID = data.last_message_id || data.lastMessageID;
|
||||
this.webhooks = new _UtilCache2["default"]("id");
|
||||
this.messages = new _UtilCache2["default"]("id", client.options.maxCachedMessages);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user