mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
File diff suppressed because one or more lines are too long
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user