mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
resolve type of file and create stream from it
This commit is contained in:
parent
b1deaf58db
commit
8de0199bf5
2 changed files with 22 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ var PMChannel = require("./PMChannel.js");
|
|||
//node modules
|
||||
var request = require("superagent");
|
||||
var WebSocket = require("ws");
|
||||
var fs = require("fs");
|
||||
|
||||
var defaultOptions = {
|
||||
cache_tokens: false
|
||||
|
|
@ -535,7 +536,16 @@ var Client = (function () {
|
|||
|
||||
var self = this;
|
||||
|
||||
return new Promise(function (resolve, reject) {});
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var fstream;
|
||||
|
||||
if (typeof file === "string" || file instanceof String) {
|
||||
fstream = fs.createReadStream(file);
|
||||
} else {
|
||||
fstream = file;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "sendMessage",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ var PMChannel = require("./PMChannel.js");
|
|||
//node modules
|
||||
var request = require("superagent");
|
||||
var WebSocket = require("ws");
|
||||
var fs = require("fs");
|
||||
|
||||
var defaultOptions = {
|
||||
cache_tokens: false
|
||||
|
|
@ -549,6 +550,16 @@ class Client {
|
|||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
var fstream;
|
||||
|
||||
if(typeof file === "string" || file instanceof String){
|
||||
fstream = fs.createReadStream(file);
|
||||
}else{
|
||||
fstream = file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue