Add message/channel/guild acknowledging (#1239)

* add acking

* 👀

* Update RESTMethods.js

* Update TextBasedChannel.js

* Update RESTMethods.js

* Update Guild.js

* Update TextBasedChannel.js

* Update Message.js

* super shitty names

* Update GroupDMChannel.js

* Update DMChannel.js

* Update TextChannel.js
This commit is contained in:
Gus Caplan
2017-03-16 08:38:12 -05:00
committed by Schuyler Cebulskie
parent fa609caee2
commit 94062d19dd
7 changed files with 58 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ class RESTMethods {
constructor(restManager) {
this.rest = restManager;
this.client = restManager.client;
this._ackToken = null;
}
login(token = this.client.token) {
@@ -151,6 +152,33 @@ class RESTMethods {
);
}
ackMessage(message) {
return this.rest.makeRequest('post',
`${Constants.Endpoints.channelMessage(message.channel.id, message.id)}/ack`,
true,
{ token: this._ackToken }
).then(res => {
this._ackToken = res.token;
return message;
});
}
ackTextChannel(channel) {
return this.rest.makeRequest('post',
`${Constants.Endpoints.channel(channel.id)}/ack`,
true,
{ token: this._ackToken }
).then(res => {
this._ackToken = res.token;
return channel;
});
}
ackGuild(guild) {
return this.rest.makeRequest('post', `${Constants.Endpoints.guild(guild.id)}/ack`, true)
.then(() => guild);
}
bulkDeleteMessages(channel, messages, filterOld) {
if (filterOld) {
messages = messages.filter(id =>