Added disable_everyone (#603)

* Added disable_everyone

* Fixed docs
This commit is contained in:
Hackzzila
2016-09-04 13:03:59 -05:00
committed by Amish Shah
parent 48e7fad1c9
commit 3b7d5e869b
4 changed files with 13 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -46,10 +46,15 @@ class RESTMethods {
});
}
sendMessage(channel, content, tts, nonce, file) {
sendMessage(channel, content, tts, nonce, disable_everyone, file) {
return new Promise((resolve, reject) => {
const $this = this;
content = this.rest.client.resolver.resolveString(content);
if (this.rest.client.options.disable_everyone || disable_everyone) {
content = content.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere');
}
function req() {
$this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, {
content, tts, nonce,

View File

@@ -34,6 +34,7 @@ class TextBasedChannel {
* {
* tts: false,
* nonce: '',
* disable_everyone: false,
* };
* ```
* @typedef {Object} MessageOptions
@@ -51,7 +52,7 @@ class TextBasedChannel {
* .catch(console.log);
*/
sendMessage(content, options = {}) {
return this.client.rest.methods.sendMessage(this, content, options.tts, options.nonce);
return this.client.rest.methods.sendMessage(this, content, options.tts, options.nonce, options.disable_everyone);
}
/**
@@ -66,7 +67,7 @@ class TextBasedChannel {
* .catch(console.log);
*/
sendTTSMessage(content, options = {}) {
return this.client.rest.methods.sendMessage(this, content, true, options.nonce);
return this.client.rest.methods.sendMessage(this, content, true, options.nonce, options.disable_everyone);
}
/**
@@ -87,7 +88,7 @@ class TextBasedChannel {
}
return new Promise((resolve, reject) => {
this.client.resolver.resolveFile(attachment).then(file => {
this.client.rest.methods.sendMessage(this, undefined, false, undefined, {
this.client.rest.methods.sendMessage(this, undefined, false, undefined, false, {
file,
name: fileName,
}).then(resolve).catch(reject);

View File

@@ -20,6 +20,7 @@
* shard_id: 0,
* shard_count: 0,
* fetch_all_members: false,
* disable_everyone: false,
* };
* ```
* @typedef {Object} ClientOptions
@@ -43,6 +44,7 @@ exports.DefaultOptions = {
shard_id: 0,
shard_count: 0,
fetch_all_members: false,
disable_everyone: false,
};
exports.Status = {