mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Added web and grunt scripts
This commit is contained in:
parent
96846654df
commit
6b3cbdbde8
16 changed files with 3415 additions and 15 deletions
48
gruntfile.js
Normal file
48
gruntfile.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
module.exports = function (grunt) {
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
grunt.initConfig({
|
||||
|
||||
// define source files and their destinations
|
||||
babel: {
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: "src/",
|
||||
src: ["**.*"],
|
||||
dest: "lib/",
|
||||
ext: ".js"
|
||||
}]
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
dist: {
|
||||
files: {
|
||||
'web-dist/discord.js': ["lib/index.js"],
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
standalone: "Discord"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
min: {
|
||||
files: {
|
||||
"./web-dist/discord.min.js": "./web-dist/discord.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// load plugins
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
// register at least this one task
|
||||
grunt.registerTask('default', ['babel']);
|
||||
grunt.registerTask('web', ['browserify', "uglify"]);
|
||||
|
||||
};
|
||||
|
|
@ -1265,7 +1265,7 @@ var Client = (function () {
|
|||
key: "trySendConnData",
|
||||
value: function trySendConnData() {
|
||||
|
||||
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) {
|
||||
if (this.token && !this.alreadySentData) {
|
||||
|
||||
this.alreadySentData = true;
|
||||
|
||||
|
|
@ -1433,4 +1433,4 @@ function getGateway() {
|
|||
});
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
module.exports = Client;
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ exports.LOGIN = exports.AUTH + "/login";
|
|||
exports.LOGOUT = exports.AUTH + "/logout";
|
||||
exports.USERS = exports.API + "/users";
|
||||
exports.SERVERS = exports.API + "/guilds";
|
||||
exports.CHANNELS = exports.API + "/channels";
|
||||
exports.CHANNELS = exports.API + "/channels";
|
||||
|
|
|
|||
|
|
@ -58,4 +58,4 @@ var PMChannel = (function () {
|
|||
return PMChannel;
|
||||
})();
|
||||
|
||||
module.exports = PMChannel;
|
||||
module.exports = PMChannel;
|
||||
|
|
|
|||
|
|
@ -76,4 +76,4 @@ var Channel = (function () {
|
|||
return Channel;
|
||||
})();
|
||||
|
||||
module.exports = Channel;
|
||||
module.exports = Channel;
|
||||
|
|
|
|||
|
|
@ -4,5 +4,9 @@ var request = require("superagent");
|
|||
var Endpoints = require("./Endpoints.js");
|
||||
var Client = require("./Client.js");
|
||||
|
||||
exports.Endpoints = Endpoints;
|
||||
exports.Client = Client;
|
||||
var Discord = {
|
||||
Endpoints: Endpoints,
|
||||
Client: Client
|
||||
};
|
||||
|
||||
module.exports = Discord;
|
||||
|
|
|
|||
|
|
@ -200,4 +200,4 @@ Internal.XHR.setUsername = function (token, avatar, email, newPassword, password
|
|||
});
|
||||
};
|
||||
|
||||
exports.Internal = Internal;
|
||||
exports.Internal = Internal;
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ var Invite = (function () {
|
|||
return Invite;
|
||||
})();
|
||||
|
||||
module.exports = Invite;
|
||||
module.exports = Invite;
|
||||
|
|
|
|||
|
|
@ -69,4 +69,4 @@ var Message = (function () {
|
|||
return Message;
|
||||
})();
|
||||
|
||||
module.exports = Message;
|
||||
module.exports = Message;
|
||||
|
|
|
|||
|
|
@ -170,4 +170,4 @@ var Server = (function () {
|
|||
return Server;
|
||||
})();
|
||||
|
||||
module.exports = Server;
|
||||
module.exports = Server;
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@ var User = (function () {
|
|||
return User;
|
||||
})();
|
||||
|
||||
module.exports = User;
|
||||
module.exports = User;
|
||||
|
|
|
|||
|
|
@ -27,5 +27,12 @@
|
|||
"dependencies": {
|
||||
"superagent": "^1.3.0",
|
||||
"ws": "^0.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.5",
|
||||
"grunt-babel": "^5.0.1",
|
||||
"grunt-browserify": "^4.0.0",
|
||||
"grunt-contrib-uglify": "^0.9.2",
|
||||
"load-grunt-tasks": "^3.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1045,7 +1045,7 @@ class Client {
|
|||
//def trySendConnData
|
||||
trySendConnData() {
|
||||
|
||||
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) {
|
||||
if (this.token && !this.alreadySentData) {
|
||||
|
||||
this.alreadySentData = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,9 @@ var request = require("superagent");
|
|||
var Endpoints = require("./Endpoints.js");
|
||||
var Client = require("./Client.js");
|
||||
|
||||
exports.Endpoints = Endpoints;
|
||||
exports.Client = Client;
|
||||
var Discord = {
|
||||
Endpoints : Endpoints,
|
||||
Client : Client
|
||||
}
|
||||
|
||||
module.exports = Discord;
|
||||
3335
web-dist/discord.js
Normal file
3335
web-dist/discord.js
Normal file
File diff suppressed because it is too large
Load diff
2
web-dist/discord.min.js
vendored
Normal file
2
web-dist/discord.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue