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:
Jacob
2016-10-01 06:53:14 -04:00
committed by Amish Shah
parent d22ca969db
commit c00d209014
15 changed files with 548 additions and 45 deletions

View File

@@ -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);
}