mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Beginning to move send message functions to unified function
This commit is contained in:
@@ -625,40 +625,11 @@ class Client {
|
||||
|
||||
if(self.options.queue){
|
||||
//we're QUEUEING messages, so sending them sequentially based on servers.
|
||||
self.addMessageQueue(destination);
|
||||
}else{
|
||||
self._sendMessage("text", destination, message, mentions);
|
||||
}
|
||||
request
|
||||
.post(`${Endpoints.CHANNELS}/${destination}/messages`)
|
||||
.set("authorization", self.token)
|
||||
.send({
|
||||
content: message,
|
||||
mentions: mentions
|
||||
})
|
||||
.end(function (err, res) {
|
||||
|
||||
if (err) {
|
||||
callback(err);
|
||||
reject(err);
|
||||
} else {
|
||||
var data = res.body;
|
||||
|
||||
var mentions = [];
|
||||
|
||||
data.mentions = data.mentions || []; //for some reason this was not defined at some point?
|
||||
|
||||
for (var mention of data.mentions) {
|
||||
mentions.push(self.addUser(mention));
|
||||
}
|
||||
|
||||
var channel = self.getChannel("id", data.channel_id);
|
||||
if (channel) {
|
||||
var msg = channel.addMessage(new Message(data, channel, mentions, self.addUser(data.author)));
|
||||
callback(null, msg);
|
||||
resolve(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function resolveMessage() {
|
||||
@@ -1118,6 +1089,16 @@ class Client {
|
||||
resolve(channId);
|
||||
});
|
||||
}
|
||||
|
||||
_sendMessage(messageType, destination, content, mentions){
|
||||
|
||||
var self = this;
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user