From 97f85a83f9983e546bde0887e037254cfc2b6284 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Thu, 8 Dec 2016 04:12:43 -0600 Subject: [PATCH] 2.0.1 fixes with the new wrapper --- package.json | 2 +- src/Client.js | 18 ++++++++--------- .../{rpc.2.0.0.es6.js => rpc.2.0.1.es6.js} | 20 +++++++++---------- ....2.0.0.es6.min.js => rpc.2.0.1.es6.min.js} | 2 +- webpack/{rpc.2.0.0.js => rpc.2.0.1.js} | 20 +++++++++---------- .../{rpc.2.0.0.min.js => rpc.2.0.1.min.js} | 4 ++-- 6 files changed, 33 insertions(+), 33 deletions(-) rename webpack/{rpc.2.0.0.es6.js => rpc.2.0.1.es6.js} (99%) rename webpack/{rpc.2.0.0.es6.min.js => rpc.2.0.1.es6.min.js} (71%) rename webpack/{rpc.2.0.0.js => rpc.2.0.1.js} (99%) rename webpack/{rpc.2.0.0.min.js => rpc.2.0.1.min.js} (70%) diff --git a/package.json b/package.json index 39632f5..8b8c8eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-rpc", - "version": "2.0.0", + "version": "2.0.1", "description": "A simple RPC client for Discord somewhat stolen from the Discord StreamKit.", "main": "src/index.js", "repository": { diff --git a/src/Client.js b/src/Client.js index 96952dc..0c0d2ca 100644 --- a/src/Client.js +++ b/src/Client.js @@ -18,7 +18,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_GUILD', { guild_id: id, timeout }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -27,7 +27,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_GUILDS', {}, (err, res) => { if (err) reject(err); - resolve(res.data.guilds); + resolve(res.guilds); }); }); } @@ -36,7 +36,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_CHANNEL', { channel_id: id, timeout }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -45,7 +45,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_CHANNELS', {}, (err, res) => { if (err) reject(err); - resolve(res.data.channels); + resolve(res.channels); }); }); } @@ -54,7 +54,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SET_USER_VOICE_SETTINGS', args, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -63,7 +63,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SELECT_VOICE_CHANNEL', { channel_id: id, timeout, force }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -72,7 +72,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SELECT_TEXT_CHANNEL', { channel_id: id, timeout, force }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -81,7 +81,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_VOICE_SETTINGS', {}, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -90,7 +90,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SET_VOICE_SETTINGS', args, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } diff --git a/webpack/rpc.2.0.0.es6.js b/webpack/rpc.2.0.1.es6.js similarity index 99% rename from webpack/rpc.2.0.0.es6.js rename to webpack/rpc.2.0.1.es6.js index 0564f46..d1763cb 100644 --- a/webpack/rpc.2.0.0.es6.js +++ b/webpack/rpc.2.0.1.es6.js @@ -1859,7 +1859,7 @@ module.exports = isObject; module.exports = { "name": "discord-rpc", - "version": "2.0.0", + "version": "2.0.1", "description": "A simple RPC client for Discord somewhat stolen from the Discord StreamKit.", "main": "src/index.js", "repository": { @@ -1922,7 +1922,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_GUILD', { guild_id: id, timeout }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1931,7 +1931,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_GUILDS', {}, (err, res) => { if (err) reject(err); - resolve(res.data.guilds); + resolve(res.guilds); }); }); } @@ -1940,7 +1940,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_CHANNEL', { channel_id: id, timeout }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1949,7 +1949,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_CHANNELS', {}, (err, res) => { if (err) reject(err); - resolve(res.data.channels); + resolve(res.channels); }); }); } @@ -1958,7 +1958,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SET_USER_VOICE_SETTINGS', args, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1967,7 +1967,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SELECT_VOICE_CHANNEL', { channel_id: id, timeout, force }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1976,7 +1976,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SELECT_TEXT_CHANNEL', { channel_id: id, timeout, force }, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1985,7 +1985,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('GET_VOICE_SETTINGS', {}, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -1994,7 +1994,7 @@ class Client extends EventEmitter { return new Promise((resolve, reject) => { this.rpc.request('SET_VOICE_SETTINGS', args, (err, res) => { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } diff --git a/webpack/rpc.2.0.0.es6.min.js b/webpack/rpc.2.0.1.es6.min.js similarity index 71% rename from webpack/rpc.2.0.0.es6.min.js rename to webpack/rpc.2.0.1.es6.min.js index 21039d8..49739ee 100644 --- a/webpack/rpc.2.0.0.es6.min.js +++ b/webpack/rpc.2.0.1.es6.min.js @@ -1 +1 @@ -!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e){const n=t=>{let e={};for(const n of t)e[n]=n;return e};t.exports.RPCCommands=n(["DISPATCH","AUTHORIZE","AUTHENTICATE","GET_GUILD","GET_GUILDS","GET_CHANNEL","GET_CHANNELS","SUBSCRIBE","UNSUBSCRIBE","SET_USER_VOICE_SETTINGS","SELECT_VOICE_CHANNEL","GET_VOICE_SETTINGS","SET_VOICE_SETTINGS","SELECT_TEXT_CHANNEL","INVITE_BROWSER"]),t.exports.RPCEvents=n(["READY","ERROR","GUILD_STATUS","GUILD_CREATE","CHANNEL_CREATE","VOICE_STATE_CREATE","VOICE_STATE_DELETE","VOICE_STATE_UPDATE","VOICE_SETTINGS_UPDATE","VOICE_CONNECTION_STATUS","SPEAKING_START","SPEAKING_STOP","MESSAGE_CREATE","MESSAGE_UPDATE","MESSAGE_DELETE"]),t.exports.RPCErrors={UNKNOWN_ERROR:1e3,INVALID_PAYLOAD:4e3,INVALID_VERSION:4001,INVALID_COMMAND:4002,INVALID_GUILD:4003,INVALID_EVENT:4004,INVALID_CHANNEL:4005,INVALID_PERMISSIONS:4006,INVALID_CLIENTID:4007,INVALID_ORIGIN:4008,INVALID_TOKEN:4009,INVALID_USER:4010,OAUTH2_ERROR:5e3},t.exports.RPCCloseCodes={INVALID_CLIENTID:4e3,INVALID_ORIGIN:4001,RATELIMITED:4002,TOKEN_REVOKED:4003},t.exports.ChannelTypes={DM:1,GROUP_DM:3,GUILD_TEXT:0,GUILD_VOICE:2};const i=t.exports.Endpoints={login:"/auth/login",logout:"/auth/logout",gateway:"/gateway",botGateway:"/gateway/bot",invite:t=>`/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`/users/${t}`,userChannels:t=>`${i.user(t)}/channels`,userProfile:t=>`${i.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${i.user(t)}/avatars/${e}.jpg`,me:"/users/@me",meGuild:t=>`${i.me}/guilds/${t}`,relationships:t=>`${i.user(t)}/relationships`,note:t=>`${i.me}/notes/${t}`,guilds:"/guilds",guild:t=>`${i.guilds}/${t}`,guildIcon:(t,e)=>`${i.guild(t)}/icons/${e}.jpg`,guildPrune:t=>`${i.guild(t)}/prune`,guildEmbed:t=>`${i.guild(t)}/embed`,guildInvites:t=>`${i.guild(t)}/invites`,guildRoles:t=>`${i.guild(t)}/roles`,guildRole:(t,e)=>`${i.guildRoles(t)}/${e}`,guildBans:t=>`${i.guild(t)}/bans`,guildIntegrations:t=>`${i.guild(t)}/integrations`,guildMembers:t=>`${i.guild(t)}/members`,guildMember:(t,e)=>`${i.guildMembers(t)}/${e}`,guildMemberRole:(t,e,n)=>`${i.guildMember(t,e)}/roles/${n}`,stupidInconsistentGuildEndpoint:t=>`${i.guildMember(t,"@me")}/nick`,guildChannels:t=>`${i.guild(t)}/channels`,guildEmojis:t=>`${i.guild(t)}/emojis`,channels:"/channels",channel:t=>`${i.channels}/${t}`,channelMessages:t=>`${i.channel(t)}/messages`,channelInvites:t=>`${i.channel(t)}/invites`,channelTyping:t=>`${i.channel(t)}/typing`,channelPermissions:t=>`${i.channel(t)}/permissions`,channelMessage:(t,e)=>`${i.channelMessages(t)}/${e}`,channelWebhooks:t=>`${i.channel(t)}/webhooks`,messageReactions:(t,e)=>`${i.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,r)=>`${i.messageReactions(t,e)}/${n}${r?`?limit=${r}`:""}`,selfMessageReaction:(t,e,n,r)=>`${i.messageReaction(t,e,n,r)}/@me`,userMessageReaction:(t,e,n,r,s)=>`${i.messageReaction(t,e,n,r)}/${s}`,webhook:(t,e)=>`/webhooks/${t}${e?`/${e}`:""}`,myApplication:"/oauth2/applications/@me",getApp:t=>`/oauth2/authorize?client_id=${t}`}},function(t,e,n){const i=n(4),{Endpoints}=n(0);t.exports=class t{constructor(t){this.client=t}makeRequest(t,e,n={},r={}){return new Promise((s,o)=>{r.Authorization=`Bearer ${this.client.accessToken}`,i[t.toLowerCase()](`https://${this.client.hostAndPort}${e}`).set(r).send(n).then(t=>s(t.body),o)})}sendMessage(t,e){return this.makeRequest("post",Endpoints.channelMessages(t),{content:e})}editMessage(t,e,n){return this.makeRequest("patch",Endpoints.channelMessage(t,e),{content:n})}deleteMessage(t,e){return this.makeRequest("delete",Endpoints.channelMessage(t,e))}}},function(t,e,n){function i(t,e,n){return`${t}:${e||n}`}const r="undefined"!=typeof window?window.WebSocket:n(17),s=n(3).EventEmitter,{RPCCommands,RPCEvents,RPCErrors}=n(0),o=n(4),u=n(9),c=n(15).v4,a=n(1);class h{constructor(t){this.evts=new s,this.activeSubscriptions=[],this.queue=[],this.connected=!1,this.ready=!1,this.requestedDisconnect=!1,this.connectionTries=0,this.socket=null,this.config={},this.OAUTH2_CLIENT_ID=t.OAUTH2_CLIENT_ID,this.API_ENDPOINT=t.API_ENDPOINT||"",this.rest=new a(this)}connect(t=this.accessToken,e=0){if(!this.connected){this.accessToken=t;const n=6463+e%10;this.hostAndPort=`${c()}.discordapp.io:${n}`,this.socket=new r(`wss://${this.hostAndPort}/?v=1&client_id=${this.OAUTH2_CLIENT_ID}`),this.socket.onopen=this._handleOpen.bind(this),this.socket.onclose=this._handleClose.bind(this),this.socket.onmessage=this._handleMessage.bind(this)}}disconnect(t){this.connected&&(this.requestedDisconnect=!0,this.socket.close(),t&&t())}reconnect(){this.connected&&this.socket.close()}authenticate(){if(!this.authenticated)return this.accessToken?void this.request("AUTHENTICATE",{access_token:this.accessToken},(t,e)=>{return t&&t.code===RPCErrors.INVALID_TOKEN?void this.authorize():(this.authenticated=!0,this.flushQueue(),void this.activeSubscriptions.forEach(t=>this.subscribe(t.evt,t.args,t.callback)))}):void this.authorize()}flushQueue(){const t=this.queue;this.queue=[],t.forEach(t=>t())}authorize(){this.authenticated||o.get(`${this.API_ENDPOINT}/token`).then(t=>{if(!t.ok||!t.body.rpc_token)throw new Error("no rpc token");return this.request("AUTHORIZE",{client_id:this.OAUTH2_CLIENT_ID,scopes:["rpc","rpc.api"],rpc_token:t.body.rpc_token})}).then(t=>o.post(`${this.API_ENDPOINT}/token`).send({code:t.code})).then(t=>{if(!t.ok)throw new Error("no access token");this.accessToken=t.body.access_token,this.authenticate()}).catch(t=>{setTimeout(this.authorize.bind(this),3e3)})}request(t,e,n,r){return"function"==typeof n&&(r=n,n=void 0),new Promise((s,o)=>{if(!this.connected||!this.ready||!this.authenticated&&["AUTHORIZE","AUTHENTICATE"].indexOf(t)===-1)return void this.queue.push(()=>this.request(t,e,n,r));const u=c();this.evts.once(i(RPCCommands.DISPATCH,u),(t,e)=>{r&&r(t,e),t?o(t):s(e)}),this.socket.send(JSON.stringify({cmd:t,args:e,evt:n,nonce:u}))})}subscribe(t,e,n){this.request(RPCCommands.SUBSCRIBE,e,t,r=>{return r?void(n&&n(r)):void(this.activeSubscriptions.find(t=>{return n===t.callback})||(this.activeSubscriptions.push({evt:t,args:e,callback:n}),this.evts.on(i(RPCCommands.DISPATCH,null,t),t=>{n&&n(null,t)})))})}unsubscribe(t,e,n){this.request(RPCCommands.UNSUBSCRIBE,e,t,r=>{if(r)return void(n&&n(r));for(const s in this.activeSubscriptions){const n=this.activeSubscriptions[s];t===n.evt&&u(e,n.args)&&this.activeSubscriptions.splice(s,1)}const o=i(RPCCommands.DISPATCH,null,t);this.evts.listeners(o).forEach(t=>{this.evts.removeListener(o,t)}),n&&n()})}_handleOpen(){this.connected=!0,this.authenticate()}_handleClose(t){if(this.connected=!1,this.authenticated=!1,this.ready=!1,console.error("WS Closed:",t),this.requestedDisconnect)return void(this.requestedDisconnect=!1);try{this.socket.close()}catch(t){}setTimeout(()=>this.connect(null,1006===t.code?++this.connectionTries:0),250)}_handleMessage(t){let e=null;try{e=JSON.parse(t.data)}catch(t){return void console.error("Payload not JSON:",e)}let{cmd,evt,nonce,data}=e;if(cmd===RPCCommands.AUTHENTICATE){if(evt===RPCEvents.ERROR)return void this.evts.emit("ERROR",data);this.user=data.user,this.application=data.application,this.evts.emit("READY",data)}if(cmd===RPCCommands.DISPATCH)return evt===RPCEvents.READY?(this.config=data.config,this.ready=!0,void this.flushQueue()):evt===RPCEvents.ERROR?(console.error("Dispatched Error",data),void this.socket.close()):void this.evts.emit(i(RPCCommands.DISPATCH,null,evt),data);let n=null;evt===RPCEvents.ERROR&&(n=new Error(data.message),n.code=data.code,data=null),this.evts.emit(i(RPCCommands.DISPATCH,nonce),n,data)}}t.exports=h},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function r(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!r(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,r,u,c,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}if(n=this._events[t],o(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(s(n))for(u=Array.prototype.slice.call(arguments,1),a=n.slice(),r=a.length,c=0;c0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,r,o,u;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){r=u;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){function i(){}function r(t){if(!y(t))return t;var e=[];for(var n in t)s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){s(t,e,n)});else if(y(n))for(var i in n)s(t,e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,i={},r=t.split("&"),s=0,o=r.length;s=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(t){i=t}i?n.callback(i,e):n.callback(null,e)})}function f(t,e){var n=m("DELETE",t);return e&&n.end(e),n}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var _=n(8),v=n(12),y=n(5),m=t.exports=n(13).bind(null,p);m.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var E="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};m.serializeObject=r,m.parseString=o,m.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":r,"application/json":JSON.stringify},m.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=a(e);var n=h(e);for(var i in n)this[i]=n[i]},l.prototype._parseBody=function(t){var e=m.parse[this.type];return!e&&c(this.type)&&(e=m.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,i="cannot "+e+" "+n+" ("+this.status+")",r=new Error(i);return r.status=this.status,r.method=e,r.url=n,r},m.Response=l,_(p.prototype),v(p.prototype),p.prototype.type=function(t){return this.set("Content-Type",m.types[t]||t),this},p.prototype.responseType=function(t){return this._responseType=t,this},p.prototype.accept=function(t){return this.set("Accept",m.types[t]||t),this},p.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var i=btoa(t+":"+e);this.set("Authorization","Basic "+i);break;case"auto":this.username=t,this.password=e}return this},p.prototype.query=function(t){return"string"!=typeof t&&(t=r(t)),t&&this._query.push(t),this},p.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},p.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.buffer=p.prototype.ca=p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.pipe=p.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},p.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},p.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},p.prototype.end=function(t){var e=this,n=this.xhr=m.getXHR(),r=this._timeout,s=this._formData||this._data;this._callback=t||i,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(r&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},r)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var u=this._header["content-type"],a=this._serializer||m.serialize[u?u.split(";")[0]:""];!a&&c(u)&&(a=m.serialize["application/json"]),a&&(s=a(s))}for(var h in this.header)null!=this.header[h]&&n.setRequestHeader(h,this.header[h]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},m.Request=p,m.get=function(t,e,n){var i=m("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},m.head=function(t,e,n){var i=m("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.options=function(t,e,n){var i=m("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.del=f,m.delete=f,m.patch=function(t,e,n){var i=m("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.post=function(t,e,n){var i=m("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.put=function(t,e,n){var i=m("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){t.exports={name:"discord-rpc",version:"2.0.0",description:"A simple RPC client for Discord somewhat stolen from the Discord StreamKit.",main:"src/index.js",repository:{type:"git",url:"git+https://github.com/GusCaplan/discord-rpc.git"},scripts:{"web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},author:"Gus Caplan ",license:"MIT",bugs:{url:"https://github.com/GusCaplan/discord-rpc/issues"},homepage:"https://github.com/GusCaplan/discord-rpc#readme",dependencies:{"deep-equal":"^1.0.1",superagent:"^3.0.0",uuid:"^3.0.0",ws:"^1.1.1"},devDependencies:{"babel-core":"^6.18.2","babel-loader":"^6.2.8","babel-preset-es2015":"^6.18.0",bufferutil:"^1.2.1","ignore-loader":"^0.1.2","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27"},browser:{ws:!1}}},function(t,e,n){const i=n(2),r=n(3).EventEmitter;class s extends r{constructor({OAUTH2_CLIENT_ID}={}){super(),this.rpc=new i({OAUTH2_CLIENT_ID:OAUTH2_CLIENT_ID}),this.rpc.evts.on("READY",()=>{this.user=this.rpc.user,this.application=this.rpc.application,this.emit("ready")}),this.rpc.evts.on("ERROR",t=>this.emit("error",t)),this.rest=this.rpc.rest}getGuild(t,e){return new Promise((n,i)=>{this.rpc.request("GET_GUILD",{guild_id:t,timeout:e},(t,e)=>{t&&i(t),n(e.data)})})}getGuilds(){return new Promise((t,e)=>{this.rpc.request("GET_GUILDS",{},(n,i)=>{n&&e(n),t(i.data.guilds)})})}getChannel(t,e){return new Promise((n,i)=>{this.rpc.request("GET_CHANNEL",{channel_id:t,timeout:e},(t,e)=>{t&&i(t),n(e.data)})})}getChannels(){return new Promise((t,e)=>{this.rpc.request("GET_CHANNELS",{},(n,i)=>{n&&e(n),t(i.data.channels)})})}setUserVoiceSettings(t){return new Promise((e,n)=>{this.rpc.request("SET_USER_VOICE_SETTINGS",t,(t,i)=>{t&&n(t),e(i.data)})})}selectVoiceChannel(t,e,n=false){return new Promise((i,r)=>{this.rpc.request("SELECT_VOICE_CHANNEL",{channel_id:t,timeout:e,force:n},(t,e)=>{t&&r(t),i(e.data)})})}selectTextChannel(t,e,n=false){return new Promise((i,r)=>{this.rpc.request("SELECT_TEXT_CHANNEL",{channel_id:t,timeout:e,force:n},(t,e)=>{t&&r(t),i(e.data)})})}getVoiceSettings(){return new Promise((t,e)=>{this.rpc.request("GET_VOICE_SETTINGS",{},(n,i)=>{n&&e(n),t(i.data)})})}setVoiceSettings(t){return new Promise((e,n)=>{this.rpc.request("SET_VOICE_SETTINGS",t,(t,i)=>{t&&n(t),e(i.data)})})}subscribe(t,e,n){return this.rpc.subscribe(t,e,n)}unsubscribe(t,e,n){return this.rpc.unsubscribe(t,e,n)}connect(t){return this.rpc.connect(t)}}t.exports=s},function(t,e,n){function i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,r=0;r0&&"number"!=typeof t[0]))}function s(t,e,n){var s,h;if(i(t)||i(e))return!1;if(t.prototype!==e.prototype)return!1;if(c(t))return!!c(e)&&(t=o.call(t),e=o.call(e),a(t,e,n));if(r(t)){if(!r(e))return!1;if(t.length!==e.length)return!1;for(s=0;s=0;s--)if(l[s]!=p[s])return!1;for(s=l.length-1;s>=0;s--)if(h=l[s],!a(t[h],e[h],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,u=n(11),c=n(10),a=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:s(t,e,n))}},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=r?n:i,e.supported=n,e.unsupported=i},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e,n){function i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var s=n(5);t.exports=i,i.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){return this._timeout=t,this},i.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,i){n?e(n):t(i)})})}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(s(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(s(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=s(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&s(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){(function(e){var n,i=e.crypto||e.msCrypto;if(i&&i.getRandomValues){var r=new Uint8Array(16);n=function(){return i.getRandomValues(r),r}}if(!n){var s=new Array(16);n=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}t.exports=n}).call(e,n(16))},function(t,e,n){function i(t,e){var n=e||0,i=u;return i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]}function r(t,e,n){var r=e&&n||0,s=e||[];t=t||{};var o=void 0!==t.clockseq?t.clockseq:p,u=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:d+1,a=u-f+(c-d)/1e4;if(a<0&&void 0===t.clockseq&&(o=o+1&16383),(a<0||u>f)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=u,d=c,p=o,u+=122192928e5;var h=(1e4*(268435455&u)+c)%4294967296;s[r++]=h>>>24&255,s[r++]=h>>>16&255,s[r++]=h>>>8&255,s[r++]=255&h;var _=u/4294967296*1e4&268435455;s[r++]=_>>>8&255,s[r++]=255&_,s[r++]=_>>>24&15|16,s[r++]=_>>>16&255,s[r++]=o>>>8|128,s[r++]=255&o;for(var v=t.node||l,y=0;y<6;++y)s[r+y]=v[y];return e?e:i(s)}function s(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var u=0;u<16;++u)e[r+u]=s[u];return e||i(s)}for(var o=n(14),u=[],c={},a=0;a<256;++a)u[a]=(a+256).toString(16).substr(1),c[u[a]]=a;var h=o(),l=[1|h[0],h[1],h[2],h[3],h[4],h[5]],p=16383&(h[6]<<8|h[7]),f=0,d=0,_=s;_.v1=r,_.v4=s,t.exports=_},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){t.exports={version:n(6).version,Client:n(7),RPC:n(2),Rest:n(1),Constants:n(0)},"undefined"!=typeof window&&(window.DiscordRPC=t.exports)}]); \ No newline at end of file +!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e){const n=t=>{let e={};for(const n of t)e[n]=n;return e};t.exports.RPCCommands=n(["DISPATCH","AUTHORIZE","AUTHENTICATE","GET_GUILD","GET_GUILDS","GET_CHANNEL","GET_CHANNELS","SUBSCRIBE","UNSUBSCRIBE","SET_USER_VOICE_SETTINGS","SELECT_VOICE_CHANNEL","GET_VOICE_SETTINGS","SET_VOICE_SETTINGS","SELECT_TEXT_CHANNEL","INVITE_BROWSER"]),t.exports.RPCEvents=n(["READY","ERROR","GUILD_STATUS","GUILD_CREATE","CHANNEL_CREATE","VOICE_STATE_CREATE","VOICE_STATE_DELETE","VOICE_STATE_UPDATE","VOICE_SETTINGS_UPDATE","VOICE_CONNECTION_STATUS","SPEAKING_START","SPEAKING_STOP","MESSAGE_CREATE","MESSAGE_UPDATE","MESSAGE_DELETE"]),t.exports.RPCErrors={UNKNOWN_ERROR:1e3,INVALID_PAYLOAD:4e3,INVALID_VERSION:4001,INVALID_COMMAND:4002,INVALID_GUILD:4003,INVALID_EVENT:4004,INVALID_CHANNEL:4005,INVALID_PERMISSIONS:4006,INVALID_CLIENTID:4007,INVALID_ORIGIN:4008,INVALID_TOKEN:4009,INVALID_USER:4010,OAUTH2_ERROR:5e3},t.exports.RPCCloseCodes={INVALID_CLIENTID:4e3,INVALID_ORIGIN:4001,RATELIMITED:4002,TOKEN_REVOKED:4003},t.exports.ChannelTypes={DM:1,GROUP_DM:3,GUILD_TEXT:0,GUILD_VOICE:2};const i=t.exports.Endpoints={login:"/auth/login",logout:"/auth/logout",gateway:"/gateway",botGateway:"/gateway/bot",invite:t=>`/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`/users/${t}`,userChannels:t=>`${i.user(t)}/channels`,userProfile:t=>`${i.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${i.user(t)}/avatars/${e}.jpg`,me:"/users/@me",meGuild:t=>`${i.me}/guilds/${t}`,relationships:t=>`${i.user(t)}/relationships`,note:t=>`${i.me}/notes/${t}`,guilds:"/guilds",guild:t=>`${i.guilds}/${t}`,guildIcon:(t,e)=>`${i.guild(t)}/icons/${e}.jpg`,guildPrune:t=>`${i.guild(t)}/prune`,guildEmbed:t=>`${i.guild(t)}/embed`,guildInvites:t=>`${i.guild(t)}/invites`,guildRoles:t=>`${i.guild(t)}/roles`,guildRole:(t,e)=>`${i.guildRoles(t)}/${e}`,guildBans:t=>`${i.guild(t)}/bans`,guildIntegrations:t=>`${i.guild(t)}/integrations`,guildMembers:t=>`${i.guild(t)}/members`,guildMember:(t,e)=>`${i.guildMembers(t)}/${e}`,guildMemberRole:(t,e,n)=>`${i.guildMember(t,e)}/roles/${n}`,stupidInconsistentGuildEndpoint:t=>`${i.guildMember(t,"@me")}/nick`,guildChannels:t=>`${i.guild(t)}/channels`,guildEmojis:t=>`${i.guild(t)}/emojis`,channels:"/channels",channel:t=>`${i.channels}/${t}`,channelMessages:t=>`${i.channel(t)}/messages`,channelInvites:t=>`${i.channel(t)}/invites`,channelTyping:t=>`${i.channel(t)}/typing`,channelPermissions:t=>`${i.channel(t)}/permissions`,channelMessage:(t,e)=>`${i.channelMessages(t)}/${e}`,channelWebhooks:t=>`${i.channel(t)}/webhooks`,messageReactions:(t,e)=>`${i.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,r)=>`${i.messageReactions(t,e)}/${n}${r?`?limit=${r}`:""}`,selfMessageReaction:(t,e,n,r)=>`${i.messageReaction(t,e,n,r)}/@me`,userMessageReaction:(t,e,n,r,s)=>`${i.messageReaction(t,e,n,r)}/${s}`,webhook:(t,e)=>`/webhooks/${t}${e?`/${e}`:""}`,myApplication:"/oauth2/applications/@me",getApp:t=>`/oauth2/authorize?client_id=${t}`}},function(t,e,n){const i=n(4),{Endpoints}=n(0);t.exports=class t{constructor(t){this.client=t}makeRequest(t,e,n={},r={}){return new Promise((s,o)=>{r.Authorization=`Bearer ${this.client.accessToken}`,i[t.toLowerCase()](`https://${this.client.hostAndPort}${e}`).set(r).send(n).then(t=>s(t.body),o)})}sendMessage(t,e){return this.makeRequest("post",Endpoints.channelMessages(t),{content:e})}editMessage(t,e,n){return this.makeRequest("patch",Endpoints.channelMessage(t,e),{content:n})}deleteMessage(t,e){return this.makeRequest("delete",Endpoints.channelMessage(t,e))}}},function(t,e,n){function i(t,e,n){return`${t}:${e||n}`}const r="undefined"!=typeof window?window.WebSocket:n(17),s=n(3).EventEmitter,{RPCCommands,RPCEvents,RPCErrors}=n(0),o=n(4),u=n(9),c=n(15).v4,a=n(1);class h{constructor(t){this.evts=new s,this.activeSubscriptions=[],this.queue=[],this.connected=!1,this.ready=!1,this.requestedDisconnect=!1,this.connectionTries=0,this.socket=null,this.config={},this.OAUTH2_CLIENT_ID=t.OAUTH2_CLIENT_ID,this.API_ENDPOINT=t.API_ENDPOINT||"",this.rest=new a(this)}connect(t=this.accessToken,e=0){if(!this.connected){this.accessToken=t;const n=6463+e%10;this.hostAndPort=`${c()}.discordapp.io:${n}`,this.socket=new r(`wss://${this.hostAndPort}/?v=1&client_id=${this.OAUTH2_CLIENT_ID}`),this.socket.onopen=this._handleOpen.bind(this),this.socket.onclose=this._handleClose.bind(this),this.socket.onmessage=this._handleMessage.bind(this)}}disconnect(t){this.connected&&(this.requestedDisconnect=!0,this.socket.close(),t&&t())}reconnect(){this.connected&&this.socket.close()}authenticate(){if(!this.authenticated)return this.accessToken?void this.request("AUTHENTICATE",{access_token:this.accessToken},(t,e)=>{return t&&t.code===RPCErrors.INVALID_TOKEN?void this.authorize():(this.authenticated=!0,this.flushQueue(),void this.activeSubscriptions.forEach(t=>this.subscribe(t.evt,t.args,t.callback)))}):void this.authorize()}flushQueue(){const t=this.queue;this.queue=[],t.forEach(t=>t())}authorize(){this.authenticated||o.get(`${this.API_ENDPOINT}/token`).then(t=>{if(!t.ok||!t.body.rpc_token)throw new Error("no rpc token");return this.request("AUTHORIZE",{client_id:this.OAUTH2_CLIENT_ID,scopes:["rpc","rpc.api"],rpc_token:t.body.rpc_token})}).then(t=>o.post(`${this.API_ENDPOINT}/token`).send({code:t.code})).then(t=>{if(!t.ok)throw new Error("no access token");this.accessToken=t.body.access_token,this.authenticate()}).catch(t=>{setTimeout(this.authorize.bind(this),3e3)})}request(t,e,n,r){return"function"==typeof n&&(r=n,n=void 0),new Promise((s,o)=>{if(!this.connected||!this.ready||!this.authenticated&&["AUTHORIZE","AUTHENTICATE"].indexOf(t)===-1)return void this.queue.push(()=>this.request(t,e,n,r));const u=c();this.evts.once(i(RPCCommands.DISPATCH,u),(t,e)=>{r&&r(t,e),t?o(t):s(e)}),this.socket.send(JSON.stringify({cmd:t,args:e,evt:n,nonce:u}))})}subscribe(t,e,n){this.request(RPCCommands.SUBSCRIBE,e,t,r=>{return r?void(n&&n(r)):void(this.activeSubscriptions.find(t=>{return n===t.callback})||(this.activeSubscriptions.push({evt:t,args:e,callback:n}),this.evts.on(i(RPCCommands.DISPATCH,null,t),t=>{n&&n(null,t)})))})}unsubscribe(t,e,n){this.request(RPCCommands.UNSUBSCRIBE,e,t,r=>{if(r)return void(n&&n(r));for(const s in this.activeSubscriptions){const n=this.activeSubscriptions[s];t===n.evt&&u(e,n.args)&&this.activeSubscriptions.splice(s,1)}const o=i(RPCCommands.DISPATCH,null,t);this.evts.listeners(o).forEach(t=>{this.evts.removeListener(o,t)}),n&&n()})}_handleOpen(){this.connected=!0,this.authenticate()}_handleClose(t){if(this.connected=!1,this.authenticated=!1,this.ready=!1,console.error("WS Closed:",t),this.requestedDisconnect)return void(this.requestedDisconnect=!1);try{this.socket.close()}catch(t){}setTimeout(()=>this.connect(null,1006===t.code?++this.connectionTries:0),250)}_handleMessage(t){let e=null;try{e=JSON.parse(t.data)}catch(t){return void console.error("Payload not JSON:",e)}let{cmd,evt,nonce,data}=e;if(cmd===RPCCommands.AUTHENTICATE){if(evt===RPCEvents.ERROR)return void this.evts.emit("ERROR",data);this.user=data.user,this.application=data.application,this.evts.emit("READY",data)}if(cmd===RPCCommands.DISPATCH)return evt===RPCEvents.READY?(this.config=data.config,this.ready=!0,void this.flushQueue()):evt===RPCEvents.ERROR?(console.error("Dispatched Error",data),void this.socket.close()):void this.evts.emit(i(RPCCommands.DISPATCH,null,evt),data);let n=null;evt===RPCEvents.ERROR&&(n=new Error(data.message),n.code=data.code,data=null),this.evts.emit(i(RPCCommands.DISPATCH,nonce),n,data)}}t.exports=h},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function r(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!r(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,r,u,c,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}if(n=this._events[t],o(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(s(n))for(u=Array.prototype.slice.call(arguments,1),a=n.slice(),r=a.length,c=0;c0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,r,o,u;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){r=u;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){function i(){}function r(t){if(!y(t))return t;var e=[];for(var n in t)s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){s(t,e,n)});else if(y(n))for(var i in n)s(t,e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,i={},r=t.split("&"),s=0,o=r.length;s=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(t){i=t}i?n.callback(i,e):n.callback(null,e)})}function f(t,e){var n=m("DELETE",t);return e&&n.end(e),n}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var _=n(8),v=n(12),y=n(5),m=t.exports=n(13).bind(null,p);m.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var E="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};m.serializeObject=r,m.parseString=o,m.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":r,"application/json":JSON.stringify},m.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=a(e);var n=h(e);for(var i in n)this[i]=n[i]},l.prototype._parseBody=function(t){var e=m.parse[this.type];return!e&&c(this.type)&&(e=m.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,i="cannot "+e+" "+n+" ("+this.status+")",r=new Error(i);return r.status=this.status,r.method=e,r.url=n,r},m.Response=l,_(p.prototype),v(p.prototype),p.prototype.type=function(t){return this.set("Content-Type",m.types[t]||t),this},p.prototype.responseType=function(t){return this._responseType=t,this},p.prototype.accept=function(t){return this.set("Accept",m.types[t]||t),this},p.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var i=btoa(t+":"+e);this.set("Authorization","Basic "+i);break;case"auto":this.username=t,this.password=e}return this},p.prototype.query=function(t){return"string"!=typeof t&&(t=r(t)),t&&this._query.push(t),this},p.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},p.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.buffer=p.prototype.ca=p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.pipe=p.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},p.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},p.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},p.prototype.end=function(t){var e=this,n=this.xhr=m.getXHR(),r=this._timeout,s=this._formData||this._data;this._callback=t||i,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(r&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},r)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var u=this._header["content-type"],a=this._serializer||m.serialize[u?u.split(";")[0]:""];!a&&c(u)&&(a=m.serialize["application/json"]),a&&(s=a(s))}for(var h in this.header)null!=this.header[h]&&n.setRequestHeader(h,this.header[h]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},m.Request=p,m.get=function(t,e,n){var i=m("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},m.head=function(t,e,n){var i=m("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.options=function(t,e,n){var i=m("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.del=f,m.delete=f,m.patch=function(t,e,n){var i=m("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.post=function(t,e,n){var i=m("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},m.put=function(t,e,n){var i=m("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){t.exports={name:"discord-rpc",version:"2.0.1",description:"A simple RPC client for Discord somewhat stolen from the Discord StreamKit.",main:"src/index.js",repository:{type:"git",url:"git+https://github.com/GusCaplan/discord-rpc.git"},scripts:{"web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},author:"Gus Caplan ",license:"MIT",bugs:{url:"https://github.com/GusCaplan/discord-rpc/issues"},homepage:"https://github.com/GusCaplan/discord-rpc#readme",dependencies:{"deep-equal":"^1.0.1",superagent:"^3.0.0",uuid:"^3.0.0",ws:"^1.1.1"},devDependencies:{"babel-core":"^6.18.2","babel-loader":"^6.2.8","babel-preset-es2015":"^6.18.0",bufferutil:"^1.2.1","ignore-loader":"^0.1.2","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27"},browser:{ws:!1}}},function(t,e,n){const i=n(2),r=n(3).EventEmitter;class s extends r{constructor({OAUTH2_CLIENT_ID}={}){super(),this.rpc=new i({OAUTH2_CLIENT_ID:OAUTH2_CLIENT_ID}),this.rpc.evts.on("READY",()=>{this.user=this.rpc.user,this.application=this.rpc.application,this.emit("ready")}),this.rpc.evts.on("ERROR",t=>this.emit("error",t)),this.rest=this.rpc.rest}getGuild(t,e){return new Promise((n,i)=>{this.rpc.request("GET_GUILD",{guild_id:t,timeout:e},(t,e)=>{t&&i(t),n(e)})})}getGuilds(){return new Promise((t,e)=>{this.rpc.request("GET_GUILDS",{},(n,i)=>{n&&e(n),t(i.guilds)})})}getChannel(t,e){return new Promise((n,i)=>{this.rpc.request("GET_CHANNEL",{channel_id:t,timeout:e},(t,e)=>{t&&i(t),n(e)})})}getChannels(){return new Promise((t,e)=>{this.rpc.request("GET_CHANNELS",{},(n,i)=>{n&&e(n),t(i.channels)})})}setUserVoiceSettings(t){return new Promise((e,n)=>{this.rpc.request("SET_USER_VOICE_SETTINGS",t,(t,i)=>{t&&n(t),e(i)})})}selectVoiceChannel(t,e,n=false){return new Promise((i,r)=>{this.rpc.request("SELECT_VOICE_CHANNEL",{channel_id:t,timeout:e,force:n},(t,e)=>{t&&r(t),i(e)})})}selectTextChannel(t,e,n=false){return new Promise((i,r)=>{this.rpc.request("SELECT_TEXT_CHANNEL",{channel_id:t,timeout:e,force:n},(t,e)=>{t&&r(t),i(e)})})}getVoiceSettings(){return new Promise((t,e)=>{this.rpc.request("GET_VOICE_SETTINGS",{},(n,i)=>{n&&e(n),t(i)})})}setVoiceSettings(t){return new Promise((e,n)=>{this.rpc.request("SET_VOICE_SETTINGS",t,(t,i)=>{t&&n(t),e(i)})})}subscribe(t,e,n){return this.rpc.subscribe(t,e,n)}unsubscribe(t,e,n){return this.rpc.unsubscribe(t,e,n)}connect(t){return this.rpc.connect(t)}}t.exports=s},function(t,e,n){function i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,r=0;r0&&"number"!=typeof t[0]))}function s(t,e,n){var s,h;if(i(t)||i(e))return!1;if(t.prototype!==e.prototype)return!1;if(c(t))return!!c(e)&&(t=o.call(t),e=o.call(e),a(t,e,n));if(r(t)){if(!r(e))return!1;if(t.length!==e.length)return!1;for(s=0;s=0;s--)if(l[s]!=p[s])return!1;for(s=l.length-1;s>=0;s--)if(h=l[s],!a(t[h],e[h],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,u=n(11),c=n(10),a=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:s(t,e,n))}},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=r?n:i,e.supported=n,e.unsupported=i},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e,n){function i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var s=n(5);t.exports=i,i.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){return this._timeout=t,this},i.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,i){n?e(n):t(i)})})}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(s(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(s(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=s(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&s(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){(function(e){var n,i=e.crypto||e.msCrypto;if(i&&i.getRandomValues){var r=new Uint8Array(16);n=function(){return i.getRandomValues(r),r}}if(!n){var s=new Array(16);n=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}t.exports=n}).call(e,n(16))},function(t,e,n){function i(t,e){var n=e||0,i=u;return i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]}function r(t,e,n){var r=e&&n||0,s=e||[];t=t||{};var o=void 0!==t.clockseq?t.clockseq:p,u=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:d+1,a=u-f+(c-d)/1e4;if(a<0&&void 0===t.clockseq&&(o=o+1&16383),(a<0||u>f)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=u,d=c,p=o,u+=122192928e5;var h=(1e4*(268435455&u)+c)%4294967296;s[r++]=h>>>24&255,s[r++]=h>>>16&255,s[r++]=h>>>8&255,s[r++]=255&h;var _=u/4294967296*1e4&268435455;s[r++]=_>>>8&255,s[r++]=255&_,s[r++]=_>>>24&15|16,s[r++]=_>>>16&255,s[r++]=o>>>8|128,s[r++]=255&o;for(var v=t.node||l,y=0;y<6;++y)s[r+y]=v[y];return e?e:i(s)}function s(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var u=0;u<16;++u)e[r+u]=s[u];return e||i(s)}for(var o=n(14),u=[],c={},a=0;a<256;++a)u[a]=(a+256).toString(16).substr(1),c[u[a]]=a;var h=o(),l=[1|h[0],h[1],h[2],h[3],h[4],h[5]],p=16383&(h[6]<<8|h[7]),f=0,d=0,_=s;_.v1=r,_.v4=s,t.exports=_},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){t.exports={version:n(6).version,Client:n(7),RPC:n(2),Rest:n(1),Constants:n(0)},"undefined"!=typeof window&&(window.DiscordRPC=t.exports)}]); \ No newline at end of file diff --git a/webpack/rpc.2.0.0.js b/webpack/rpc.2.0.1.js similarity index 99% rename from webpack/rpc.2.0.0.js rename to webpack/rpc.2.0.1.js index 47dad72..e5aa509 100644 --- a/webpack/rpc.2.0.0.js +++ b/webpack/rpc.2.0.1.js @@ -2032,7 +2032,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this2.rpc.request('GET_GUILD', { guild_id: id, timeout: timeout }, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2044,7 +2044,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this3.rpc.request('GET_GUILDS', {}, function (err, res) { if (err) reject(err); - resolve(res.data.guilds); + resolve(res.guilds); }); }); } @@ -2056,7 +2056,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this4.rpc.request('GET_CHANNEL', { channel_id: id, timeout: timeout }, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2068,7 +2068,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this5.rpc.request('GET_CHANNELS', {}, function (err, res) { if (err) reject(err); - resolve(res.data.channels); + resolve(res.channels); }); }); } @@ -2080,7 +2080,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this6.rpc.request('SET_USER_VOICE_SETTINGS', args, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2094,7 +2094,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this7.rpc.request('SELECT_VOICE_CHANNEL', { channel_id: id, timeout: timeout, force: force }, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2108,7 +2108,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this8.rpc.request('SELECT_TEXT_CHANNEL', { channel_id: id, timeout: timeout, force: force }, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2120,7 +2120,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this9.rpc.request('GET_VOICE_SETTINGS', {}, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2132,7 +2132,7 @@ var Client = function (_EventEmitter) { return new Promise(function (resolve, reject) { _this10.rpc.request('SET_VOICE_SETTINGS', args, function (err, res) { if (err) reject(err); - resolve(res.data); + resolve(res); }); }); } @@ -2164,7 +2164,7 @@ module.exports = Client; module.exports = { "name": "discord-rpc", - "version": "2.0.0", + "version": "2.0.1", "description": "A simple RPC client for Discord somewhat stolen from the Discord StreamKit.", "main": "src/index.js", "repository": { diff --git a/webpack/rpc.2.0.0.min.js b/webpack/rpc.2.0.1.min.js similarity index 70% rename from webpack/rpc.2.0.0.min.js rename to webpack/rpc.2.0.1.min.js index e1b7494..9efb4d7 100644 --- a/webpack/rpc.2.0.0.min.js +++ b/webpack/rpc.2.0.1.min.js @@ -1,2 +1,2 @@ -!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e){"use strict";var n=function(t){var e={},n=!0,r=!1,i=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var u=s.value;e[u]=u}}catch(t){r=!0,i=t}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}return e};t.exports.RPCCommands=n(["DISPATCH","AUTHORIZE","AUTHENTICATE","GET_GUILD","GET_GUILDS","GET_CHANNEL","GET_CHANNELS","SUBSCRIBE","UNSUBSCRIBE","SET_USER_VOICE_SETTINGS","SELECT_VOICE_CHANNEL","GET_VOICE_SETTINGS","SET_VOICE_SETTINGS","SELECT_TEXT_CHANNEL","INVITE_BROWSER"]),t.exports.RPCEvents=n(["READY","ERROR","GUILD_STATUS","GUILD_CREATE","CHANNEL_CREATE","VOICE_STATE_CREATE","VOICE_STATE_DELETE","VOICE_STATE_UPDATE","VOICE_SETTINGS_UPDATE","VOICE_CONNECTION_STATUS","SPEAKING_START","SPEAKING_STOP","MESSAGE_CREATE","MESSAGE_UPDATE","MESSAGE_DELETE"]),t.exports.RPCErrors={UNKNOWN_ERROR:1e3,INVALID_PAYLOAD:4e3,INVALID_VERSION:4001,INVALID_COMMAND:4002,INVALID_GUILD:4003,INVALID_EVENT:4004,INVALID_CHANNEL:4005,INVALID_PERMISSIONS:4006,INVALID_CLIENTID:4007,INVALID_ORIGIN:4008,INVALID_TOKEN:4009,INVALID_USER:4010,OAUTH2_ERROR:5e3},t.exports.RPCCloseCodes={INVALID_CLIENTID:4e3,INVALID_ORIGIN:4001,RATELIMITED:4002,TOKEN_REVOKED:4003},t.exports.ChannelTypes={DM:1,GROUP_DM:3,GUILD_TEXT:0,GUILD_VOICE:2};var r=t.exports.Endpoints={login:"/auth/login",logout:"/auth/logout",gateway:"/gateway",botGateway:"/gateway/bot",invite:function(t){return"/invite/"+t},inviteLink:function(t){return"https://discord.gg/"+t},CDN:"https://cdn.discordapp.com",user:function(t){return"/users/"+t},userChannels:function(t){return r.user(t)+"/channels"},userProfile:function(t){return r.user(t)+"/profile"},avatar:function(t,e){return"1"===t?e:r.user(t)+"/avatars/"+e+".jpg"},me:"/users/@me",meGuild:function(t){return r.me+"/guilds/"+t},relationships:function(t){return r.user(t)+"/relationships"},note:function(t){return r.me+"/notes/"+t},guilds:"/guilds",guild:function(t){return r.guilds+"/"+t},guildIcon:function(t,e){return r.guild(t)+"/icons/"+e+".jpg"},guildPrune:function(t){return r.guild(t)+"/prune"},guildEmbed:function(t){return r.guild(t)+"/embed"},guildInvites:function(t){return r.guild(t)+"/invites"},guildRoles:function(t){return r.guild(t)+"/roles"},guildRole:function(t,e){return r.guildRoles(t)+"/"+e},guildBans:function(t){return r.guild(t)+"/bans"},guildIntegrations:function(t){return r.guild(t)+"/integrations"},guildMembers:function(t){return r.guild(t)+"/members"},guildMember:function(t,e){return r.guildMembers(t)+"/"+e},guildMemberRole:function(t,e,n){return r.guildMember(t,e)+"/roles/"+n},stupidInconsistentGuildEndpoint:function(t){return r.guildMember(t,"@me")+"/nick"},guildChannels:function(t){return r.guild(t)+"/channels"},guildEmojis:function(t){return r.guild(t)+"/emojis"},channels:"/channels",channel:function(t){return r.channels+"/"+t},channelMessages:function(t){return r.channel(t)+"/messages"},channelInvites:function(t){return r.channel(t)+"/invites"},channelTyping:function(t){return r.channel(t)+"/typing"},channelPermissions:function(t){return r.channel(t)+"/permissions"},channelMessage:function(t,e){return r.channelMessages(t)+"/"+e},channelWebhooks:function(t){return r.channel(t)+"/webhooks"},messageReactions:function(t,e){return r.channelMessage(t,e)+"/reactions"},messageReaction:function(t,e,n,i){return r.messageReactions(t,e)+"/"+n+(i?"?limit="+i:"")},selfMessageReaction:function(t,e,n,i){return r.messageReaction(t,e,n,i)+"/@me"},userMessageReaction:function(t,e,n,i,s){return r.messageReaction(t,e,n,i)+"/"+s},webhook:function(t,e){return"/webhooks/"+t+(e?"/"+e:"")},myApplication:"/oauth2/applications/@me",getApp:function(t){return"/oauth2/authorize?client_id="+t}}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(function(o,u){i.Authorization="Bearer "+n.client.accessToken,s[t.toLowerCase()]("https://"+n.client.hostAndPort+e).set(i).send(r).then(function(t){return o(t.body)},u)})}},{key:"sendMessage",value:function(t,e){return this.makeRequest("post",u.channelMessages(t),{content:e})}},{key:"editMessage",value:function(t,e,n){return this.makeRequest("patch",u.channelMessage(t,e),{content:n})}},{key:"deleteMessage",value:function(t,e){return this.makeRequest("delete",u.channelMessage(t,e))}}]),t}()},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){return t+":"+(e||n)}var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this.accessToken,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.connected){this.accessToken=t;var n=6463+e%10;this.hostAndPort=d()+".discordapp.io:"+n,this.socket=new o("wss://"+this.hostAndPort+"/?v=1&client_id="+this.OAUTH2_CLIENT_ID),this.socket.onopen=this._handleOpen.bind(this),this.socket.onclose=this._handleClose.bind(this),this.socket.onmessage=this._handleMessage.bind(this)}}},{key:"disconnect",value:function(t){this.connected&&(this.requestedDisconnect=!0,this.socket.close(),t&&t())}},{key:"reconnect",value:function(){this.connected&&this.socket.close()}},{key:"authenticate",value:function(){var t=this;if(!this.authenticated)return this.accessToken?void this.request("AUTHENTICATE",{access_token:this.accessToken},function(e,n){return e&&e.code===l.INVALID_TOKEN?void t.authorize():(t.authenticated=!0,t.flushQueue(),void t.activeSubscriptions.forEach(function(e){return t.subscribe(e.evt,e.args,e.callback)}))}):void this.authorize()}},{key:"flushQueue",value:function(){var t=this.queue;this.queue=[],t.forEach(function(t){return t()})}},{key:"authorize",value:function(){var t=this;this.authenticated||p.get(this.API_ENDPOINT+"/token").then(function(e){if(!e.ok||!e.body.rpc_token)throw new Error("no rpc token");return t.request("AUTHORIZE",{client_id:t.OAUTH2_CLIENT_ID,scopes:["rpc","rpc.api"],rpc_token:e.body.rpc_token})}).then(function(e){return p.post(t.API_ENDPOINT+"/token").send({code:e.code})}).then(function(e){if(!e.ok)throw new Error("no access token");t.accessToken=e.body.access_token,t.authenticate()}).catch(function(e){setTimeout(t.authorize.bind(t),3e3)})}},{key:"request",value:function(t,e,n,r){var s=this;return"function"==typeof n&&(r=n,n=void 0),new Promise(function(o,u){if(!s.connected||!s.ready||!s.authenticated&&["AUTHORIZE","AUTHENTICATE"].indexOf(t)===-1)return void s.queue.push(function(){return s.request(t,e,n,r)});var a=d();s.evts.once(i(c.DISPATCH,a),function(t,e){r&&r(t,e),t?u(t):o(e)}),s.socket.send(JSON.stringify({cmd:t,args:e,evt:n,nonce:a}))})}},{key:"subscribe",value:function(t,e,n){var r=this;this.request(c.SUBSCRIBE,e,t,function(s){return s?void(n&&n(s)):void(r.activeSubscriptions.find(function(t){return n===t.callback})||(r.activeSubscriptions.push({evt:t,args:e,callback:n}),r.evts.on(i(c.DISPATCH,null,t),function(t){n&&n(null,t)})))})}},{key:"unsubscribe",value:function(t,e,n){var r=this;this.request(c.UNSUBSCRIBE,e,t,function(s){if(s)return void(n&&n(s));for(var o in r.activeSubscriptions){var u=r.activeSubscriptions[o];t===u.evt&&f(e,u.args)&&r.activeSubscriptions.splice(o,1)}var a=i(c.DISPATCH,null,t);r.evts.listeners(a).forEach(function(t){r.evts.removeListener(a,t)}),n&&n()})}},{key:"_handleOpen",value:function(){this.connected=!0,this.authenticate()}},{key:"_handleClose",value:function(t){var e=this;if(this.connected=!1,this.authenticated=!1,this.ready=!1,console.error("WS Closed:",t),this.requestedDisconnect)return void(this.requestedDisconnect=!1);try{this.socket.close()}catch(t){}setTimeout(function(){return e.connect(null,1006===t.code?++e.connectionTries:0)},250)}},{key:"_handleMessage",value:function(t){var e=null;try{e=JSON.parse(t.data)}catch(t){return void console.error("Payload not JSON:",e)}var n=e,r=n.cmd,s=n.evt,o=n.nonce,u=n.data;if(r===c.AUTHENTICATE){if(s===h.ERROR)return void this.evts.emit("ERROR",u);this.user=u.user,this.application=u.application,this.evts.emit("READY",u)}if(r===c.DISPATCH)return s===h.READY?(this.config=u.config,this.ready=!0,void this.flushQueue()):s===h.ERROR?(console.error("Dispatched Error",u),void this.socket.close()):void this.evts.emit(i(c.DISPATCH,null,s),u);var a=null;s===h.ERROR&&(a=new Error(u.message),a.code=u.code,u=null),this.evts.emit(i(c.DISPATCH,o),a,u)}}]),t}();t.exports=y},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,u,a,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}if(n=this._events[t],o(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(s(n))for(u=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,a=0;a0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,o,u;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){i=u;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){function r(){}function i(t){if(!_(t))return t;var e=[];for(var n in t)s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){s(t,e,n)});else if(_(n))for(var r in n)s(t,e+"["+r+"]",n[r]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,r={},i=t.split("&"),s=0,o=i.length;s=300)&&(r=new Error(e.statusText||"Unsuccessful HTTP response"),r.original=t,r.response=e,r.status=e.status)}catch(t){r=t}r?n.callback(r,e):n.callback(null,e)})}function f(t,e){var n=m("DELETE",t);return e&&n.end(e),n}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var v=n(8),y=n(12),_=n(5),m=t.exports=n(13).bind(null,p);m.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var E="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};m.serializeObject=i,m.parseString=o,m.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},m.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=h(e);for(var r in n)this[r]=n[r]},l.prototype._parseBody=function(t){var e=m.parse[this.type];return!e&&a(this.type)&&(e=m.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},m.Response=l,v(p.prototype),y(p.prototype),p.prototype.type=function(t){return this.set("Content-Type",m.types[t]||t),this},p.prototype.responseType=function(t){return this._responseType=t,this},p.prototype.accept=function(t){return this.set("Accept",m.types[t]||t),this},p.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},p.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},p.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},p.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.buffer=p.prototype.ca=p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.pipe=p.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},p.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},p.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},p.prototype.end=function(t){var e=this,n=this.xhr=m.getXHR(),i=this._timeout,s=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var u=this._header["content-type"],c=this._serializer||m.serialize[u?u.split(";")[0]:""];!c&&a(u)&&(c=m.serialize["application/json"]),c&&(s=c(s))}for(var h in this.header)null!=this.header[h]&&n.setRequestHeader(h,this.header[h]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},m.Request=p,m.get=function(t,e,n){var r=m("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},m.head=function(t,e,n){var r=m("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.options=function(t,e,n){var r=m("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.del=f,m.delete=f,m.patch=function(t,e,n){var r=m("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.post=function(t,e,n){var r=m("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.put=function(t,e,n){var r=m("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.OAUTH2_CLIENT_ID;r(this,e);var s=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return s.rpc=new u({OAUTH2_CLIENT_ID:n}),s.rpc.evts.on("READY",function(){s.user=s.rpc.user,s.application=s.rpc.application,s.emit("ready")}),s.rpc.evts.on("ERROR",function(t){return s.emit("error",t)}),s.rest=s.rpc.rest,s}return s(e,t),o(e,[{key:"getGuild",value:function(t,e){var n=this;return new Promise(function(r,i){n.rpc.request("GET_GUILD",{guild_id:t,timeout:e},function(t,e){t&&i(t),r(e.data)})})}},{key:"getGuilds",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_GUILDS",{},function(t,r){t&&n(t),e(r.data.guilds)})})}},{key:"getChannel",value:function(t,e){var n=this;return new Promise(function(r,i){n.rpc.request("GET_CHANNEL",{channel_id:t,timeout:e},function(t,e){t&&i(t),r(e.data)})})}},{key:"getChannels",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_CHANNELS",{},function(t,r){t&&n(t),e(r.data.channels)})})}},{key:"setUserVoiceSettings",value:function(t){var e=this;return new Promise(function(n,r){e.rpc.request("SET_USER_VOICE_SETTINGS",t,function(t,e){t&&r(t),n(e.data)})})}},{key:"selectVoiceChannel",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(function(i,s){n.rpc.request("SELECT_VOICE_CHANNEL",{channel_id:t,timeout:e,force:r},function(t,e){t&&s(t),i(e.data)})})}},{key:"selectTextChannel",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(function(i,s){n.rpc.request("SELECT_TEXT_CHANNEL",{channel_id:t,timeout:e,force:r},function(t,e){t&&s(t),i(e.data)})})}},{key:"getVoiceSettings",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_VOICE_SETTINGS",{},function(t,r){t&&n(t),e(r.data)})})}},{key:"setVoiceSettings",value:function(t){var e=this;return new Promise(function(n,r){e.rpc.request("SET_VOICE_SETTINGS",t,function(t,e){t&&r(t),n(e.data)})})}},{key:"subscribe",value:function(t,e,n){return this.rpc.subscribe(t,e,n)}},{key:"unsubscribe",value:function(t,e,n){return this.rpc.unsubscribe(t,e,n)}},{key:"connect",value:function(t){return this.rpc.connect(t)}}]),e}(a);t.exports=c},function(t,e){t.exports={name:"discord-rpc",version:"2.0.0",description:"A simple RPC client for Discord somewhat stolen from the Discord StreamKit.",main:"src/index.js",repository:{type:"git",url:"git+https://github.com/GusCaplan/discord-rpc.git"},scripts:{"web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},author:"Gus Caplan ",license:"MIT",bugs:{url:"https://github.com/GusCaplan/discord-rpc/issues"},homepage:"https://github.com/GusCaplan/discord-rpc#readme",dependencies:{"deep-equal":"^1.0.1",superagent:"^3.0.0",uuid:"^3.0.0",ws:"^1.1.1"},devDependencies:{"babel-core":"^6.18.2","babel-loader":"^6.2.8","babel-preset-es2015":"^6.18.0",bufferutil:"^1.2.1","ignore-loader":"^0.1.2","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27"},browser:{ws:!1}}},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i0&&"number"!=typeof t[0]))}function s(t,e,n){var s,h;if(r(t)||r(e))return!1;if(t.prototype!==e.prototype)return!1;if(a(t))return!!a(e)&&(t=o.call(t),e=o.call(e),c(t,e,n));if(i(t)){if(!i(e))return!1;if(t.length!==e.length)return!1;for(s=0;s=0;s--)if(l[s]!=p[s])return!1;for(s=l.length-1;s>=0;s--)if(h=l[s],!c(t[h],e[h],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,u=n(11),a=n(10),c=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:s(t,e,n))}},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=i?n:r,e.supported=n,e.unsupported=r},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var s=n(5);t.exports=r,r.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},r.prototype.parse=function(t){return this._parser=t,this},r.prototype.serialize=function(t){return this._serializer=t,this},r.prototype.timeout=function(t){return this._timeout=t,this},r.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype.use=function(t){return t(this),this},r.prototype.get=function(t){return this._header[t.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(t,e){if(s(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(s(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(){return this._withCredentials=!0,this},r.prototype.redirects=function(t){return this._maxRedirects=t,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(t){var e=s(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&s(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){(function(e){var n,r=e.crypto||e.msCrypto;if(r&&r.getRandomValues){var i=new Uint8Array(16);n=function(){return r.getRandomValues(i),i}}if(!n){var s=new Array(16);n=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}t.exports=n}).call(e,n(16))},function(t,e,n){function r(t,e){var n=e||0,r=u;return r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]}function i(t,e,n){var i=e&&n||0,s=e||[];t=t||{};var o=void 0!==t.clockseq?t.clockseq:p,u=void 0!==t.msecs?t.msecs:(new Date).getTime(),a=void 0!==t.nsecs?t.nsecs:d+1,c=u-f+(a-d)/1e4;if(c<0&&void 0===t.clockseq&&(o=o+1&16383),(c<0||u>f)&&void 0===t.nsecs&&(a=0), -a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=u,d=a,p=o,u+=122192928e5;var h=(1e4*(268435455&u)+a)%4294967296;s[i++]=h>>>24&255,s[i++]=h>>>16&255,s[i++]=h>>>8&255,s[i++]=255&h;var v=u/4294967296*1e4&268435455;s[i++]=v>>>8&255,s[i++]=255&v,s[i++]=v>>>24&15|16,s[i++]=v>>>16&255,s[i++]=o>>>8|128,s[i++]=255&o;for(var y=t.node||l,_=0;_<6;++_)s[i+_]=y[_];return e?e:r(s)}function s(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var u=0;u<16;++u)e[i+u]=s[u];return e||r(s)}for(var o=n(14),u=[],a={},c=0;c<256;++c)u[c]=(c+256).toString(16).substr(1),a[u[c]]=c;var h=o(),l=[1|h[0],h[1],h[2],h[3],h[4],h[5]],p=16383&(h[6]<<8|h[7]),f=0,d=0,v=s;v.v1=i,v.v4=s,t.exports=v},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){"use strict";t.exports={version:n(7).version,Client:n(6),RPC:n(2),Rest:n(1),Constants:n(0)},"undefined"!=typeof window&&(window.DiscordRPC=t.exports)}]); \ No newline at end of file +!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e){"use strict";var n=function(t){var e={},n=!0,r=!1,i=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var u=s.value;e[u]=u}}catch(t){r=!0,i=t}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}return e};t.exports.RPCCommands=n(["DISPATCH","AUTHORIZE","AUTHENTICATE","GET_GUILD","GET_GUILDS","GET_CHANNEL","GET_CHANNELS","SUBSCRIBE","UNSUBSCRIBE","SET_USER_VOICE_SETTINGS","SELECT_VOICE_CHANNEL","GET_VOICE_SETTINGS","SET_VOICE_SETTINGS","SELECT_TEXT_CHANNEL","INVITE_BROWSER"]),t.exports.RPCEvents=n(["READY","ERROR","GUILD_STATUS","GUILD_CREATE","CHANNEL_CREATE","VOICE_STATE_CREATE","VOICE_STATE_DELETE","VOICE_STATE_UPDATE","VOICE_SETTINGS_UPDATE","VOICE_CONNECTION_STATUS","SPEAKING_START","SPEAKING_STOP","MESSAGE_CREATE","MESSAGE_UPDATE","MESSAGE_DELETE"]),t.exports.RPCErrors={UNKNOWN_ERROR:1e3,INVALID_PAYLOAD:4e3,INVALID_VERSION:4001,INVALID_COMMAND:4002,INVALID_GUILD:4003,INVALID_EVENT:4004,INVALID_CHANNEL:4005,INVALID_PERMISSIONS:4006,INVALID_CLIENTID:4007,INVALID_ORIGIN:4008,INVALID_TOKEN:4009,INVALID_USER:4010,OAUTH2_ERROR:5e3},t.exports.RPCCloseCodes={INVALID_CLIENTID:4e3,INVALID_ORIGIN:4001,RATELIMITED:4002,TOKEN_REVOKED:4003},t.exports.ChannelTypes={DM:1,GROUP_DM:3,GUILD_TEXT:0,GUILD_VOICE:2};var r=t.exports.Endpoints={login:"/auth/login",logout:"/auth/logout",gateway:"/gateway",botGateway:"/gateway/bot",invite:function(t){return"/invite/"+t},inviteLink:function(t){return"https://discord.gg/"+t},CDN:"https://cdn.discordapp.com",user:function(t){return"/users/"+t},userChannels:function(t){return r.user(t)+"/channels"},userProfile:function(t){return r.user(t)+"/profile"},avatar:function(t,e){return"1"===t?e:r.user(t)+"/avatars/"+e+".jpg"},me:"/users/@me",meGuild:function(t){return r.me+"/guilds/"+t},relationships:function(t){return r.user(t)+"/relationships"},note:function(t){return r.me+"/notes/"+t},guilds:"/guilds",guild:function(t){return r.guilds+"/"+t},guildIcon:function(t,e){return r.guild(t)+"/icons/"+e+".jpg"},guildPrune:function(t){return r.guild(t)+"/prune"},guildEmbed:function(t){return r.guild(t)+"/embed"},guildInvites:function(t){return r.guild(t)+"/invites"},guildRoles:function(t){return r.guild(t)+"/roles"},guildRole:function(t,e){return r.guildRoles(t)+"/"+e},guildBans:function(t){return r.guild(t)+"/bans"},guildIntegrations:function(t){return r.guild(t)+"/integrations"},guildMembers:function(t){return r.guild(t)+"/members"},guildMember:function(t,e){return r.guildMembers(t)+"/"+e},guildMemberRole:function(t,e,n){return r.guildMember(t,e)+"/roles/"+n},stupidInconsistentGuildEndpoint:function(t){return r.guildMember(t,"@me")+"/nick"},guildChannels:function(t){return r.guild(t)+"/channels"},guildEmojis:function(t){return r.guild(t)+"/emojis"},channels:"/channels",channel:function(t){return r.channels+"/"+t},channelMessages:function(t){return r.channel(t)+"/messages"},channelInvites:function(t){return r.channel(t)+"/invites"},channelTyping:function(t){return r.channel(t)+"/typing"},channelPermissions:function(t){return r.channel(t)+"/permissions"},channelMessage:function(t,e){return r.channelMessages(t)+"/"+e},channelWebhooks:function(t){return r.channel(t)+"/webhooks"},messageReactions:function(t,e){return r.channelMessage(t,e)+"/reactions"},messageReaction:function(t,e,n,i){return r.messageReactions(t,e)+"/"+n+(i?"?limit="+i:"")},selfMessageReaction:function(t,e,n,i){return r.messageReaction(t,e,n,i)+"/@me"},userMessageReaction:function(t,e,n,i,s){return r.messageReaction(t,e,n,i)+"/"+s},webhook:function(t,e){return"/webhooks/"+t+(e?"/"+e:"")},myApplication:"/oauth2/applications/@me",getApp:function(t){return"/oauth2/authorize?client_id="+t}}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(function(o,u){i.Authorization="Bearer "+n.client.accessToken,s[t.toLowerCase()]("https://"+n.client.hostAndPort+e).set(i).send(r).then(function(t){return o(t.body)},u)})}},{key:"sendMessage",value:function(t,e){return this.makeRequest("post",u.channelMessages(t),{content:e})}},{key:"editMessage",value:function(t,e,n){return this.makeRequest("patch",u.channelMessage(t,e),{content:n})}},{key:"deleteMessage",value:function(t,e){return this.makeRequest("delete",u.channelMessage(t,e))}}]),t}()},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){return t+":"+(e||n)}var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this.accessToken,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.connected){this.accessToken=t;var n=6463+e%10;this.hostAndPort=d()+".discordapp.io:"+n,this.socket=new o("wss://"+this.hostAndPort+"/?v=1&client_id="+this.OAUTH2_CLIENT_ID),this.socket.onopen=this._handleOpen.bind(this),this.socket.onclose=this._handleClose.bind(this),this.socket.onmessage=this._handleMessage.bind(this)}}},{key:"disconnect",value:function(t){this.connected&&(this.requestedDisconnect=!0,this.socket.close(),t&&t())}},{key:"reconnect",value:function(){this.connected&&this.socket.close()}},{key:"authenticate",value:function(){var t=this;if(!this.authenticated)return this.accessToken?void this.request("AUTHENTICATE",{access_token:this.accessToken},function(e,n){return e&&e.code===l.INVALID_TOKEN?void t.authorize():(t.authenticated=!0,t.flushQueue(),void t.activeSubscriptions.forEach(function(e){return t.subscribe(e.evt,e.args,e.callback)}))}):void this.authorize()}},{key:"flushQueue",value:function(){var t=this.queue;this.queue=[],t.forEach(function(t){return t()})}},{key:"authorize",value:function(){var t=this;this.authenticated||p.get(this.API_ENDPOINT+"/token").then(function(e){if(!e.ok||!e.body.rpc_token)throw new Error("no rpc token");return t.request("AUTHORIZE",{client_id:t.OAUTH2_CLIENT_ID,scopes:["rpc","rpc.api"],rpc_token:e.body.rpc_token})}).then(function(e){return p.post(t.API_ENDPOINT+"/token").send({code:e.code})}).then(function(e){if(!e.ok)throw new Error("no access token");t.accessToken=e.body.access_token,t.authenticate()}).catch(function(e){setTimeout(t.authorize.bind(t),3e3)})}},{key:"request",value:function(t,e,n,r){var s=this;return"function"==typeof n&&(r=n,n=void 0),new Promise(function(o,u){if(!s.connected||!s.ready||!s.authenticated&&["AUTHORIZE","AUTHENTICATE"].indexOf(t)===-1)return void s.queue.push(function(){return s.request(t,e,n,r)});var a=d();s.evts.once(i(c.DISPATCH,a),function(t,e){r&&r(t,e),t?u(t):o(e)}),s.socket.send(JSON.stringify({cmd:t,args:e,evt:n,nonce:a}))})}},{key:"subscribe",value:function(t,e,n){var r=this;this.request(c.SUBSCRIBE,e,t,function(s){return s?void(n&&n(s)):void(r.activeSubscriptions.find(function(t){return n===t.callback})||(r.activeSubscriptions.push({evt:t,args:e,callback:n}),r.evts.on(i(c.DISPATCH,null,t),function(t){n&&n(null,t)})))})}},{key:"unsubscribe",value:function(t,e,n){var r=this;this.request(c.UNSUBSCRIBE,e,t,function(s){if(s)return void(n&&n(s));for(var o in r.activeSubscriptions){var u=r.activeSubscriptions[o];t===u.evt&&f(e,u.args)&&r.activeSubscriptions.splice(o,1)}var a=i(c.DISPATCH,null,t);r.evts.listeners(a).forEach(function(t){r.evts.removeListener(a,t)}),n&&n()})}},{key:"_handleOpen",value:function(){this.connected=!0,this.authenticate()}},{key:"_handleClose",value:function(t){var e=this;if(this.connected=!1,this.authenticated=!1,this.ready=!1,console.error("WS Closed:",t),this.requestedDisconnect)return void(this.requestedDisconnect=!1);try{this.socket.close()}catch(t){}setTimeout(function(){return e.connect(null,1006===t.code?++e.connectionTries:0)},250)}},{key:"_handleMessage",value:function(t){var e=null;try{e=JSON.parse(t.data)}catch(t){return void console.error("Payload not JSON:",e)}var n=e,r=n.cmd,s=n.evt,o=n.nonce,u=n.data;if(r===c.AUTHENTICATE){if(s===h.ERROR)return void this.evts.emit("ERROR",u);this.user=u.user,this.application=u.application,this.evts.emit("READY",u)}if(r===c.DISPATCH)return s===h.READY?(this.config=u.config,this.ready=!0,void this.flushQueue()):s===h.ERROR?(console.error("Dispatched Error",u),void this.socket.close()):void this.evts.emit(i(c.DISPATCH,null,s),u);var a=null;s===h.ERROR&&(a=new Error(u.message),a.code=u.code,u=null),this.evts.emit(i(c.DISPATCH,o),a,u)}}]),t}();t.exports=y},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,u,a,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}if(n=this._events[t],o(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(s(n))for(u=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,a=0;a0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,o,u;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){i=u;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){function r(){}function i(t){if(!_(t))return t;var e=[];for(var n in t)s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){s(t,e,n)});else if(_(n))for(var r in n)s(t,e+"["+r+"]",n[r]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,r={},i=t.split("&"),s=0,o=i.length;s=300)&&(r=new Error(e.statusText||"Unsuccessful HTTP response"),r.original=t,r.response=e,r.status=e.status)}catch(t){r=t}r?n.callback(r,e):n.callback(null,e)})}function f(t,e){var n=m("DELETE",t);return e&&n.end(e),n}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var v=n(8),y=n(12),_=n(5),m=t.exports=n(13).bind(null,p);m.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var E="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};m.serializeObject=i,m.parseString=o,m.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},m.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=h(e);for(var r in n)this[r]=n[r]},l.prototype._parseBody=function(t){var e=m.parse[this.type];return!e&&a(this.type)&&(e=m.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},m.Response=l,v(p.prototype),y(p.prototype),p.prototype.type=function(t){return this.set("Content-Type",m.types[t]||t),this},p.prototype.responseType=function(t){return this._responseType=t,this},p.prototype.accept=function(t){return this.set("Accept",m.types[t]||t),this},p.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},p.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},p.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},p.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.buffer=p.prototype.ca=p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.pipe=p.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},p.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},p.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},p.prototype.end=function(t){var e=this,n=this.xhr=m.getXHR(),i=this._timeout,s=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var u=this._header["content-type"],c=this._serializer||m.serialize[u?u.split(";")[0]:""];!c&&a(u)&&(c=m.serialize["application/json"]),c&&(s=c(s))}for(var h in this.header)null!=this.header[h]&&n.setRequestHeader(h,this.header[h]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},m.Request=p,m.get=function(t,e,n){var r=m("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},m.head=function(t,e,n){var r=m("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.options=function(t,e,n){var r=m("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.del=f,m.delete=f,m.patch=function(t,e,n){var r=m("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.post=function(t,e,n){var r=m("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},m.put=function(t,e,n){var r=m("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.OAUTH2_CLIENT_ID;r(this,e);var s=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return s.rpc=new u({OAUTH2_CLIENT_ID:n}),s.rpc.evts.on("READY",function(){s.user=s.rpc.user,s.application=s.rpc.application,s.emit("ready")}),s.rpc.evts.on("ERROR",function(t){return s.emit("error",t)}),s.rest=s.rpc.rest,s}return s(e,t),o(e,[{key:"getGuild",value:function(t,e){var n=this;return new Promise(function(r,i){n.rpc.request("GET_GUILD",{guild_id:t,timeout:e},function(t,e){t&&i(t),r(e)})})}},{key:"getGuilds",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_GUILDS",{},function(t,r){t&&n(t),e(r.guilds)})})}},{key:"getChannel",value:function(t,e){var n=this;return new Promise(function(r,i){n.rpc.request("GET_CHANNEL",{channel_id:t,timeout:e},function(t,e){t&&i(t),r(e)})})}},{key:"getChannels",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_CHANNELS",{},function(t,r){t&&n(t),e(r.channels)})})}},{key:"setUserVoiceSettings",value:function(t){var e=this;return new Promise(function(n,r){e.rpc.request("SET_USER_VOICE_SETTINGS",t,function(t,e){t&&r(t),n(e)})})}},{key:"selectVoiceChannel",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(function(i,s){n.rpc.request("SELECT_VOICE_CHANNEL",{channel_id:t,timeout:e,force:r},function(t,e){t&&s(t),i(e)})})}},{key:"selectTextChannel",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(function(i,s){n.rpc.request("SELECT_TEXT_CHANNEL",{channel_id:t,timeout:e,force:r},function(t,e){t&&s(t),i(e)})})}},{key:"getVoiceSettings",value:function(){var t=this;return new Promise(function(e,n){t.rpc.request("GET_VOICE_SETTINGS",{},function(t,r){t&&n(t),e(r)})})}},{key:"setVoiceSettings",value:function(t){var e=this;return new Promise(function(n,r){e.rpc.request("SET_VOICE_SETTINGS",t,function(t,e){t&&r(t),n(e)})})}},{key:"subscribe",value:function(t,e,n){return this.rpc.subscribe(t,e,n)}},{key:"unsubscribe",value:function(t,e,n){return this.rpc.unsubscribe(t,e,n)}},{key:"connect",value:function(t){return this.rpc.connect(t)}}]),e}(a);t.exports=c},function(t,e){t.exports={name:"discord-rpc",version:"2.0.1",description:"A simple RPC client for Discord somewhat stolen from the Discord StreamKit.",main:"src/index.js",repository:{type:"git",url:"git+https://github.com/GusCaplan/discord-rpc.git"},scripts:{"web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},author:"Gus Caplan ",license:"MIT",bugs:{url:"https://github.com/GusCaplan/discord-rpc/issues"},homepage:"https://github.com/GusCaplan/discord-rpc#readme",dependencies:{"deep-equal":"^1.0.1",superagent:"^3.0.0",uuid:"^3.0.0",ws:"^1.1.1"},devDependencies:{"babel-core":"^6.18.2","babel-loader":"^6.2.8","babel-preset-es2015":"^6.18.0",bufferutil:"^1.2.1","ignore-loader":"^0.1.2","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27"},browser:{ws:!1}}},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i0&&"number"!=typeof t[0]))}function s(t,e,n){var s,h;if(r(t)||r(e))return!1;if(t.prototype!==e.prototype)return!1;if(a(t))return!!a(e)&&(t=o.call(t),e=o.call(e),c(t,e,n));if(i(t)){if(!i(e))return!1;if(t.length!==e.length)return!1;for(s=0;s=0;s--)if(l[s]!=p[s])return!1;for(s=l.length-1;s>=0;s--)if(h=l[s],!c(t[h],e[h],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,u=n(11),a=n(10),c=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:s(t,e,n))}},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=i?n:r,e.supported=n,e.unsupported=r},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var s=n(5);t.exports=r,r.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},r.prototype.parse=function(t){return this._parser=t,this},r.prototype.serialize=function(t){return this._serializer=t,this},r.prototype.timeout=function(t){return this._timeout=t,this},r.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype.use=function(t){return t(this),this},r.prototype.get=function(t){return this._header[t.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(t,e){if(s(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(s(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(){return this._withCredentials=!0,this},r.prototype.redirects=function(t){return this._maxRedirects=t,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(t){var e=s(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&s(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){(function(e){var n,r=e.crypto||e.msCrypto;if(r&&r.getRandomValues){var i=new Uint8Array(16);n=function(){return r.getRandomValues(i),i}}if(!n){var s=new Array(16);n=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}t.exports=n}).call(e,n(16))},function(t,e,n){function r(t,e){var n=e||0,r=u;return r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]}function i(t,e,n){var i=e&&n||0,s=e||[];t=t||{};var o=void 0!==t.clockseq?t.clockseq:p,u=void 0!==t.msecs?t.msecs:(new Date).getTime(),a=void 0!==t.nsecs?t.nsecs:d+1,c=u-f+(a-d)/1e4;if(c<0&&void 0===t.clockseq&&(o=o+1&16383),(c<0||u>f)&&void 0===t.nsecs&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); +f=u,d=a,p=o,u+=122192928e5;var h=(1e4*(268435455&u)+a)%4294967296;s[i++]=h>>>24&255,s[i++]=h>>>16&255,s[i++]=h>>>8&255,s[i++]=255&h;var v=u/4294967296*1e4&268435455;s[i++]=v>>>8&255,s[i++]=255&v,s[i++]=v>>>24&15|16,s[i++]=v>>>16&255,s[i++]=o>>>8|128,s[i++]=255&o;for(var y=t.node||l,_=0;_<6;++_)s[i+_]=y[_];return e?e:r(s)}function s(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var u=0;u<16;++u)e[i+u]=s[u];return e||r(s)}for(var o=n(14),u=[],a={},c=0;c<256;++c)u[c]=(c+256).toString(16).substr(1),a[u[c]]=c;var h=o(),l=[1|h[0],h[1],h[2],h[3],h[4],h[5]],p=16383&(h[6]<<8|h[7]),f=0,d=0,v=s;v.v1=i,v.v4=s,t.exports=v},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){"use strict";t.exports={version:n(7).version,Client:n(6),RPC:n(2),Rest:n(1),Constants:n(0)},"undefined"!=typeof window&&(window.DiscordRPC=t.exports)}]); \ No newline at end of file