mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +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:
@@ -132,6 +132,19 @@ export default class Server extends Equality {
|
||||
}
|
||||
}
|
||||
|
||||
get webhooks() {
|
||||
return this.channels
|
||||
.map(c => c.webhooks)
|
||||
.reduce((previousChannel, currentChannel) => {
|
||||
if (currentChannel) {
|
||||
currentChannel.forEach(webhook => {
|
||||
previousChannel.add(webhook);
|
||||
})
|
||||
}
|
||||
return previousChannel;
|
||||
}, new Cache("id"));
|
||||
}
|
||||
|
||||
get createdAt() {
|
||||
return new Date((+this.id / 4194304) + 1420070400000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user