cloudstorm 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +40 -60
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as discord_typings from 'discord-typings';
|
|
2
1
|
import * as snowtransfer from 'snowtransfer';
|
|
2
|
+
import APITypes from 'discord-api-types/v10';
|
|
3
3
|
import * as events from 'events';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ type IntentResolvable = number | Array<number> | keyof IntentFlags | Array<keyof
|
|
|
8
8
|
declare const flags: {
|
|
9
9
|
GUILDS: number;
|
|
10
10
|
GUILD_MEMBERS: number;
|
|
11
|
-
|
|
11
|
+
GUILD_MODERATION: number;
|
|
12
12
|
GUILD_EMOJIS_AND_STICKERS: number;
|
|
13
13
|
GUILD_INTEGRATIONS: number;
|
|
14
14
|
GUILD_WEBHOOKS: number;
|
|
@@ -23,13 +23,15 @@ declare const flags: {
|
|
|
23
23
|
DIRECT_MESSAGE_TYPING: number;
|
|
24
24
|
MESSAGE_CONTENT: number;
|
|
25
25
|
GUILD_SCHEDULED_EVENTS: number;
|
|
26
|
+
AUTO_MODERATION_CONFIGURATION: number;
|
|
27
|
+
AUTO_MODERATION_EXECUTION: number;
|
|
26
28
|
};
|
|
27
29
|
declare function resolve(bit?: IntentResolvable): number;
|
|
28
30
|
declare const _default: {
|
|
29
31
|
flags: {
|
|
30
32
|
GUILDS: number;
|
|
31
33
|
GUILD_MEMBERS: number;
|
|
32
|
-
|
|
34
|
+
GUILD_MODERATION: number;
|
|
33
35
|
GUILD_EMOJIS_AND_STICKERS: number;
|
|
34
36
|
GUILD_INTEGRATIONS: number;
|
|
35
37
|
GUILD_WEBHOOKS: number;
|
|
@@ -44,6 +46,8 @@ declare const _default: {
|
|
|
44
46
|
DIRECT_MESSAGE_TYPING: number;
|
|
45
47
|
MESSAGE_CONTENT: number;
|
|
46
48
|
GUILD_SCHEDULED_EVENTS: number;
|
|
49
|
+
AUTO_MODERATION_CONFIGURATION: number;
|
|
50
|
+
AUTO_MODERATION_EXECUTION: number;
|
|
47
51
|
};
|
|
48
52
|
privileged: number;
|
|
49
53
|
all: number;
|
|
@@ -51,15 +55,12 @@ declare const _default: {
|
|
|
51
55
|
resolve: typeof resolve;
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
op: discord_typings.GatewayOpcode;
|
|
56
|
-
d?: any;
|
|
57
|
-
s?: number;
|
|
58
|
-
t?: discord_typings.GatewayEvent;
|
|
59
|
-
}
|
|
60
|
-
interface IGatewayMessage extends IWSMessage {
|
|
58
|
+
type IGatewayMessage = APITypes.GatewayReceivePayload & {
|
|
61
59
|
shard_id: number;
|
|
62
|
-
}
|
|
60
|
+
};
|
|
61
|
+
type IGatewayDispatch = APITypes.GatewayDispatchPayload & {
|
|
62
|
+
shard_id: number;
|
|
63
|
+
};
|
|
63
64
|
interface IClientOptions {
|
|
64
65
|
largeGuildThreshold?: number;
|
|
65
66
|
/**
|
|
@@ -74,7 +75,7 @@ interface IClientOptions {
|
|
|
74
75
|
*/
|
|
75
76
|
totalShards?: number;
|
|
76
77
|
reconnect?: boolean;
|
|
77
|
-
initialPresence?:
|
|
78
|
+
initialPresence?: APITypes.GatewayPresenceUpdateData;
|
|
78
79
|
intents?: IntentResolvable;
|
|
79
80
|
snowtransferInstance?: snowtransfer.SnowTransfer;
|
|
80
81
|
ws?: IClientWSOptions;
|
|
@@ -128,8 +129,8 @@ declare class RatelimitBucket {
|
|
|
128
129
|
interface BWSEvents {
|
|
129
130
|
ws_open: [];
|
|
130
131
|
ws_close: [number, string];
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
ws_receive: [APITypes.GatewayReceivePayload];
|
|
133
|
+
ws_send: [APITypes.GatewaySendPayload];
|
|
133
134
|
debug: [string];
|
|
134
135
|
}
|
|
135
136
|
interface BetterWs {
|
|
@@ -164,7 +165,7 @@ declare class BetterWs extends EventEmitter {
|
|
|
164
165
|
get status(): 1 | 2 | 3 | 4;
|
|
165
166
|
connect(): Promise<void>;
|
|
166
167
|
close(code: number, reason?: string): Promise<void>;
|
|
167
|
-
sendMessage(data:
|
|
168
|
+
sendMessage(data: APITypes.GatewaySendPayload): Promise<void>;
|
|
168
169
|
private _write;
|
|
169
170
|
private _onError;
|
|
170
171
|
private _onClose;
|
|
@@ -174,7 +175,6 @@ declare class BetterWs extends EventEmitter {
|
|
|
174
175
|
|
|
175
176
|
interface ConnectorEvents {
|
|
176
177
|
queueIdentify: [number];
|
|
177
|
-
event: [IWSMessage];
|
|
178
178
|
ready: [boolean];
|
|
179
179
|
disconnect: [number, string, boolean];
|
|
180
180
|
stateChange: ["connecting" | "identifying" | "resuming" | "ready" | "disconnected"];
|
|
@@ -287,12 +287,12 @@ declare class DiscordConnector extends EventEmitter {
|
|
|
287
287
|
* Send an OP 3 PRESENCE_UPDATE to the gateway.
|
|
288
288
|
* @param data Presence data to send.
|
|
289
289
|
*/
|
|
290
|
-
presenceUpdate(data:
|
|
290
|
+
presenceUpdate(data: Partial<APITypes.GatewayPresenceUpdateData>): Promise<void>;
|
|
291
291
|
/**
|
|
292
292
|
* Send an OP 4 VOICE_STATE_UPDATE to the gateway.
|
|
293
293
|
* @param data Voice state update data to send.
|
|
294
294
|
*/
|
|
295
|
-
voiceStateUpdate(data:
|
|
295
|
+
voiceStateUpdate(data: APITypes.GatewayVoiceStateUpdateData & {
|
|
296
296
|
self_deaf?: boolean;
|
|
297
297
|
self_mute?: boolean;
|
|
298
298
|
}): Promise<void>;
|
|
@@ -300,7 +300,7 @@ declare class DiscordConnector extends EventEmitter {
|
|
|
300
300
|
* Send an OP 8 REQUEST_GUILD_MEMBERS to the gateway.
|
|
301
301
|
* @param data Data to send.
|
|
302
302
|
*/
|
|
303
|
-
requestGuildMembers(data:
|
|
303
|
+
requestGuildMembers(data: APITypes.GatewayRequestGuildMembersData & {
|
|
304
304
|
limit?: number;
|
|
305
305
|
}): Promise<void>;
|
|
306
306
|
/**
|
|
@@ -380,22 +380,17 @@ declare class Shard extends EventEmitter {
|
|
|
380
380
|
* Send an OP 3 PRESENCE_UPDATE to Discord.
|
|
381
381
|
* @param data Data to send.
|
|
382
382
|
*/
|
|
383
|
-
presenceUpdate(data:
|
|
383
|
+
presenceUpdate(data: Parameters<Shard["connector"]["presenceUpdate"]>["0"]): Promise<void>;
|
|
384
384
|
/**
|
|
385
385
|
* Send an OP 4 VOICE_STATE_UPDATE to Discord.
|
|
386
386
|
* @param data Data to send
|
|
387
387
|
*/
|
|
388
|
-
voiceStateUpdate(data:
|
|
389
|
-
self_deaf?: boolean;
|
|
390
|
-
self_mute?: boolean;
|
|
391
|
-
}): Promise<void>;
|
|
388
|
+
voiceStateUpdate(data: Parameters<Shard["connector"]["voiceStateUpdate"]>["0"]): Promise<void>;
|
|
392
389
|
/**
|
|
393
390
|
* Send an OP 8 REQUEST_GUILD_MEMBERS to Discord.
|
|
394
391
|
* @param data Data to send.
|
|
395
392
|
*/
|
|
396
|
-
requestGuildMembers(data:
|
|
397
|
-
limit?: number;
|
|
398
|
-
}): Promise<void>;
|
|
393
|
+
requestGuildMembers(data: Parameters<Shard["connector"]["requestGuildMembers"]>["0"]): Promise<void>;
|
|
399
394
|
}
|
|
400
395
|
|
|
401
396
|
/**
|
|
@@ -445,44 +440,38 @@ declare class ShardManager {
|
|
|
445
440
|
* Update the status of all currently connected shards which have been spawned by this manager.
|
|
446
441
|
* @param data Data to send.
|
|
447
442
|
*/
|
|
448
|
-
presenceUpdate(data:
|
|
443
|
+
presenceUpdate(data: Parameters<Shard["presenceUpdate"]>["0"]): Promise<void>;
|
|
449
444
|
/**
|
|
450
445
|
* Update the status of a single connected shard which has been spawned by this manager.
|
|
451
446
|
* @param shardId id of the shard.
|
|
452
447
|
* @param data Data to send.
|
|
453
448
|
*/
|
|
454
|
-
shardPresenceUpdate(shardId: number, data:
|
|
449
|
+
shardPresenceUpdate(shardId: number, data: Parameters<Shard["presenceUpdate"]>["0"]): Promise<void>;
|
|
455
450
|
/**
|
|
456
451
|
* Send an OP 4 VOICE_STATE_UPDATE with a certain shard.
|
|
457
452
|
* @param shardId id of the shard.
|
|
458
453
|
* @param data Data to send.
|
|
459
454
|
*/
|
|
460
|
-
voiceStateUpdate(shardId: number, data:
|
|
461
|
-
self_deaf?: boolean;
|
|
462
|
-
self_mute?: boolean;
|
|
463
|
-
}): Promise<void>;
|
|
455
|
+
voiceStateUpdate(shardId: number, data: Parameters<Shard["voiceStateUpdate"]>["0"]): Promise<void>;
|
|
464
456
|
/**
|
|
465
457
|
* Send an OP 8 REQUEST_GUILD_MEMBERS with a certain shard.
|
|
466
458
|
* @param shardId id of the shard.
|
|
467
459
|
* @param data Data to send.
|
|
468
460
|
*/
|
|
469
|
-
requestGuildMembers(shardId: number, data:
|
|
470
|
-
limit?: number;
|
|
471
|
-
}): Promise<void>;
|
|
461
|
+
requestGuildMembers(shardId: number, data: Parameters<Shard["requestGuildMembers"]>["0"]): Promise<void>;
|
|
472
462
|
}
|
|
473
463
|
|
|
474
464
|
interface ClientEvents {
|
|
475
465
|
debug: [string];
|
|
476
|
-
rawSend: [
|
|
477
|
-
rawReceive: [
|
|
466
|
+
rawSend: [APITypes.GatewaySendPayload];
|
|
467
|
+
rawReceive: [APITypes.GatewayReceivePayload];
|
|
468
|
+
error: [string];
|
|
478
469
|
event: [IGatewayMessage];
|
|
479
|
-
dispatch: [
|
|
480
|
-
voiceStateUpdate: [IGatewayMessage];
|
|
470
|
+
dispatch: [IGatewayDispatch];
|
|
481
471
|
shardReady: [{
|
|
482
472
|
id: number;
|
|
483
473
|
ready: boolean;
|
|
484
474
|
}];
|
|
485
|
-
error: [string];
|
|
486
475
|
ready: [];
|
|
487
476
|
disconnected: [];
|
|
488
477
|
}
|
|
@@ -539,11 +528,7 @@ declare class Client extends EventEmitter {
|
|
|
539
528
|
* Get the GatewayData including recommended amount of shards and other helpful info.
|
|
540
529
|
* @returns Object with url and shards to use to connect to discord.
|
|
541
530
|
*/
|
|
542
|
-
getGatewayBot(): Promise<
|
|
543
|
-
url: string;
|
|
544
|
-
shards: number;
|
|
545
|
-
session_start_limit: discord_typings.SessionStartLimit;
|
|
546
|
-
}>;
|
|
531
|
+
getGatewayBot(): Promise<APITypes.RESTGetAPIGatewayBotResult>;
|
|
547
532
|
/**
|
|
548
533
|
* Disconnect the bot gracefully,
|
|
549
534
|
* you will receive a 'disconnected' event once the ShardManager successfully closes all shard websocket connections.
|
|
@@ -554,17 +539,17 @@ declare class Client extends EventEmitter {
|
|
|
554
539
|
* @returns Promise that's resolved once all shards have sent the websocket payload.
|
|
555
540
|
*
|
|
556
541
|
* @example
|
|
557
|
-
* // Connect to Discord and set status to do not disturb and
|
|
542
|
+
* // Connect to Discord and set status to do not disturb and activity to "Memes are Dreams".
|
|
558
543
|
* const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
|
|
559
544
|
* const token = "token";
|
|
560
545
|
* const client = new CloudStorm.Client(token);
|
|
561
546
|
* client.connect();
|
|
562
547
|
* client.once("ready", () => {
|
|
563
548
|
* // Client is connected to Discord and is ready, so we can update the status.
|
|
564
|
-
* client.presenceUpdate({ status: "dnd",
|
|
549
|
+
* client.presenceUpdate({ status: "dnd", activities: [{ name: "Memes are Dreams", type: 0 }] });
|
|
565
550
|
* });
|
|
566
551
|
*/
|
|
567
|
-
presenceUpdate(data:
|
|
552
|
+
presenceUpdate(data: Parameters<Client["shardManager"]["presenceUpdate"]>["0"]): Promise<void>;
|
|
568
553
|
/**
|
|
569
554
|
* Send an OP 3 PRESENCE_UPDATE to Discord, which updates the status of a single shard facilitated by this client's ShardManager.
|
|
570
555
|
* @param shardId id of the shard that should update it's status.
|
|
@@ -572,17 +557,17 @@ declare class Client extends EventEmitter {
|
|
|
572
557
|
* @returns Promise that's resolved once the shard has sent the websocket payload.
|
|
573
558
|
*
|
|
574
559
|
* @example
|
|
575
|
-
* // Connect to Discord and set status to do not disturb and
|
|
560
|
+
* // Connect to Discord and set status to do not disturb and activity to "Im shard 0".
|
|
576
561
|
* const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
|
|
577
562
|
* const token = "token";
|
|
578
563
|
* const client = new CloudStorm.Client(token);
|
|
579
564
|
* client.connect();
|
|
580
565
|
* client.once("ready", () => {
|
|
581
566
|
* // Client is connected to Discord and is ready, so we can update the status of shard 0.
|
|
582
|
-
* client.shardPresenceUpdate(0, { status: "dnd",
|
|
567
|
+
* client.shardPresenceUpdate(0, { status: "dnd", activities: [{ name: "Im shard 0", type: 0 }] });
|
|
583
568
|
* });
|
|
584
569
|
*/
|
|
585
|
-
shardStatusUpdate(shardId: number, data:
|
|
570
|
+
shardStatusUpdate(shardId: number, data: Parameters<Client["shardManager"]["shardPresenceUpdate"]>["1"]): Promise<void>;
|
|
586
571
|
/**
|
|
587
572
|
* Send an OP 4 VOICE_STATE_UPDATE to Discord. this does **not** allow you to send audio with CloudStorm itself,
|
|
588
573
|
* it just provides the necessary data for another application to send audio data to Discord.
|
|
@@ -602,10 +587,7 @@ declare class Client extends EventEmitter {
|
|
|
602
587
|
* client.voiceStateUpdate(0, { guild_id: "id", channel_id: "id", self_mute: false, self_deaf: false });
|
|
603
588
|
* });
|
|
604
589
|
*/
|
|
605
|
-
voiceStateUpdate(shardId: number, data:
|
|
606
|
-
self_deaf?: boolean;
|
|
607
|
-
self_mute?: boolean;
|
|
608
|
-
}): Promise<void>;
|
|
590
|
+
voiceStateUpdate(shardId: number, data: Parameters<Client["shardManager"]["voiceStateUpdate"]>["1"]): Promise<void>;
|
|
609
591
|
/**
|
|
610
592
|
* Send an OP 8 REQUEST_GUILD_MEMBERS to Discord.
|
|
611
593
|
* @param shardId id of the shard that should send the payload.
|
|
@@ -624,9 +606,7 @@ declare class Client extends EventEmitter {
|
|
|
624
606
|
* client.requestGuildMembers(0, { guild_id: "id" });
|
|
625
607
|
* });
|
|
626
608
|
*/
|
|
627
|
-
requestGuildMembers(shardId: number, data:
|
|
628
|
-
limit?: number;
|
|
629
|
-
}): Promise<void>;
|
|
609
|
+
requestGuildMembers(shardId: number, data: Parameters<Client["shardManager"]["requestGuildMembers"]>["1"]): Promise<void>;
|
|
630
610
|
/**
|
|
631
611
|
* Update the endpoint shard websockets will connect to.
|
|
632
612
|
* @param gatewayUrl Base gateway wss url to update the cached endpoint to.
|
|
@@ -684,4 +664,4 @@ declare const Constants: {
|
|
|
684
664
|
GATEWAY_VERSION: 10;
|
|
685
665
|
};
|
|
686
666
|
|
|
687
|
-
export { Client, Constants, IClientOptions, IClientWSOptions,
|
|
667
|
+
export { Client, Constants, IClientOptions, IClientWSOptions, IGatewayDispatch, IGatewayMessage, _default as Intents, Shard, ShardManager };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ce=Object.create;var E=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var pe=(o,i)=>()=>(o&&(i=o(o=0)),i);var p=(o,i)=>()=>(i||o((i={exports:{}}).exports,i),i.exports),L=(o,i)=>{for(var e in i)E(o,e,{get:i[e],enumerable:!0})},O=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of le(i))!ue.call(o,n)&&n!==e&&E(o,n,{get:()=>i[n],enumerable:!(t=de(i,n))||t.enumerable});return o};var S=(o,i,e)=>(e=o!=null?ce(he(o)):{},O(i||!o||!o.__esModule?E(e,"default",{value:o,enumerable:!0}):e,o)),_=o=>O(E({},"__esModule",{value:!0}),o);var N=p((Le,fe)=>{fe.exports={name:"cloudstorm",version:"0.6.2",description:"Minimalistic Discord Gateway library",main:"./dist/index.js",engines:{node:">=12.0.0"},types:"./dist/index.d.ts",scripts:{"build:src":"tsup src/index.ts --dts --sourcemap --format cjs --target node12 --minify","build:docs":"typedoc --name CloudStorm --excludeExternals --sort static-first --sort alphabetical"},author:"wolke <wolke@weeb.sh>",license:"MIT",dependencies:{"discord-typings":"^10.4.1",snowtransfer:"0.6.1"},devDependencies:{"@types/node":"18.11.18","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",eslint:"^8.33.0",tsup:"^6.5.0",typedoc:"^0.23.24","typedoc-plugin-mdn-links":"^2.0.2",typescript:"^4.9.5"},files:["dist","README.md","LICENSE.md"]}});var m=p((Oe,$)=>{"use strict";var me={GATEWAY_OP_CODES:{DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,PRESENCE_UPDATE:3,VOICE_STATE_UPDATE:4,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},GATEWAY_VERSION:10};$.exports=me});var b=p((Ne,H)=>{"use strict";var w=class{constructor(i=5,e=5e3,t){this.fnQueue=[],this.limit=i,this.remaining=i,this.limitReset=e,this.resetTimeout=null,this.defaultReset=t}queue(i){let e=new Error("An Error occurred in the bucket queue");return new Promise((t,n)=>{let r=()=>(this.remaining--,this.resetTimeout||(this.resetTimeout=setTimeout(()=>{try{this.resetRemaining()}catch(s){n(s)}},this.limitReset).unref()),this.remaining!==0&&this.checkQueue().catch(n),i instanceof Promise?i.then(t).catch(s=>s?(s.stack=e.stack,n(s)):n(e)):t(i()));this.remaining===0?(this.fnQueue.push({fn:i,callback:r,error:e}),this.checkQueue().catch(n)):r()})}async checkQueue(){if(this.fnQueue.length>0&&this.remaining!==0){let i=this.fnQueue.splice(0,1)[0];try{i.callback()}catch(e){throw e?(e.stack=i.error.stack,e):i.error}}}resetRemaining(){this.remaining=this.limit,this.defaultReset&&(this.limitReset=this.defaultReset),this.resetTimeout&&(clearTimeout(this.resetTimeout),this.resetTimeout=null),this.checkQueue()}dropQueue(){this.fnQueue=[]}};H.exports=w});var J=p(($e,K)=>{"use strict";var F=require("events"),v=require("crypto"),y=require("zlib"),z=S(m()),ye=require("https"),Ee=require("http"),be=require("util"),V=b(),k=class extends F.EventEmitter{constructor(e,t){super();this.wsBucket=new V(120,6e4);this.presenceBucket=new V(5,6e4);this._connecting=!1;this.encoding=t.encoding==="etf"?"etf":"json",this.compress=t.compress||!1,this.address=e,this.options=t,this._socket=null,this._internal={closePromise:null,zlib:null}}get status(){let e=this._internal;return this._connecting?2:e.closePromise?3:this._socket?1:4}connect(){if(this._socket)return Promise.resolve(void 0);let e=(0,v.randomBytes)(16).toString("base64"),t=new URL(this.address),n=t.protocol==="https:"||t.protocol==="wss:"||t.port==="443",r=t.port||(n?"443":"80"),s=(n?ye:Ee).request({hostname:t.hostname,path:`${t.pathname}${t.search}`,port:r,headers:{Connection:"Upgrade",Upgrade:"websocket","Sec-WebSocket-Key":e,"Sec-WebSocket-Version":"13"}});return this._connecting=!0,new Promise((c,a)=>{s.on("upgrade",(d,l)=>{let x=(0,v.createHash)("sha1").update(e+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64"),q=d.headers["sec-websocket-accept"];if(x!==q){l.end(()=>{this.emit("debug","Failed websocket-key validation"),this._connecting=!1,a(new Error(`Invalid Sec-Websocket-Accept | expected: ${x} | received: ${q}`))});return}if(l.on("error",this._onError.bind(this)),l.on("close",this._onClose.bind(this)),l.on("readable",this._onReadable.bind(this)),this._socket=l,this._connecting=!1,this.compress){let u=(0,y.createInflate)();u._c=u.close,u._h=u._handle,u._hc=u._handle.close,u._v=()=>{},this._internal.zlib=u}this.emit("ws_open"),c(void 0)}),s.on("error",d=>{this._connecting=!1,a(d)}),s.end()})}async close(e,t){let n=this._internal;if(n.closePromise)return n.closePromise;if(!this._socket)return Promise.resolve(void 0);let r,s=new Promise(c=>{r=c;let a=Buffer.from([e>>8,e&255]);this._write(t?Buffer.concat([a,Buffer.from(t)]):a,8)}).then(()=>{n.closePromise=null});return s.resolve=r,n.closePromise=s,s}sendMessage(e){return ve(e)?new Promise(t=>{let n=e.op===z.GATEWAY_OP_CODES.PRESENCE_UPDATE,r=()=>{this.wsBucket.queue(()=>{if(this.emit("debug_send",e),this.encoding==="json")this._write(Buffer.from(JSON.stringify(e)),1);else{let s=ge(e);this._write(s,2)}t(void 0)})};n?this.presenceBucket.queue(r):r()}):Promise.reject(new Error("Invalid request"))}_write(e,t){let n=this._socket;if(!n||!n.writable)return;let r=e.length,s;r<126?(s=Buffer.allocUnsafe(6+r),s[1]=128+r):r<1<<16?(s=Buffer.allocUnsafe(8+r),s[1]=254,s[2]=r>>8,s[3]=r&255):(s=Buffer.allocUnsafe(14+r),s[1]=255,s.writeBigUInt64BE(BigInt(r),2)),s[0]=128+t,s.writeUInt32BE(0,s.length-r-4),s.set(e,s.length-r),n.write(s)}_onError(e){!this._socket||(this.emit("debug",be.inspect(e,!0,1,!1)),this._write(Buffer.allocUnsafe(0),8))}_onClose(){let e=this._socket,t=this._internal;!e||(e.removeListener("data",this._onReadable),e.removeListener("error",this._onError),e.removeListener("close",this._onClose),this.wsBucket.dropQueue(),this.presenceBucket.dropQueue(),this._socket=null,t.zlib&&(t.zlib.close(),t.zlib=null),t.closePromise&&t.closePromise.resolve(void 0))}_onReadable(){let e=this._socket;for(;((e==null?void 0:e.readableLength)||0)>1;){let t=Q(e,1,1)&127,n=0;if(t>125){if(n=t===126?2:8,e.readableLength<2+n)return;t=Q(e,2,n)}let r=e.read(2+n+t);if(!r)return;let s=r[0]>>7,c=r[0]&15;(s!==1||c===0)&&this.emit("debug","discord actually does send messages with fin=0. if you see this error let me know");let a=r.subarray(2+n);this._processFrame(c,a)}}_processFrame(e,t){let n=this._internal;switch(e){case 1:{let r=JSON.parse(t.toString());this.emit("ws_message",r);break}case 2:{let r;if(this.compress){let s=n.zlib,c=null,a=null;s.close=s._handle.close=s._v;try{a=s._processChunk(t,y.constants.Z_SYNC_FLUSH)}catch(l){c=l}let d=t.length;if((t[d-4]!==0||t[d-3]!==0||t[d-2]!==255||t[d-1]!==255)&&this.emit("debug","discord actually does send fragmented zlib messages. If you see this error let me know"),s.close=s._c,s._handle=s._h,s._handle.close=s._hc,s._events.error=void 0,s._eventCount--,s.removeAllListeners("error"),c){this.emit("debug","Zlib error"),this._write(Buffer.allocUnsafe(0),8);return}if(!a){this.emit("debug","Data from zlib processing was null. If you see this error let me know");return}r=this.encoding==="json"?JSON.parse(String(a)):Y(a,1)}else if(this.encoding==="json"){let s=(0,y.inflateSync)(t);r=JSON.parse(s.toString())}else r=Y(t,1);this.emit("ws_message",r);break}case 8:{let r=t.length>1?(t[0]<<8)+t[1]:0,s=t.length>2?t.subarray(2).toString():"";this.emit("ws_close",r,s),this._write(Buffer.from([r>>8,r&255]),8);break}case 9:{this._write(t,10);break}}}};function ve(o){return o&&typeof o=="object"&&Number.isInteger(o.op)&&typeof o.d<"u"}function Q(o,i,e){let t=o._readableState.buffer.head,n=0,r=0,s=0;do for(let c of t.data)if(++n>i&&(s*=256,s+=c,++r===e))return s;while(t=t.next);throw new Error("readRange failed?")}function Y(o,i){let e,t=i,n=()=>{let r=o[t++];switch(r){case 97:return o[t++];case 98:{let s=o.readInt32BE(t);return t+=4,s}case 100:{let s=o.readUInt16BE(t),c="";if(s>30)c=o.latin1Slice(t+=2,t+s);else for(let a=t+=2;a<t+s;a++)c+=String.fromCharCode(o[a]);return t+=s,c?c==="nil"||c==="null"?null:c==="true"?!0:c==="false"?!1:c:void 0}case 108:case 106:{let s=[];if(r===108){let c=o.readUInt32BE(t);t+=4;for(let a=0;a<c;a++)s.push(n());t++}return s}case 107:{let s=[],c=o.readUInt16BE(t);t+=2;for(let a=0;a<c;a++)s.push(o[t++]);return s}case 109:{let s=o.readUInt32BE(t),c="";if(s>30)c=o.utf8Slice(t+=4,t+s);else{let a=t+=4,d=t+s;for(;a<d;){let l=o[a++];l<128?c+=String.fromCharCode(l):l<224?c+=String.fromCharCode(((l&31)<<6)+(o[a++]&63)):l<240?c+=String.fromCharCode(((l&15)<<12)+((o[a++]&63)<<6)+(o[a++]&63)):c+=String.fromCodePoint(((l&7)<<18)+((o[a++]&63)<<12)+((o[a++]&63)<<6)+(o[a++]&63))}}return t+=s,c}case 110:{e||(e=new DataView(o.buffer,o.offset,o.byteLength));let s=o[t++],c=o[t++],a=s,d=BigInt(0);for(;a>0;)a>=8?(d<<=BigInt(64),d+=e.getBigUint64(t+(a-=8),!0)):a>=4?(d<<=BigInt(32),d+=BigInt(e.getUint32(t+(a-=4)),!0)):a>=2?(d<<=BigInt(16),d+=BigInt(e.getUint16(t+(a-=2)),!0)):(d<<=BigInt(8),d+=BigInt(o[t]),a--);return t+=s,(c?-d:d).toString()}case 116:{let s={},c=o.readUInt32BE(t);t+=4;for(let a=0;a<c;a++){let d=n();s[d]=n()}return s}}throw new Error(`Missing etf type: ${r}`)};return n()}function ge(o){let i=Buffer.allocUnsafe(4096);i[0]=131;let e=1,t=n=>{switch(typeof n){case"boolean":{i[e++]=100,n?(i.writeUInt16BE(4,e),i.latin1Write("true",e+=2),e+=4):(i.writeUInt16BE(5,e),i.latin1Write("false",e+=2),e+=5);break}case"string":{let s=Buffer.byteLength(n);i[e++]=109,i.writeUInt32BE(s,e),i.utf8Write(n,e+=4),e+=s;break}case"number":{if(Number.isInteger(n)){let s=Math.abs(n);if(s<2147483648)i[e++]=98,i.writeInt32BE(n,e),e+=4;else if(s<Number.MAX_SAFE_INTEGER){i[e++]=110,i[e++]=8,i[e++]=Number(n<0),i.writeBigUInt64LE(BigInt(s),e),e+=8;break}else i[e++]=70,i.writeDoubleBE(n,e),e+=8}else i[e++]=70,i.writeDoubleBE(n,e),e+=8;break}case"bigint":{i[e++]=110,i[e++]=8,i[e++]=Number(n<0),i.writeBigUInt64LE(n,e),e+=8;break}case"object":{if(n===null)i[e++]=100,i.writeUInt16BE(3,e),i.latin1Write("nil",e+=2),e+=3;else if(Array.isArray(n)){if(n.length){i[e++]=108,i.writeUInt32BE(n.length,e),e+=4;for(let s of n)t(s)}i[e++]=106}else{let s=Object.entries(n).filter(c=>typeof c[1]<"u");i[e++]=116,i.writeUInt32BE(s.length,e),e+=4;for(let[c,a]of s)t(c),t(a)}break}}};return t(o),Buffer.from(i.subarray(0,e))}K.exports=k});var B={};L(B,{all:()=>A,default:()=>Se,flags:()=>f,non_privileged:()=>Z,privileged:()=>I,resolve:()=>C});function C(o=0){if(typeof o=="number"&&o>=0)return o;if(typeof o=="string"&&f[o])return f[o]|0;if(Array.isArray(o))return o.map(i=>C(i)).reduce((i,e)=>i|e,0);throw new RangeError("BITFIELD_INVALID")}var f,I,A,Z,Se,T=pe(()=>{"use strict";f={GUILDS:1,GUILD_MEMBERS:2,GUILD_BANS:4,GUILD_EMOJIS_AND_STICKERS:8,GUILD_INTEGRATIONS:16,GUILD_WEBHOOKS:32,GUILD_INVITES:64,GUILD_VOICE_STATES:128,GUILD_PRESENCES:256,GUILD_MESSAGES:512,GUILD_MESSAGE_REACTIONS:1024,GUILD_MESSAGE_TYPING:2048,DIRECT_MESSAGES:4096,DIRECT_MESSAGE_REACTIONS:8192,DIRECT_MESSAGE_TYPING:16384,MESSAGE_CONTENT:32768,GUILD_SCHEDULED_EVENTS:0},I=f.GUILD_MEMBERS|f.GUILD_PRESENCES|f.MESSAGE_CONTENT,A=Object.values(f).reduce((o,i)=>o|i,0),Z=A&~I;Se={flags:f,privileged:I,all:A,non_privileged:Z,resolve:C}});var ee=p((He,j)=>{"use strict";var X=require("events"),h=S(m()),_e=J(),we=(T(),_(B)),ke=/EAI_AGAIN/,P=class extends X.EventEmitter{constructor(e,t){super();this.heartbeatTimeout=null;this.heartbeatInterval=0;this._trace=null;this.seq=0;this.status="disconnected";this.sessionId=null;this.lastACKAt=0;this.lastHeartbeatSend=0;this.latency=0;this._closing=!1;this.resumeAddress=null;this.reconnecting=!1;this.id=e,this.client=t,this.options=t.options,this.reconnect=this.options.reconnect||!0,this.identifyAddress=this.options.endpoint,this.betterWs=new _e(this.identifyAddress,this.options.ws),this.betterWs.on("ws_open",()=>{this.status="connecting",this.emit("stateChange","connecting"),this.reconnecting=!1}),this.betterWs.on("ws_message",n=>this.messageAction(n)),this.betterWs.on("ws_close",(n,r)=>this.handleWsClose(n,r)),this.betterWs.on("debug",n=>this.client.emit("debug",n)),this.betterWs.on("debug_send",n=>this.client.emit("rawSend",n))}async connect(){return this._closing=!1,this.client.emit("debug",`Shard ${this.id} connecting to gateway`),this.betterWs.connect().catch(e=>{let t=String(e);ke.test(t)&&setTimeout(()=>this.connect(),5e3)})}async disconnect(){return this._closing=!0,this.betterWs.close(1e3,"Disconnected by User")}async messageAction(e){switch(this.client.emit("rawReceive",e),e.op){case h.GATEWAY_OP_CODES.DISPATCH:this.handleDispatch(e);break;case h.GATEWAY_OP_CODES.HEARTBEAT:this.heartbeat();break;case h.GATEWAY_OP_CODES.RECONNECT:this.client.emit("debug",`Gateway asked shard ${this.id} to reconnect`),this.options.reconnect&&this.betterWs.status!==2?this._reconnect(!0):this.disconnect();break;case h.GATEWAY_OP_CODES.INVALID_SESSION:this.client.emit("debug",`Shard ${this.id}'s session was invalidated`),e.d&&this.sessionId?this.resume():(this.seq=0,this.sessionId="",this.emit("queueIdentify",this.id));break;case h.GATEWAY_OP_CODES.HELLO:this.client.emit("debug",`Shard ${this.id} received HELLO`),this.heartbeat(),this.heartbeatInterval=e.d.heartbeat_interval,this.heartbeatTimeout=setInterval(()=>{this.lastACKAt<=Date.now()-(this.heartbeatInterval+5e3)?(this.client.emit("debug",`Shard ${this.id} has not received a heartbeat ACK in ${this.heartbeatInterval+5e3}ms.`),this.options.reconnect&&this.betterWs.status!==2?this._reconnect(!0):this.disconnect()):this.heartbeat()},this.heartbeatInterval),this._trace=e.d._trace,this.emit("queueIdentify",this.id);break;case h.GATEWAY_OP_CODES.HEARTBEAT_ACK:this.lastACKAt=Date.now(),this.latency=this.lastACKAt-this.lastHeartbeatSend;break;default:this.emit("event",e)}}async _reconnect(e=!1){if(e&&(this.reconnecting=!0),this.betterWs.status===2)return void this.client.emit("error",`Client was attempting to ${e?"resume":"reconnect"} while the WebSocket was still in the connecting state. This should never happen.`);await this.betterWs.close(e?4e3:1012,"reconnecting"),e?(this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress):(this.reset(),this.betterWs.address=this.identifyAddress),this.connect()}reset(){this.sessionId=null,this.seq=0,this.lastACKAt=0,this._trace=null,this.clearHeartBeat()}clearHeartBeat(){this.heartbeatTimeout&&clearInterval(this.heartbeatTimeout),this.heartbeatTimeout=null,this.heartbeatInterval=0}async identify(e){if(this.betterWs.status!==1&&this.client.emit("debug","Client was attempting to identify when the ws was not open"),this.sessionId&&!e)return this.resume();this.client.emit("debug",`Shard ${this.id} is identifying`),this.status="identifying",this.emit("stateChange","identifying");let t={op:h.GATEWAY_OP_CODES.IDENTIFY,d:{token:this.options.token,properties:{os:process.platform,browser:"CloudStorm",device:"CloudStorm"},large_threshold:this.options.largeGuildThreshold,shard:[this.id,this.options.totalShards||1],intents:this.options.intents?we.resolve(this.options.intents):0}};return this.options.initialPresence&&Object.assign(t.d,{presence:this._checkPresenceData(this.options.initialPresence)}),this.betterWs.sendMessage(t)}async resume(){return this.betterWs.status!==1?void this.client.emit("debug","Client was attempting to resume when the ws was not open"):(this.client.emit("debug",`Shard ${this.id} is resuming`),this.status="resuming",this.emit("stateChange","resuming"),this.betterWs.sendMessage({op:h.GATEWAY_OP_CODES.RESUME,d:{seq:this.seq,token:this.options.token,session_id:this.sessionId}}))}heartbeat(){this.betterWs.status===1&&(this.betterWs.sendMessage({op:h.GATEWAY_OP_CODES.HEARTBEAT,d:this.seq}),this.lastHeartbeatSend=Date.now())}handleDispatch(e){var t,n;switch(e.s&&(e.s>this.seq+1&&(this.client.emit("debug",`Shard ${this.id}, invalid sequence: current: ${this.seq} message: ${e.s}`),this.seq=e.s,this.resume()),this.seq=e.s),e.t){case"READY":case"RESUMED":e.t==="READY"&&(e.d.resume_gateway_url&&(this.resumeAddress=`${e.d.resume_gateway_url}?v=${h.GATEWAY_VERSION}&encoding=${((t=this.options.ws)==null?void 0:t.encoding)==="etf"?"etf":"json"}${(n=this.options.ws)!=null&&n.compress?"&compress=zlib-stream":""}`),this.sessionId=e.d.session_id),this.status="ready",this.emit("stateChange","ready"),this._trace=e.d._trace,this.emit("ready",e.t==="RESUMED"),this.emit("event",e);break;default:this.emit("event",e)}}handleWsClose(e,t){let n=!1;this.status="disconnected",this.emit("stateChange","disconnected"),e===4014&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Disallowed Intents, check your client options and application page.")),e===4013&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid Intents data, check your client options.")),e===4012&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid API version.")),e===4011&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Shard would be on over 2500 guilds. Add more shards.")),e===4010&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid sharding data, check your client options.")),e===4009&&(this.client.emit("error","Session timed out."),this.clearHeartBeat(),this.betterWs.address=this.identifyAddress,this.connect()),e===4008&&(this.client.emit("error","You are being rate limited. Wait before sending more packets."),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),e===4007&&(this.client.emit("error","Invalid sequence. Reconnecting and starting a new session."),this.reset(),this.betterWs.address=this.identifyAddress,this.connect()),e===4005&&(this.client.emit("error","You sent more than one OP 2 IDENTIFY payload while the websocket was open."),this.clearHeartBeat(),this.resumeAddress&&(this.betterWs.address=this.resumeAddress),this.connect()),e===4004&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Tried to connect with an invalid token")),e===4003&&(this.client.emit("error","You tried to send a packet before sending an OP 2 IDENTIFY or OP 6 RESUME."),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),e===4002&&(this.client.emit("error","You sent an invalid payload"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),e===4001&&(this.client.emit("error","You sent an invalid opcode or invalid payload for an opcode"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),e===4e3&&(this.reconnecting?n=!0:(this.client.emit("error","Error code 4000 received. Attempting to resume"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect())),e===1e3&&this._closing&&(n=!0),this._closing=!1,n&&this.clearHeartBeat(),this.emit("disconnect",e,t,n)}async presenceUpdate(e){return this.betterWs.sendMessage({op:h.GATEWAY_OP_CODES.PRESENCE_UPDATE,d:this._checkPresenceData(e)})}async voiceStateUpdate(e){return e?this.betterWs.sendMessage({op:h.GATEWAY_OP_CODES.VOICE_STATE_UPDATE,d:this._checkVoiceStateUpdateData(e)}):Promise.resolve()}async requestGuildMembers(e){return this.betterWs.sendMessage({op:h.GATEWAY_OP_CODES.REQUEST_GUILD_MEMBERS,d:this._checkRequestGuildMembersData(e)})}_checkPresenceData(e){if(e.status=e.status||"online",e.activities=e.activities&&Array.isArray(e.activities)?e.activities:[],e.activities)for(let t of e.activities){let n=e.activities.indexOf(t);t.type===void 0&&(t.type=t.url?1:0),t.name||e.activities.splice(n,1)}return e.afk=e.afk||!1,e.since=e.since||Date.now(),e}_checkVoiceStateUpdateData(e){return e.channel_id=e.channel_id||null,e.self_mute=e.self_mute||!1,e.self_deaf=e.self_deaf||!1,e}_checkRequestGuildMembersData(e){return e.query=e.query||"",e.limit=e.limit||0,e}},g=P;g.default=P;j.exports=g});var M=p((Ve,se)=>{"use strict";var te=require("events"),U=S(m()),Ie=ee(),W=class extends te.EventEmitter{constructor(e,t){super();this.id=e,this.client=t,this.ready=!1,this.connector=new Ie(e,t),this.connector.on("event",n=>{let r=Object.assign(n,{shard_id:this.id});switch(this.client.emit("event",r),n.op){case U.GATEWAY_OP_CODES.DISPATCH:this.client.emit("dispatch",r);break;case U.GATEWAY_OP_CODES.VOICE_STATE_UPDATE:this.client.emit("voiceStateUpdate",r);break;default:break}}),this.connector.on("disconnect",(...n)=>{this.ready=!1,this.emit("disconnect",...n)}),this.connector.on("ready",n=>this.emit("ready",n)),this.connector.on("queueIdentify",()=>this.emit("queueIdentify",this.id))}get latency(){return this.connector.latency}connect(){this.connector.connect()}disconnect(){return this.connector.disconnect()}presenceUpdate(e){return this.connector.presenceUpdate(e)}voiceStateUpdate(e){return this.connector.voiceStateUpdate(e)}requestGuildMembers(e){return this.connector.requestGuildMembers(e)}};se.exports=W});var R=p((Qe,ie)=>{"use strict";var Ae=M(),Ce=b(),D=class{constructor(i){this.concurrencyBucket=null;this.client=i,this.options=i.options,this.shards={},this.identifyBucket=new Ce(1e3,1e3*60*60*24,1e3*60*60*24)}spawn(){if(!this.concurrencyBucket)throw new Error("Trying to spawn shards without calling Client.connect()");for(let i of this.options.shards==="auto"?Array(this.options.totalShards).fill(0).map((e,t)=>t):this.options.shards||[0])this.client.emit("debug",`Spawned shard ${i}`),this.shards[i]=new Ae(i,this.client),this._addListener(this.shards[i]),this.shards[i].connector.connect()}disconnect(){for(let i in this.shards)this.shards[i].disconnect()}_addListener(i){i.on("ready",e=>{i.ready=!0,this.client.emit("debug",`Shard ${i.id} ${e?"has resumed":"is ready"}`),this.client.emit("shardReady",{id:i.id,ready:!e}),this._checkReady()}),i.on("queueIdentify",e=>{var t;if(!this.shards[e])return this.client.emit("debug",`Received a queueIdentify event for shard ${e} but it does not exist. Was it removed?`);if(this.client.emit("debug",`Shard ${e} is ready to identify`),i.connector.reconnecting)return i.connector.resume();(t=this.concurrencyBucket)==null||t.queue(()=>{this.identifyBucket.queue(()=>this.shards[e].connector.identify())})}),i.on("disconnect",(e,t,n)=>{if(this.client.emit("debug",`Websocket of shard ${i.id} closed with code ${e} and reason: ${t||"None"}`),e===1e3&&n)return this._checkDisconnect()})}_checkReady(){for(let i in this.shards)if(this.shards[i]&&!this.shards[i].ready)return;this.client.emit("ready")}_checkDisconnect(){for(let i in this.shards)if(this.shards[i]&&this.shards[i].connector.status!=="disconnected")return;this.client.emit("disconnected")}async presenceUpdate(i){for(let e in this.shards)if(this.shards[e]){let t=this.shards[e];this.shardPresenceUpdate(t.id,i)}}shardPresenceUpdate(i,e){return new Promise((t,n)=>{let r=this.shards[i];r||n(new Error(`Shard ${i} does not exist`)),r.ready||r.once("ready",()=>r.presenceUpdate(e).then(s=>t(s)).catch(s=>n(s))),r.presenceUpdate(e).then(s=>t(s)).catch(s=>n(s))})}voiceStateUpdate(i,e){return new Promise((t,n)=>{let r=this.shards[i];r||n(new Error(`Shard ${i} does not exist`)),r.ready||r.once("ready",()=>r.voiceStateUpdate(e).then(s=>t(s)).catch(s=>n(s))),r.voiceStateUpdate(e).then(s=>t(s)).catch(s=>n(s))})}requestGuildMembers(i,e){return new Promise((t,n)=>{let r=this.shards[i];r||n(new Error(`Shard ${i} does not exist`)),r.ready||r.once("ready",()=>r.requestGuildMembers(e).then(s=>t(s)).catch(s=>n(s))),r.requestGuildMembers(e).then(s=>t(s)).catch(s=>n(s))})}};ie.exports=D});var ae=p((Ye,oe)=>{"use strict";var ne=require("events"),re=require("snowtransfer"),Be=N().version,Te=m(),Pe=R(),Ue=b(),G=class extends ne.EventEmitter{constructor(e,t={}){super();if(!e)throw new Error("Missing token!");this.options={largeGuildThreshold:250,shards:"auto",reconnect:!0,intents:0,token:"",ws:{compress:!0,encoding:"json"}},this._restClient=t.snowtransferInstance?t.snowtransferInstance:new re.SnowTransfer(e),delete t.snowtransferInstance,this.token=e.startsWith("Bot ")?e.substring(4):e,Object.assign(this.options,t),this.options.token=e,this.shardManager=new Pe(this),this.version=Be}async connect(){let e=await this.fetchConnectInfo();this.options.shards==="auto"&&(this.options.totalShards=e),this.shardManager.spawn()}async fetchConnectInfo(){let e=await this.getGatewayBot();this._updateEndpoint(e.url);let t=[],n=[];this.shardManager.concurrencyBucket&&this.shardManager.concurrencyBucket.fnQueue.length&&(t.push(...this.shardManager.concurrencyBucket.fnQueue.map(r=>[r.fn,r.callback])),this.shardManager.concurrencyBucket.dropQueue()),this.shardManager.identifyBucket.fnQueue.length&&n.push(...this.shardManager.identifyBucket.fnQueue.map(r=>[r.fn,r.callback])),this.shardManager.identifyBucket.dropQueue(),this.shardManager.concurrencyBucket=new Ue(e.session_start_limit.max_concurrency,5e3),this.shardManager.identifyBucket.remaining=e.session_start_limit.remaining,this.shardManager.identifyBucket.limitReset=e.session_start_limit.reset_after;for(let[r,s]of t)this.shardManager.concurrencyBucket.queue(r).then(s);for(let[r,s]of n)this.shardManager.identifyBucket.queue(r).then(s);return e.shards}async getGateway(){return(await this._restClient.bot.getGateway()).url}async getGatewayBot(){return this._restClient.bot.getGatewayBot()}disconnect(){return this.shardManager.disconnect()}async presenceUpdate(e){return this.shardManager.presenceUpdate(e)}shardStatusUpdate(e,t){return this.shardManager.shardPresenceUpdate(e,t)}voiceStateUpdate(e,t){return this.shardManager.voiceStateUpdate(e,t)}requestGuildMembers(e,t){if(!t.guild_id)throw new Error("You need to pass a guild_id");return this.shardManager.requestGuildMembers(e,t)}_updateEndpoint(e){var t,n;this.options.endpoint=`${e}?v=${Te.GATEWAY_VERSION}&encoding=${((t=this.options.ws)==null?void 0:t.encoding)==="etf"?"etf":"json"}${(n=this.options.ws)!=null&&n.compress?"&compress=zlib-stream":""}`}};oe.exports=G});var xe={};L(xe,{Client:()=>We,Constants:()=>Me,Intents:()=>De,Shard:()=>Re,ShardManager:()=>Ge});module.exports=_(xe);var We=ae(),Me=m(),De=(T(),_(B)),Re=M(),Ge=R();0&&(module.exports={Client,Constants,Intents,Shard,ShardManager});
|
|
1
|
+
var Zn=Object.create;var J=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Sn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty;var ei=(e,n)=>()=>(e&&(n=e(e=0)),n);var a=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Pe=(e,n)=>{for(var t in n)J(e,t,{get:n[t],enumerable:!0})},ye=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of En(n))!Jn.call(e,s)&&s!==t&&J(e,s,{get:()=>n[s],enumerable:!(i=Nn(n,s))||i.enumerable});return e};var ke=(e,n,t)=>(t=e!=null?Zn(Sn(e)):{},ye(n||!e||!e.__esModule?J(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>ye(J({},"__esModule",{value:!0}),e);var Ue=a((cr,ti)=>{ti.exports={name:"cloudstorm",version:"0.7.0",description:"Minimalistic Discord Gateway library",main:"./dist/index.js",engines:{node:">=12.0.0"},types:"./dist/index.d.ts",scripts:{"build:src":"tsup src/index.ts --dts --sourcemap --format cjs --target node12 --minify","build:docs":"typedoc --name CloudStorm --excludeExternals --sort static-first --sort alphabetical"},author:"wolke <wolke@weeb.sh>",license:"MIT",dependencies:{snowtransfer:"0.7.0"},devDependencies:{"@types/node":"18.11.19","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",eslint:"^8.33.0",tsup:"^6.5.0",typedoc:"^0.23.24","typedoc-plugin-mdn-links":"^2.0.2",typescript:"^4.9.5"},files:["dist","README.md","LICENSE.md"]}});var F=a((lr,De)=>{"use strict";var ni={GATEWAY_OP_CODES:{DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,PRESENCE_UPDATE:3,VOICE_STATE_UPDATE:4,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},GATEWAY_VERSION:10};De.exports=ni});var ee=a((dr,Be)=>{"use strict";var se=class{constructor(n=5,t=5e3,i){this.fnQueue=[],this.limit=n,this.remaining=n,this.limitReset=t,this.resetTimeout=null,this.defaultReset=i}queue(n){let t=new Error("An Error occurred in the bucket queue");return new Promise((i,s)=>{let o=()=>(this.remaining--,this.resetTimeout||(this.resetTimeout=setTimeout(()=>{try{this.resetRemaining()}catch(r){s(r)}},this.limitReset).unref()),this.remaining!==0&&this.checkQueue().catch(s),n instanceof Promise?n.then(i).catch(r=>r?(r.stack=t.stack,s(r)):s(t)):i(n()));this.remaining===0?(this.fnQueue.push({fn:n,callback:o,error:t}),this.checkQueue().catch(s)):o()})}async checkQueue(){if(this.fnQueue.length>0&&this.remaining!==0){let n=this.fnQueue.splice(0,1)[0];try{n.callback()}catch(t){throw t?(t.stack=n.error.stack,t):n.error}}}resetRemaining(){this.remaining=this.limit,this.defaultReset&&(this.limitReset=this.defaultReset),this.resetTimeout&&(clearTimeout(this.resetTimeout),this.resetTimeout=null),this.checkQueue()}dropQueue(){this.fnQueue=[]}};Be.exports=se});var je=a((hr,xe)=>{"use strict";var Ge=require("events"),te=require("crypto"),z=require("zlib"),We=ke(F()),ii=require("https"),si=require("http"),ri=require("util"),we=ee(),re=class extends Ge.EventEmitter{constructor(t,i){super();this.wsBucket=new we(120,6e4);this.presenceBucket=new we(5,6e4);this._connecting=!1;this.encoding=i.encoding==="etf"?"etf":"json",this.compress=i.compress||!1,this.address=t,this.options=i,this._socket=null,this._internal={closePromise:null,zlib:null}}get status(){let t=this._internal;return this._connecting?2:t.closePromise?3:this._socket?1:4}connect(){if(this._socket)return Promise.resolve(void 0);let t=(0,te.randomBytes)(16).toString("base64"),i=new URL(this.address),s=i.protocol==="https:"||i.protocol==="wss:"||i.port==="443",o=i.port||(s?"443":"80"),r=(s?ii:si).request({hostname:i.hostname,path:`${i.pathname}${i.search}`,port:o,headers:{Connection:"Upgrade",Upgrade:"websocket","Sec-WebSocket-Key":t,"Sec-WebSocket-Version":"13"}});return this._connecting=!0,new Promise((h,l)=>{r.on("upgrade",(p,I)=>{let Me=(0,te.createHash)("sha1").update(t+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64"),Ae=p.headers["sec-websocket-accept"];if(Me!==Ae){I.end(()=>{this.emit("debug","Failed websocket-key validation"),this._connecting=!1,l(new Error(`Invalid Sec-Websocket-Accept | expected: ${Me} | received: ${Ae}`))});return}if(I.on("error",this._onError.bind(this)),I.on("close",this._onClose.bind(this)),I.on("readable",this._onReadable.bind(this)),this._socket=I,this._connecting=!1,this.compress){let q=(0,z.createInflate)();q._c=q.close,q._h=q._handle,q._hc=q._handle.close,q._v=()=>{},this._internal.zlib=q}this.emit("ws_open"),h(void 0)}),r.on("error",p=>{this._connecting=!1,l(p)}),r.end()})}async close(t,i){let s=this._internal;if(s.closePromise)return s.closePromise;if(!this._socket)return Promise.resolve(void 0);let o,r=new Promise(h=>{o=h;let l=Buffer.from([t>>8,t&255]);this._write(i?Buffer.concat([l,Buffer.from(i)]):l,8)}).then(()=>{s.closePromise=null});return r.resolve=o,s.closePromise=r,r}sendMessage(t){return ai(t)?new Promise(i=>{let s=t.op===We.GATEWAY_OP_CODES.PRESENCE_UPDATE,o=()=>{this.wsBucket.queue(()=>{if(this.emit("ws_send",t),this.encoding==="json")this._write(Buffer.from(JSON.stringify(t)),1);else{let r=oi(t);this._write(r,2)}i(void 0)})};s?this.presenceBucket.queue(o):o()}):Promise.reject(new Error("Invalid request"))}_write(t,i){let s=this._socket;if(!s||!s.writable)return;let o=t.length,r;o<126?(r=Buffer.allocUnsafe(6+o),r[1]=128+o):o<1<<16?(r=Buffer.allocUnsafe(8+o),r[1]=254,r[2]=o>>8,r[3]=o&255):(r=Buffer.allocUnsafe(14+o),r[1]=255,r.writeBigUInt64BE(BigInt(o),2)),r[0]=128+i,r.writeUInt32BE(0,r.length-o-4),r.set(t,r.length-o),s.write(r)}_onError(t){!this._socket||(this.emit("debug",ri.inspect(t,!0,1,!1)),this._write(Buffer.allocUnsafe(0),8))}_onClose(){let t=this._socket,i=this._internal;!t||(t.removeListener("data",this._onReadable),t.removeListener("error",this._onError),t.removeListener("close",this._onClose),this.wsBucket.dropQueue(),this.presenceBucket.dropQueue(),this._socket=null,i.zlib&&(i.zlib.close(),i.zlib=null),i.closePromise&&i.closePromise.resolve(void 0))}_onReadable(){let t=this._socket;for(;((t==null?void 0:t.readableLength)||0)>1;){let i=$e(t,1,1)&127,s=0;if(i>125){if(s=i===126?2:8,t.readableLength<2+s)return;i=$e(t,2,s)}let o=t.read(2+s+i);if(!o)return;let r=o[0]>>7,h=o[0]&15;(r!==1||h===0)&&this.emit("debug","discord actually does send messages with fin=0. if you see this error let me know");let l=o.subarray(2+s);this._processFrame(h,l)}}_processFrame(t,i){let s=this._internal;switch(t){case 1:{let o=JSON.parse(i.toString());this.emit("ws_receive",o);break}case 2:{let o;if(this.compress){let r=s.zlib,h=null,l=null;r.close=r._handle.close=r._v;try{l=r._processChunk(i,z.constants.Z_SYNC_FLUSH)}catch(I){h=I}let p=i.length;if((i[p-4]!==0||i[p-3]!==0||i[p-2]!==255||i[p-1]!==255)&&this.emit("debug","discord actually does send fragmented zlib messages. If you see this error let me know"),r.close=r._c,r._handle=r._h,r._handle.close=r._hc,r._events.error=void 0,r._eventCount--,r.removeAllListeners("error"),h){this.emit("debug","Zlib error processing chunk"),this._write(Buffer.allocUnsafe(0),8);return}if(!l){this.emit("debug","Data from zlib processing was null. If you see this error let me know");return}o=this.encoding==="json"?JSON.parse(String(l)):qe(l,1)}else if(this.encoding==="json"){let r=(0,z.inflateSync)(i);o=JSON.parse(r.toString())}else o=qe(i,1);this.emit("ws_receive",o);break}case 8:{let o=i.length>1?(i[0]<<8)+i[1]:0,r=i.length>2?i.subarray(2).toString():"";this.emit("ws_close",o,r),this._write(Buffer.from([o>>8,o&255]),8);break}case 9:{this._write(i,10);break}}}};function ai(e){return e&&typeof e=="object"&&Number.isInteger(e.op)&&typeof e.d<"u"}function $e(e,n,t){let i=e._readableState.buffer.head,s=0,o=0,r=0;do for(let h of i.data)if(++s>n&&(r*=256,r+=h,++o===t))return r;while(i=i.next);throw new Error("readRange failed?")}function qe(e,n){let t,i=n,s=()=>{let o=e[i++];switch(o){case 97:return e[i++];case 98:{let r=e.readInt32BE(i);return i+=4,r}case 100:{let r=e.readUInt16BE(i),h="";if(r>30)h=e.latin1Slice(i+=2,i+r);else for(let l=i+=2;l<i+r;l++)h+=String.fromCharCode(e[l]);return i+=r,h?h==="nil"||h==="null"?null:h==="true"?!0:h==="false"?!1:h:void 0}case 108:case 106:{let r=[];if(o===108){let h=e.readUInt32BE(i);i+=4;for(let l=0;l<h;l++)r.push(s());i++}return r}case 107:{let r=[],h=e.readUInt16BE(i);i+=2;for(let l=0;l<h;l++)r.push(e[i++]);return r}case 109:{let r=e.readUInt32BE(i),h="";if(r>30)h=e.utf8Slice(i+=4,i+r);else{let l=i+=4,p=i+r;for(;l<p;){let I=e[l++];I<128?h+=String.fromCharCode(I):I<224?h+=String.fromCharCode(((I&31)<<6)+(e[l++]&63)):I<240?h+=String.fromCharCode(((I&15)<<12)+((e[l++]&63)<<6)+(e[l++]&63)):h+=String.fromCodePoint(((I&7)<<18)+((e[l++]&63)<<12)+((e[l++]&63)<<6)+(e[l++]&63))}}return i+=r,h}case 110:{t||(t=new DataView(e.buffer,e.offset,e.byteLength));let r=e[i++],h=e[i++],l=r,p=BigInt(0);for(;l>0;)l>=8?(p<<=BigInt(64),p+=t.getBigUint64(i+(l-=8),!0)):l>=4?(p<<=BigInt(32),p+=BigInt(t.getUint32(i+(l-=4)),!0)):l>=2?(p<<=BigInt(16),p+=BigInt(t.getUint16(i+(l-=2)),!0)):(p<<=BigInt(8),p+=BigInt(e[i]),l--);return i+=r,(h?-p:p).toString()}case 116:{let r={},h=e.readUInt32BE(i);i+=4;for(let l=0;l<h;l++){let p=s();r[p]=s()}return r}}throw new Error(`Missing etf type: ${o}`)};return s()}function oi(e){let n=Buffer.allocUnsafe(4096);n[0]=131;let t=1,i=s=>{switch(typeof s){case"boolean":{n[t++]=100,s?(n.writeUInt16BE(4,t),n.latin1Write("true",t+=2),t+=4):(n.writeUInt16BE(5,t),n.latin1Write("false",t+=2),t+=5);break}case"string":{let r=Buffer.byteLength(s);n[t++]=109,n.writeUInt32BE(r,t),n.utf8Write(s,t+=4),t+=r;break}case"number":{if(Number.isInteger(s)){let r=Math.abs(s);if(r<2147483648)n[t++]=98,n.writeInt32BE(s,t),t+=4;else if(r<Number.MAX_SAFE_INTEGER){n[t++]=110,n[t++]=8,n[t++]=Number(s<0),n.writeBigUInt64LE(BigInt(r),t),t+=8;break}else n[t++]=70,n.writeDoubleBE(s,t),t+=8}else n[t++]=70,n.writeDoubleBE(s,t),t+=8;break}case"bigint":{n[t++]=110,n[t++]=8,n[t++]=Number(s<0),n.writeBigUInt64LE(s,t),t+=8;break}case"object":{if(s===null)n[t++]=100,n.writeUInt16BE(3,t),n.latin1Write("nil",t+=2),t+=3;else if(Array.isArray(s)){if(s.length){n[t++]=108,n.writeUInt32BE(s.length,t),t+=4;for(let r of s)i(r)}n[t++]=106}else{let r=Object.entries(s).filter(h=>typeof h[1]<"u");n[t++]=116,n.writeUInt32BE(r.length,t),t+=4;for(let[h,l]of r)i(h),i(l)}break}}};return i(e),Buffer.from(n.subarray(0,t))}xe.exports=re});var ce={};Pe(ce,{all:()=>oe,default:()=>ui,flags:()=>G,non_privileged:()=>He,privileged:()=>ae,resolve:()=>ue});function ue(e=0){if(typeof e=="number"&&e>=0)return e;if(typeof e=="string"&&G[e])return G[e]|0;if(Array.isArray(e))return e.map(n=>ue(n)).reduce((n,t)=>n|t,0);throw new RangeError("BITFIELD_INVALID")}var G,ae,oe,He,ui,le=ei(()=>{"use strict";G={GUILDS:1,GUILD_MEMBERS:2,GUILD_MODERATION:4,GUILD_EMOJIS_AND_STICKERS:8,GUILD_INTEGRATIONS:16,GUILD_WEBHOOKS:32,GUILD_INVITES:64,GUILD_VOICE_STATES:128,GUILD_PRESENCES:256,GUILD_MESSAGES:512,GUILD_MESSAGE_REACTIONS:1024,GUILD_MESSAGE_TYPING:2048,DIRECT_MESSAGES:4096,DIRECT_MESSAGE_REACTIONS:8192,DIRECT_MESSAGE_TYPING:16384,MESSAGE_CONTENT:32768,GUILD_SCHEDULED_EVENTS:65536,AUTO_MODERATION_CONFIGURATION:1048576,AUTO_MODERATION_EXECUTION:2097152},ae=G.GUILD_MEMBERS|G.GUILD_PRESENCES|G.MESSAGE_CONTENT,oe=Object.values(G).reduce((e,n)=>e|n,0),He=oe&~ae;ui={flags:G,privileged:ae,all:oe,non_privileged:He,resolve:ue}});var Ve=a(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0})});var Te=a(b=>{"use strict";var ci=b&&b.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),li=b&&b.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&ci(n,e,t)};Object.defineProperty(b,"__esModule",{value:!0});b.GatewayDispatchEvents=b.GatewayIntentBits=b.GatewayCloseCodes=b.GatewayOpcodes=b.GatewayVersion=void 0;li(Ve(),b);b.GatewayVersion="10";var di;(function(e){e[e.Dispatch=0]="Dispatch",e[e.Heartbeat=1]="Heartbeat",e[e.Identify=2]="Identify",e[e.PresenceUpdate=3]="PresenceUpdate",e[e.VoiceStateUpdate=4]="VoiceStateUpdate",e[e.Resume=6]="Resume",e[e.Reconnect=7]="Reconnect",e[e.RequestGuildMembers=8]="RequestGuildMembers",e[e.InvalidSession=9]="InvalidSession",e[e.Hello=10]="Hello",e[e.HeartbeatAck=11]="HeartbeatAck"})(di=b.GatewayOpcodes||(b.GatewayOpcodes={}));var hi;(function(e){e[e.UnknownError=4e3]="UnknownError",e[e.UnknownOpcode=4001]="UnknownOpcode",e[e.DecodeError=4002]="DecodeError",e[e.NotAuthenticated=4003]="NotAuthenticated",e[e.AuthenticationFailed=4004]="AuthenticationFailed",e[e.AlreadyAuthenticated=4005]="AlreadyAuthenticated",e[e.InvalidSeq=4007]="InvalidSeq",e[e.RateLimited=4008]="RateLimited",e[e.SessionTimedOut=4009]="SessionTimedOut",e[e.InvalidShard=4010]="InvalidShard",e[e.ShardingRequired=4011]="ShardingRequired",e[e.InvalidAPIVersion=4012]="InvalidAPIVersion",e[e.InvalidIntents=4013]="InvalidIntents",e[e.DisallowedIntents=4014]="DisallowedIntents"})(hi=b.GatewayCloseCodes||(b.GatewayCloseCodes={}));var mi;(function(e){e[e.Guilds=1]="Guilds",e[e.GuildMembers=2]="GuildMembers",e[e.GuildModeration=4]="GuildModeration",e[e.GuildBans=4]="GuildBans",e[e.GuildEmojisAndStickers=8]="GuildEmojisAndStickers",e[e.GuildIntegrations=16]="GuildIntegrations",e[e.GuildWebhooks=32]="GuildWebhooks",e[e.GuildInvites=64]="GuildInvites",e[e.GuildVoiceStates=128]="GuildVoiceStates",e[e.GuildPresences=256]="GuildPresences",e[e.GuildMessages=512]="GuildMessages",e[e.GuildMessageReactions=1024]="GuildMessageReactions",e[e.GuildMessageTyping=2048]="GuildMessageTyping",e[e.DirectMessages=4096]="DirectMessages",e[e.DirectMessageReactions=8192]="DirectMessageReactions",e[e.DirectMessageTyping=16384]="DirectMessageTyping",e[e.MessageContent=32768]="MessageContent",e[e.GuildScheduledEvents=65536]="GuildScheduledEvents",e[e.AutoModerationConfiguration=1048576]="AutoModerationConfiguration",e[e.AutoModerationExecution=2097152]="AutoModerationExecution"})(mi=b.GatewayIntentBits||(b.GatewayIntentBits={}));var fi;(function(e){e.ApplicationCommandPermissionsUpdate="APPLICATION_COMMAND_PERMISSIONS_UPDATE",e.ChannelCreate="CHANNEL_CREATE",e.ChannelDelete="CHANNEL_DELETE",e.ChannelPinsUpdate="CHANNEL_PINS_UPDATE",e.ChannelUpdate="CHANNEL_UPDATE",e.GuildBanAdd="GUILD_BAN_ADD",e.GuildBanRemove="GUILD_BAN_REMOVE",e.GuildCreate="GUILD_CREATE",e.GuildDelete="GUILD_DELETE",e.GuildEmojisUpdate="GUILD_EMOJIS_UPDATE",e.GuildIntegrationsUpdate="GUILD_INTEGRATIONS_UPDATE",e.GuildMemberAdd="GUILD_MEMBER_ADD",e.GuildMemberRemove="GUILD_MEMBER_REMOVE",e.GuildMembersChunk="GUILD_MEMBERS_CHUNK",e.GuildMemberUpdate="GUILD_MEMBER_UPDATE",e.GuildRoleCreate="GUILD_ROLE_CREATE",e.GuildRoleDelete="GUILD_ROLE_DELETE",e.GuildRoleUpdate="GUILD_ROLE_UPDATE",e.GuildStickersUpdate="GUILD_STICKERS_UPDATE",e.GuildUpdate="GUILD_UPDATE",e.IntegrationCreate="INTEGRATION_CREATE",e.IntegrationDelete="INTEGRATION_DELETE",e.IntegrationUpdate="INTEGRATION_UPDATE",e.InteractionCreate="INTERACTION_CREATE",e.InviteCreate="INVITE_CREATE",e.InviteDelete="INVITE_DELETE",e.MessageCreate="MESSAGE_CREATE",e.MessageDelete="MESSAGE_DELETE",e.MessageDeleteBulk="MESSAGE_DELETE_BULK",e.MessageReactionAdd="MESSAGE_REACTION_ADD",e.MessageReactionRemove="MESSAGE_REACTION_REMOVE",e.MessageReactionRemoveAll="MESSAGE_REACTION_REMOVE_ALL",e.MessageReactionRemoveEmoji="MESSAGE_REACTION_REMOVE_EMOJI",e.MessageUpdate="MESSAGE_UPDATE",e.PresenceUpdate="PRESENCE_UPDATE",e.StageInstanceCreate="STAGE_INSTANCE_CREATE",e.StageInstanceDelete="STAGE_INSTANCE_DELETE",e.StageInstanceUpdate="STAGE_INSTANCE_UPDATE",e.Ready="READY",e.Resumed="RESUMED",e.ThreadCreate="THREAD_CREATE",e.ThreadDelete="THREAD_DELETE",e.ThreadListSync="THREAD_LIST_SYNC",e.ThreadMembersUpdate="THREAD_MEMBERS_UPDATE",e.ThreadMemberUpdate="THREAD_MEMBER_UPDATE",e.ThreadUpdate="THREAD_UPDATE",e.TypingStart="TYPING_START",e.UserUpdate="USER_UPDATE",e.VoiceServerUpdate="VOICE_SERVER_UPDATE",e.VoiceStateUpdate="VOICE_STATE_UPDATE",e.WebhooksUpdate="WEBHOOKS_UPDATE",e.GuildScheduledEventCreate="GUILD_SCHEDULED_EVENT_CREATE",e.GuildScheduledEventUpdate="GUILD_SCHEDULED_EVENT_UPDATE",e.GuildScheduledEventDelete="GUILD_SCHEDULED_EVENT_DELETE",e.GuildScheduledEventUserAdd="GUILD_SCHEDULED_EVENT_USER_ADD",e.GuildScheduledEventUserRemove="GUILD_SCHEDULED_EVENT_USER_REMOVE",e.AutoModerationRuleCreate="AUTO_MODERATION_RULE_CREATE",e.AutoModerationRuleUpdate="AUTO_MODERATION_RULE_UPDATE",e.AutoModerationRuleDelete="AUTO_MODERATION_RULE_DELETE",e.AutoModerationActionExecution="AUTO_MODERATION_ACTION_EXECUTION",e.GuildAuditLogEntryCreate="GUILD_AUDIT_LOG_ENTRY_CREATE"})(fi=b.GatewayDispatchEvents||(b.GatewayDispatchEvents={}))});var Re=a(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.FormattingPatterns=void 0;O.FormattingPatterns={User:/<@(?<id>\d{17,20})>/,UserWithNickname:/<@!(?<id>\d{17,20})>/,UserWithOptionalNickname:/<@!?(?<id>\d{17,20})>/,Channel:/<#(?<id>\d{17,20})>/,Role:/<@&(?<id>\d{17,20})>/,SlashCommand:/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,Emoji:/<(?<animated>a)?:(?<name>\w{2,32}):(?<id>\d{17,20})>/,AnimatedEmoji:/<(?<animated>a):(?<name>\w{2,32}):(?<id>\d{17,20})>/,StaticEmoji:/<:(?<name>\w{2,32}):(?<id>\d{17,20})>/,Timestamp:/<t:(?<timestamp>-?\d{1,13})(:(?<style>[tTdDfFR]))?>/,DefaultStyledTimestamp:/<t:(?<timestamp>-?\d{1,13})>/,StyledTimestamp:/<t:(?<timestamp>-?\d{1,13}):(?<style>[tTdDfFR])>/};Object.freeze(O.FormattingPatterns)});var Ye=a(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.PermissionFlagsBits=void 0;C.PermissionFlagsBits={CreateInstantInvite:1n<<0n,KickMembers:1n<<1n,BanMembers:1n<<2n,Administrator:1n<<3n,ManageChannels:1n<<4n,ManageGuild:1n<<5n,AddReactions:1n<<6n,ViewAuditLog:1n<<7n,PrioritySpeaker:1n<<8n,Stream:1n<<9n,ViewChannel:1n<<10n,SendMessages:1n<<11n,SendTTSMessages:1n<<12n,ManageMessages:1n<<13n,EmbedLinks:1n<<14n,AttachFiles:1n<<15n,ReadMessageHistory:1n<<16n,MentionEveryone:1n<<17n,UseExternalEmojis:1n<<18n,ViewGuildInsights:1n<<19n,Connect:1n<<20n,Speak:1n<<21n,MuteMembers:1n<<22n,DeafenMembers:1n<<23n,MoveMembers:1n<<24n,UseVAD:1n<<25n,ChangeNickname:1n<<26n,ManageNicknames:1n<<27n,ManageRoles:1n<<28n,ManageWebhooks:1n<<29n,ManageEmojisAndStickers:1n<<30n,UseApplicationCommands:1n<<31n,RequestToSpeak:1n<<32n,ManageEvents:1n<<33n,ManageThreads:1n<<34n,CreatePublicThreads:1n<<35n,CreatePrivateThreads:1n<<36n,UseExternalStickers:1n<<37n,SendMessagesInThreads:1n<<38n,UseEmbeddedActivities:1n<<39n,ModerateMembers:1n<<40n};Object.freeze(C.PermissionFlagsBits)});var ze=a(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.ApplicationRoleConnectionMetadataType=W.ApplicationFlags=void 0;var pi;(function(e){e[e.EmbeddedReleased=2]="EmbeddedReleased",e[e.ManagedEmoji=4]="ManagedEmoji",e[e.GroupDMCreate=16]="GroupDMCreate",e[e.RPCHasConnected=2048]="RPCHasConnected",e[e.GatewayPresence=4096]="GatewayPresence",e[e.GatewayPresenceLimited=8192]="GatewayPresenceLimited",e[e.GatewayGuildMembers=16384]="GatewayGuildMembers",e[e.GatewayGuildMembersLimited=32768]="GatewayGuildMembersLimited",e[e.VerificationPendingGuildLimit=65536]="VerificationPendingGuildLimit",e[e.Embedded=131072]="Embedded",e[e.GatewayMessageContent=262144]="GatewayMessageContent",e[e.GatewayMessageContentLimited=524288]="GatewayMessageContentLimited",e[e.EmbeddedFirstParty=1048576]="EmbeddedFirstParty",e[e.ApplicationCommandBadge=8388608]="ApplicationCommandBadge"})(pi=W.ApplicationFlags||(W.ApplicationFlags={}));var bi;(function(e){e[e.IntegerLessThanOrEqual=1]="IntegerLessThanOrEqual",e[e.IntegerGreaterThanOrEqual=2]="IntegerGreaterThanOrEqual",e[e.IntegerEqual=3]="IntegerEqual",e[e.IntegerNotEqual=4]="IntegerNotEqual",e[e.DatetimeLessThanOrEqual=5]="DatetimeLessThanOrEqual",e[e.DatetimeGreaterThanOrEqual=6]="DatetimeGreaterThanOrEqual",e[e.BooleanEqual=7]="BooleanEqual",e[e.BooleanNotEqual=8]="BooleanNotEqual"})(bi=W.ApplicationRoleConnectionMetadataType||(W.ApplicationRoleConnectionMetadataType={}))});var Fe=a(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.AuditLogOptionsType=x.AuditLogEvent=void 0;var vi;(function(e){e[e.GuildUpdate=1]="GuildUpdate",e[e.ChannelCreate=10]="ChannelCreate",e[e.ChannelUpdate=11]="ChannelUpdate",e[e.ChannelDelete=12]="ChannelDelete",e[e.ChannelOverwriteCreate=13]="ChannelOverwriteCreate",e[e.ChannelOverwriteUpdate=14]="ChannelOverwriteUpdate",e[e.ChannelOverwriteDelete=15]="ChannelOverwriteDelete",e[e.MemberKick=20]="MemberKick",e[e.MemberPrune=21]="MemberPrune",e[e.MemberBanAdd=22]="MemberBanAdd",e[e.MemberBanRemove=23]="MemberBanRemove",e[e.MemberUpdate=24]="MemberUpdate",e[e.MemberRoleUpdate=25]="MemberRoleUpdate",e[e.MemberMove=26]="MemberMove",e[e.MemberDisconnect=27]="MemberDisconnect",e[e.BotAdd=28]="BotAdd",e[e.RoleCreate=30]="RoleCreate",e[e.RoleUpdate=31]="RoleUpdate",e[e.RoleDelete=32]="RoleDelete",e[e.InviteCreate=40]="InviteCreate",e[e.InviteUpdate=41]="InviteUpdate",e[e.InviteDelete=42]="InviteDelete",e[e.WebhookCreate=50]="WebhookCreate",e[e.WebhookUpdate=51]="WebhookUpdate",e[e.WebhookDelete=52]="WebhookDelete",e[e.EmojiCreate=60]="EmojiCreate",e[e.EmojiUpdate=61]="EmojiUpdate",e[e.EmojiDelete=62]="EmojiDelete",e[e.MessageDelete=72]="MessageDelete",e[e.MessageBulkDelete=73]="MessageBulkDelete",e[e.MessagePin=74]="MessagePin",e[e.MessageUnpin=75]="MessageUnpin",e[e.IntegrationCreate=80]="IntegrationCreate",e[e.IntegrationUpdate=81]="IntegrationUpdate",e[e.IntegrationDelete=82]="IntegrationDelete",e[e.StageInstanceCreate=83]="StageInstanceCreate",e[e.StageInstanceUpdate=84]="StageInstanceUpdate",e[e.StageInstanceDelete=85]="StageInstanceDelete",e[e.StickerCreate=90]="StickerCreate",e[e.StickerUpdate=91]="StickerUpdate",e[e.StickerDelete=92]="StickerDelete",e[e.GuildScheduledEventCreate=100]="GuildScheduledEventCreate",e[e.GuildScheduledEventUpdate=101]="GuildScheduledEventUpdate",e[e.GuildScheduledEventDelete=102]="GuildScheduledEventDelete",e[e.ThreadCreate=110]="ThreadCreate",e[e.ThreadUpdate=111]="ThreadUpdate",e[e.ThreadDelete=112]="ThreadDelete",e[e.ApplicationCommandPermissionUpdate=121]="ApplicationCommandPermissionUpdate",e[e.AutoModerationRuleCreate=140]="AutoModerationRuleCreate",e[e.AutoModerationRuleUpdate=141]="AutoModerationRuleUpdate",e[e.AutoModerationRuleDelete=142]="AutoModerationRuleDelete",e[e.AutoModerationBlockMessage=143]="AutoModerationBlockMessage",e[e.AutoModerationFlagToChannel=144]="AutoModerationFlagToChannel",e[e.AutoModerationUserCommunicationDisabled=145]="AutoModerationUserCommunicationDisabled"})(vi=x.AuditLogEvent||(x.AuditLogEvent={}));var gi;(function(e){e.Role="0",e.Member="1"})(gi=x.AuditLogOptionsType||(x.AuditLogOptionsType={}))});var Oe=a(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.AutoModerationActionType=A.AutoModerationRuleEventType=A.AutoModerationRuleKeywordPresetType=A.AutoModerationRuleTriggerType=void 0;var _i;(function(e){e[e.Keyword=1]="Keyword",e[e.Spam=3]="Spam",e[e.KeywordPreset=4]="KeywordPreset",e[e.MentionSpam=5]="MentionSpam"})(_i=A.AutoModerationRuleTriggerType||(A.AutoModerationRuleTriggerType={}));var Ii;(function(e){e[e.Profanity=1]="Profanity",e[e.SexualContent=2]="SexualContent",e[e.Slurs=3]="Slurs"})(Ii=A.AutoModerationRuleKeywordPresetType||(A.AutoModerationRuleKeywordPresetType={}));var Mi;(function(e){e[e.MessageSend=1]="MessageSend"})(Mi=A.AutoModerationRuleEventType||(A.AutoModerationRuleEventType={}));var Ai;(function(e){e[e.BlockMessage=1]="BlockMessage",e[e.SendAlertMessage=2]="SendAlertMessage",e[e.Timeout=3]="Timeout"})(Ai=A.AutoModerationActionType||(A.AutoModerationActionType={}))});var Ce=a(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.ChannelFlags=u.TextInputStyle=u.ButtonStyle=u.ComponentType=u.AllowedMentionsTypes=u.EmbedType=u.ThreadMemberFlags=u.ThreadAutoArchiveDuration=u.OverwriteType=u.MessageFlags=u.MessageActivityType=u.MessageType=u.VideoQualityMode=u.ChannelType=u.ForumLayoutType=u.SortOrderType=void 0;var Pi;(function(e){e[e.LatestActivity=0]="LatestActivity",e[e.CreationDate=1]="CreationDate"})(Pi=u.SortOrderType||(u.SortOrderType={}));var yi;(function(e){e[e.NotSet=0]="NotSet",e[e.ListView=1]="ListView",e[e.GalleryView=2]="GalleryView"})(yi=u.ForumLayoutType||(u.ForumLayoutType={}));var ki;(function(e){e[e.GuildText=0]="GuildText",e[e.DM=1]="DM",e[e.GuildVoice=2]="GuildVoice",e[e.GroupDM=3]="GroupDM",e[e.GuildCategory=4]="GuildCategory",e[e.GuildAnnouncement=5]="GuildAnnouncement",e[e.AnnouncementThread=10]="AnnouncementThread",e[e.PublicThread=11]="PublicThread",e[e.PrivateThread=12]="PrivateThread",e[e.GuildStageVoice=13]="GuildStageVoice",e[e.GuildDirectory=14]="GuildDirectory",e[e.GuildForum=15]="GuildForum",e[e.GuildNews=5]="GuildNews",e[e.GuildNewsThread=10]="GuildNewsThread",e[e.GuildPublicThread=11]="GuildPublicThread",e[e.GuildPrivateThread=12]="GuildPrivateThread"})(ki=u.ChannelType||(u.ChannelType={}));var Ui;(function(e){e[e.Auto=1]="Auto",e[e.Full=2]="Full"})(Ui=u.VideoQualityMode||(u.VideoQualityMode={}));var Di;(function(e){e[e.Default=0]="Default",e[e.RecipientAdd=1]="RecipientAdd",e[e.RecipientRemove=2]="RecipientRemove",e[e.Call=3]="Call",e[e.ChannelNameChange=4]="ChannelNameChange",e[e.ChannelIconChange=5]="ChannelIconChange",e[e.ChannelPinnedMessage=6]="ChannelPinnedMessage",e[e.UserJoin=7]="UserJoin",e[e.GuildBoost=8]="GuildBoost",e[e.GuildBoostTier1=9]="GuildBoostTier1",e[e.GuildBoostTier2=10]="GuildBoostTier2",e[e.GuildBoostTier3=11]="GuildBoostTier3",e[e.ChannelFollowAdd=12]="ChannelFollowAdd",e[e.GuildDiscoveryDisqualified=14]="GuildDiscoveryDisqualified",e[e.GuildDiscoveryRequalified=15]="GuildDiscoveryRequalified",e[e.GuildDiscoveryGracePeriodInitialWarning=16]="GuildDiscoveryGracePeriodInitialWarning",e[e.GuildDiscoveryGracePeriodFinalWarning=17]="GuildDiscoveryGracePeriodFinalWarning",e[e.ThreadCreated=18]="ThreadCreated",e[e.Reply=19]="Reply",e[e.ChatInputCommand=20]="ChatInputCommand",e[e.ThreadStarterMessage=21]="ThreadStarterMessage",e[e.GuildInviteReminder=22]="GuildInviteReminder",e[e.ContextMenuCommand=23]="ContextMenuCommand",e[e.AutoModerationAction=24]="AutoModerationAction",e[e.RoleSubscriptionPurchase=25]="RoleSubscriptionPurchase",e[e.InteractionPremiumUpsell=26]="InteractionPremiumUpsell",e[e.StageStart=27]="StageStart",e[e.StageEnd=28]="StageEnd",e[e.StageSpeaker=29]="StageSpeaker",e[e.StageRaiseHand=30]="StageRaiseHand",e[e.StageTopic=31]="StageTopic",e[e.GuildApplicationPremiumSubscription=32]="GuildApplicationPremiumSubscription"})(Di=u.MessageType||(u.MessageType={}));var Bi;(function(e){e[e.Join=1]="Join",e[e.Spectate=2]="Spectate",e[e.Listen=3]="Listen",e[e.JoinRequest=5]="JoinRequest"})(Bi=u.MessageActivityType||(u.MessageActivityType={}));var wi;(function(e){e[e.Crossposted=1]="Crossposted",e[e.IsCrosspost=2]="IsCrosspost",e[e.SuppressEmbeds=4]="SuppressEmbeds",e[e.SourceMessageDeleted=8]="SourceMessageDeleted",e[e.Urgent=16]="Urgent",e[e.HasThread=32]="HasThread",e[e.Ephemeral=64]="Ephemeral",e[e.Loading=128]="Loading",e[e.FailedToMentionSomeRolesInThread=256]="FailedToMentionSomeRolesInThread"})(wi=u.MessageFlags||(u.MessageFlags={}));var $i;(function(e){e[e.Role=0]="Role",e[e.Member=1]="Member"})($i=u.OverwriteType||(u.OverwriteType={}));var qi;(function(e){e[e.OneHour=60]="OneHour",e[e.OneDay=1440]="OneDay",e[e.ThreeDays=4320]="ThreeDays",e[e.OneWeek=10080]="OneWeek"})(qi=u.ThreadAutoArchiveDuration||(u.ThreadAutoArchiveDuration={}));var Gi;(function(e){})(Gi=u.ThreadMemberFlags||(u.ThreadMemberFlags={}));var Wi;(function(e){e.Rich="rich",e.Image="image",e.Video="video",e.GIFV="gifv",e.Article="article",e.Link="link",e.AutoModerationMessage="auto_moderation_message"})(Wi=u.EmbedType||(u.EmbedType={}));var xi;(function(e){e.Everyone="everyone",e.Role="roles",e.User="users"})(xi=u.AllowedMentionsTypes||(u.AllowedMentionsTypes={}));var ji;(function(e){e[e.ActionRow=1]="ActionRow",e[e.Button=2]="Button",e[e.StringSelect=3]="StringSelect",e[e.TextInput=4]="TextInput",e[e.UserSelect=5]="UserSelect",e[e.RoleSelect=6]="RoleSelect",e[e.MentionableSelect=7]="MentionableSelect",e[e.ChannelSelect=8]="ChannelSelect",e[e.SelectMenu=3]="SelectMenu"})(ji=u.ComponentType||(u.ComponentType={}));var Hi;(function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Success=3]="Success",e[e.Danger=4]="Danger",e[e.Link=5]="Link"})(Hi=u.ButtonStyle||(u.ButtonStyle={}));var Li;(function(e){e[e.Short=1]="Short",e[e.Paragraph=2]="Paragraph"})(Li=u.TextInputStyle||(u.TextInputStyle={}));var Vi;(function(e){e[e.Pinned=2]="Pinned",e[e.RequireTag=16]="RequireTag"})(Vi=u.ChannelFlags||(u.ChannelFlags={}))});var Qe=a(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0})});var Xe=a(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.ActivityFlags=P.ActivityType=P.ActivityPlatform=P.PresenceUpdateStatus=void 0;var Ti;(function(e){e.Online="online",e.DoNotDisturb="dnd",e.Idle="idle",e.Invisible="invisible",e.Offline="offline"})(Ti=P.PresenceUpdateStatus||(P.PresenceUpdateStatus={}));var Ri;(function(e){e.Desktop="desktop",e.Xbox="xbox",e.Samsung="samsung",e.IOS="ios",e.Android="android",e.Embedded="embedded",e.PS4="ps4",e.PS5="ps5"})(Ri=P.ActivityPlatform||(P.ActivityPlatform={}));var Yi;(function(e){e[e.Playing=0]="Playing",e[e.Streaming=1]="Streaming",e[e.Listening=2]="Listening",e[e.Watching=3]="Watching",e[e.Custom=4]="Custom",e[e.Competing=5]="Competing"})(Yi=P.ActivityType||(P.ActivityType={}));var zi;(function(e){e[e.Instance=1]="Instance",e[e.Join=2]="Join",e[e.Spectate=4]="Spectate",e[e.JoinRequest=8]="JoinRequest",e[e.Sync=16]="Sync",e[e.Play=32]="Play",e[e.PartyPrivacyFriends=64]="PartyPrivacyFriends",e[e.PartyPrivacyVoiceChannel=128]="PartyPrivacyVoiceChannel",e[e.Embedded=256]="Embedded"})(zi=P.ActivityFlags||(P.ActivityFlags={}))});var Ze=a(d=>{"use strict";Object.defineProperty(d,"__esModule",{value:!0});d.MembershipScreeningFieldType=d.GuildWidgetStyle=d.IntegrationExpireBehavior=d.GuildMemberFlags=d.GuildFeature=d.GuildSystemChannelFlags=d.GuildHubType=d.GuildPremiumTier=d.GuildVerificationLevel=d.GuildNSFWLevel=d.GuildMFALevel=d.GuildExplicitContentFilter=d.GuildDefaultMessageNotifications=void 0;var Fi;(function(e){e[e.AllMessages=0]="AllMessages",e[e.OnlyMentions=1]="OnlyMentions"})(Fi=d.GuildDefaultMessageNotifications||(d.GuildDefaultMessageNotifications={}));var Oi;(function(e){e[e.Disabled=0]="Disabled",e[e.MembersWithoutRoles=1]="MembersWithoutRoles",e[e.AllMembers=2]="AllMembers"})(Oi=d.GuildExplicitContentFilter||(d.GuildExplicitContentFilter={}));var Ci;(function(e){e[e.None=0]="None",e[e.Elevated=1]="Elevated"})(Ci=d.GuildMFALevel||(d.GuildMFALevel={}));var Ki;(function(e){e[e.Default=0]="Default",e[e.Explicit=1]="Explicit",e[e.Safe=2]="Safe",e[e.AgeRestricted=3]="AgeRestricted"})(Ki=d.GuildNSFWLevel||(d.GuildNSFWLevel={}));var Qi;(function(e){e[e.None=0]="None",e[e.Low=1]="Low",e[e.Medium=2]="Medium",e[e.High=3]="High",e[e.VeryHigh=4]="VeryHigh"})(Qi=d.GuildVerificationLevel||(d.GuildVerificationLevel={}));var Xi;(function(e){e[e.None=0]="None",e[e.Tier1=1]="Tier1",e[e.Tier2=2]="Tier2",e[e.Tier3=3]="Tier3"})(Xi=d.GuildPremiumTier||(d.GuildPremiumTier={}));var Zi;(function(e){e[e.Default=0]="Default",e[e.HighSchool=1]="HighSchool",e[e.College=2]="College"})(Zi=d.GuildHubType||(d.GuildHubType={}));var Ni;(function(e){e[e.SuppressJoinNotifications=1]="SuppressJoinNotifications",e[e.SuppressPremiumSubscriptions=2]="SuppressPremiumSubscriptions",e[e.SuppressGuildReminderNotifications=4]="SuppressGuildReminderNotifications",e[e.SuppressJoinNotificationReplies=8]="SuppressJoinNotificationReplies",e[e.SupressRoleSubscriptionPurchaseNotifications=16]="SupressRoleSubscriptionPurchaseNotifications",e[e.SuppressRoleSubscriptionPurchaseNotificationReplies=32]="SuppressRoleSubscriptionPurchaseNotificationReplies"})(Ni=d.GuildSystemChannelFlags||(d.GuildSystemChannelFlags={}));var Ei;(function(e){e.AnimatedBanner="ANIMATED_BANNER",e.AnimatedIcon="ANIMATED_ICON",e.ApplicationCommandPermissionsV2="APPLICATION_COMMAND_PERMISSIONS_V2",e.AutoModeration="AUTO_MODERATION",e.Banner="BANNER",e.Community="COMMUNITY",e.CreatorMonetizableProvisional="CREATOR_MONETIZABLE_PROVISIONAL",e.CreatorStorePage="CREATOR_STORE_PAGE",e.DeveloperSupportServer="DEVELOPER_SUPPORT_SERVER",e.Discoverable="DISCOVERABLE",e.Featurable="FEATURABLE",e.HasDirectoryEntry="HAS_DIRECTORY_ENTRY",e.Hub="HUB",e.InvitesDisabled="INVITES_DISABLED",e.InviteSplash="INVITE_SPLASH",e.LinkedToHub="LINKED_TO_HUB",e.MemberVerificationGateEnabled="MEMBER_VERIFICATION_GATE_ENABLED",e.MonetizationEnabled="MONETIZATION_ENABLED",e.MoreStickers="MORE_STICKERS",e.News="NEWS",e.Partnered="PARTNERED",e.PreviewEnabled="PREVIEW_ENABLED",e.PrivateThreads="PRIVATE_THREADS",e.RelayEnabled="RELAY_ENABLED",e.RoleIcons="ROLE_ICONS",e.RoleSubscriptionsAvailableForPurchase="ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE",e.RoleSubscriptionsEnabled="ROLE_SUBSCRIPTIONS_ENABLED",e.TicketedEventsEnabled="TICKETED_EVENTS_ENABLED",e.VanityURL="VANITY_URL",e.Verified="VERIFIED",e.VIPRegions="VIP_REGIONS",e.WelcomeScreenEnabled="WELCOME_SCREEN_ENABLED"})(Ei=d.GuildFeature||(d.GuildFeature={}));var Si;(function(e){e[e.DidRejoin=1]="DidRejoin",e[e.CompletedOnboarding=2]="CompletedOnboarding",e[e.BypassesVerification=4]="BypassesVerification",e[e.StartedOnboarding=8]="StartedOnboarding"})(Si=d.GuildMemberFlags||(d.GuildMemberFlags={}));var Ji;(function(e){e[e.RemoveRole=0]="RemoveRole",e[e.Kick=1]="Kick"})(Ji=d.IntegrationExpireBehavior||(d.IntegrationExpireBehavior={}));var es;(function(e){e.Shield="shield",e.Banner1="banner1",e.Banner2="banner2",e.Banner3="banner3",e.Banner4="banner4"})(es=d.GuildWidgetStyle||(d.GuildWidgetStyle={}));var ts;(function(e){e.Terms="TERMS"})(ts=d.MembershipScreeningFieldType||(d.MembershipScreeningFieldType={}))});var Ne=a($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.GuildScheduledEventPrivacyLevel=$.GuildScheduledEventStatus=$.GuildScheduledEventEntityType=void 0;var ns;(function(e){e[e.StageInstance=1]="StageInstance",e[e.Voice=2]="Voice",e[e.External=3]="External"})(ns=$.GuildScheduledEventEntityType||($.GuildScheduledEventEntityType={}));var is;(function(e){e[e.Scheduled=1]="Scheduled",e[e.Active=2]="Active",e[e.Completed=3]="Completed",e[e.Canceled=4]="Canceled"})(is=$.GuildScheduledEventStatus||($.GuildScheduledEventStatus={}));var ss;(function(e){e[e.GuildOnly=2]="GuildOnly"})(ss=$.GuildScheduledEventPrivacyLevel||($.GuildScheduledEventPrivacyLevel={}))});var Se=a(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0})});var et=a(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0})});var nt=a(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0})});var st=a(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0})});var at=a(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0})});var ut=a(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0})});var lt=a(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0})});var ht=a(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0})});var mt=a(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.ApplicationCommandOptionType=void 0;var rs;(function(e){e[e.Subcommand=1]="Subcommand",e[e.SubcommandGroup=2]="SubcommandGroup",e[e.String=3]="String",e[e.Integer=4]="Integer",e[e.Boolean=5]="Boolean",e[e.User=6]="User",e[e.Channel=7]="Channel",e[e.Role=8]="Role",e[e.Mentionable=9]="Mentionable",e[e.Number=10]="Number",e[e.Attachment=11]="Attachment"})(rs=K.ApplicationCommandOptionType||(K.ApplicationCommandOptionType={}))});var pt=a(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0})});var vt=a(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0})});var _t=a(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0})});var Mt=a(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0})});var At=a(g=>{"use strict";var as=g&&g.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),k=g&&g.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&as(n,e,t)};Object.defineProperty(g,"__esModule",{value:!0});k(Se(),g);k(et(),g);k(nt(),g);k(st(),g);k(at(),g);k(ut(),g);k(lt(),g);k(ht(),g);k(mt(),g);k(pt(),g);k(vt(),g);k(_t(),g);k(Mt(),g)});var yt=a(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0})});var kt=a(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.APIApplicationCommandPermissionsConstant=T.ApplicationCommandPermissionType=void 0;var os;(function(e){e[e.Role=1]="Role",e[e.User=2]="User",e[e.Channel=3]="Channel"})(os=T.ApplicationCommandPermissionType||(T.ApplicationCommandPermissionType={}));T.APIApplicationCommandPermissionsConstant={Everyone:e=>String(e),AllChannels:e=>String(BigInt(e)-1n)}});var Ut=a(B=>{"use strict";var us=B&&B.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),de=B&&B.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&us(n,e,t)};Object.defineProperty(B,"__esModule",{value:!0});B.ApplicationCommandType=void 0;de(At(),B);de(yt(),B);de(kt(),B);var cs;(function(e){e[e.ChatInput=1]="ChatInput",e[e.User=2]="User",e[e.Message=3]="Message"})(cs=B.ApplicationCommandType||(B.ApplicationCommandType={}))});var Bt=a(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0})});var $t=a(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0})});var Gt=a(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0})});var xt=a(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0})});var Ht=a(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0})});var Lt=a(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.InteractionResponseType=j.InteractionType=void 0;var ls;(function(e){e[e.Ping=1]="Ping",e[e.ApplicationCommand=2]="ApplicationCommand",e[e.MessageComponent=3]="MessageComponent",e[e.ApplicationCommandAutocomplete=4]="ApplicationCommandAutocomplete",e[e.ModalSubmit=5]="ModalSubmit"})(ls=j.InteractionType||(j.InteractionType={}));var ds;(function(e){e[e.Pong=1]="Pong",e[e.ChannelMessageWithSource=4]="ChannelMessageWithSource",e[e.DeferredChannelMessageWithSource=5]="DeferredChannelMessageWithSource",e[e.DeferredMessageUpdate=6]="DeferredMessageUpdate",e[e.UpdateMessage=7]="UpdateMessage",e[e.ApplicationCommandAutocompleteResult=8]="ApplicationCommandAutocompleteResult",e[e.Modal=9]="Modal"})(ds=j.InteractionResponseType||(j.InteractionResponseType={}))});var Vt=a(U=>{"use strict";var hs=U&&U.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),R=U&&U.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&hs(n,e,t)};Object.defineProperty(U,"__esModule",{value:!0});R(Ut(),U);R(Bt(),U);R($t(),U);R(Gt(),U);R(xt(),U);R(Ht(),U);R(Lt(),U)});var Tt=a(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.InviteTargetType=void 0;var ms;(function(e){e[e.Stream=1]="Stream",e[e.EmbeddedApplication=2]="EmbeddedApplication"})(ms=Q.InviteTargetType||(Q.InviteTargetType={}))});var Rt=a(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.OAuth2Scopes=void 0;var fs;(function(e){e.Bot="bot",e.Connections="connections",e.DMChannelsRead="dm_channels.read",e.Email="email",e.Identify="identify",e.Guilds="guilds",e.GuildsJoin="guilds.join",e.GuildsMembersRead="guilds.members.read",e.GroupDMJoins="gdm.join",e.MessagesRead="messages.read",e.RoleConnectionsWrite="role_connections.write",e.RPC="rpc",e.RPCNotificationsRead="rpc.notifications.read",e.WebhookIncoming="webhook.incoming",e.Voice="voice",e.ApplicationsBuildsUpload="applications.builds.upload",e.ApplicationsBuildsRead="applications.builds.read",e.ApplicationsStoreUpdate="applications.store.update",e.ApplicationsEntitlements="applications.entitlements",e.RelationshipsRead="relationships.read",e.ActivitiesRead="activities.read",e.ActivitiesWrite="activities.write",e.ApplicationsCommands="applications.commands",e.ApplicationsCommandsUpdate="applications.commands.update",e.ApplicationCommandsPermissionsUpdate="applications.commands.permissions.update"})(fs=X.OAuth2Scopes||(X.OAuth2Scopes={}))});var zt=a(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0})});var Ft=a(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.StageInstancePrivacyLevel=void 0;var ps;(function(e){e[e.Public=1]="Public",e[e.GuildOnly=2]="GuildOnly"})(ps=Z.StageInstancePrivacyLevel||(Z.StageInstancePrivacyLevel={}))});var Ot=a(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.StickerFormatType=H.StickerType=void 0;var bs;(function(e){e[e.Standard=1]="Standard",e[e.Guild=2]="Guild"})(bs=H.StickerType||(H.StickerType={}));var vs;(function(e){e[e.PNG=1]="PNG",e[e.APNG=2]="APNG",e[e.Lottie=3]="Lottie",e[e.GIF=4]="GIF"})(vs=H.StickerFormatType||(H.StickerFormatType={}))});var Ct=a(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.TeamMemberMembershipState=void 0;var gs;(function(e){e[e.Invited=1]="Invited",e[e.Accepted=2]="Accepted"})(gs=N.TeamMemberMembershipState||(N.TeamMemberMembershipState={}))});var Qt=a(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0})});var Xt=a(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.ConnectionVisibility=y.ConnectionService=y.UserPremiumType=y.UserFlags=void 0;var _s;(function(e){e[e.Staff=1]="Staff",e[e.Partner=2]="Partner",e[e.Hypesquad=4]="Hypesquad",e[e.BugHunterLevel1=8]="BugHunterLevel1",e[e.HypeSquadOnlineHouse1=64]="HypeSquadOnlineHouse1",e[e.HypeSquadOnlineHouse2=128]="HypeSquadOnlineHouse2",e[e.HypeSquadOnlineHouse3=256]="HypeSquadOnlineHouse3",e[e.PremiumEarlySupporter=512]="PremiumEarlySupporter",e[e.TeamPseudoUser=1024]="TeamPseudoUser",e[e.BugHunterLevel2=16384]="BugHunterLevel2",e[e.VerifiedBot=65536]="VerifiedBot",e[e.VerifiedDeveloper=131072]="VerifiedDeveloper",e[e.CertifiedModerator=262144]="CertifiedModerator",e[e.BotHTTPInteractions=524288]="BotHTTPInteractions",e[e.Spammer=1048576]="Spammer",e[e.ActiveDeveloper=4194304]="ActiveDeveloper",e[e.Quarantined=17592186044416]="Quarantined"})(_s=y.UserFlags||(y.UserFlags={}));var Is;(function(e){e[e.None=0]="None",e[e.NitroClassic=1]="NitroClassic",e[e.Nitro=2]="Nitro",e[e.NitroBasic=3]="NitroBasic"})(Is=y.UserPremiumType||(y.UserPremiumType={}));var Ms;(function(e){e.BattleNet="battlenet",e.eBay="ebay",e.EpicGames="epicgames",e.Facebook="facebook",e.GitHub="github",e.LeagueOfLegends="leagueoflegends",e.PayPal="paypal",e.PlayStationNetwork="playstation",e.Reddit="reddit",e.RiotGames="riotgames",e.Spotify="spotify",e.Skype="skype",e.Steam="steam",e.TikTok="tiktok",e.Twitch="twitch",e.Twitter="twitter",e.Xbox="xbox",e.YouTube="youtube"})(Ms=y.ConnectionService||(y.ConnectionService={}));var As;(function(e){e[e.None=0]="None",e[e.Everyone=1]="Everyone"})(As=y.ConnectionVisibility||(y.ConnectionVisibility={}))});var Nt=a(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0})});var Et=a(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.WebhookType=void 0;var Ps;(function(e){e[e.Incoming=1]="Incoming",e[e.ChannelFollower=2]="ChannelFollower",e[e.Application=3]="Application"})(Ps=E.WebhookType||(E.WebhookType={}))});var he=a(f=>{"use strict";var ys=f&&f.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),v=f&&f.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&ys(n,e,t)};Object.defineProperty(f,"__esModule",{value:!0});v(Ye(),f);v(ze(),f);v(Fe(),f);v(Oe(),f);v(Ce(),f);v(Qe(),f);v(Xe(),f);v(Ze(),f);v(Ne(),f);v(Vt(),f);v(Tt(),f);v(Rt(),f);v(zt(),f);v(Ft(),f);v(Ot(),f);v(Ct(),f);v(Qt(),f);v(Xt(),f);v(Nt(),f);v(Et(),f)});var St=a(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.Locale=L.RESTJSONErrorCodes=void 0;var ks;(function(e){e[e.GeneralError=0]="GeneralError",e[e.UnknownAccount=10001]="UnknownAccount",e[e.UnknownApplication=10002]="UnknownApplication",e[e.UnknownChannel=10003]="UnknownChannel",e[e.UnknownGuild=10004]="UnknownGuild",e[e.UnknownIntegration=10005]="UnknownIntegration",e[e.UnknownInvite=10006]="UnknownInvite",e[e.UnknownMember=10007]="UnknownMember",e[e.UnknownMessage=10008]="UnknownMessage",e[e.UnknownPermissionOverwrite=10009]="UnknownPermissionOverwrite",e[e.UnknownProvider=10010]="UnknownProvider",e[e.UnknownRole=10011]="UnknownRole",e[e.UnknownToken=10012]="UnknownToken",e[e.UnknownUser=10013]="UnknownUser",e[e.UnknownEmoji=10014]="UnknownEmoji",e[e.UnknownWebhook=10015]="UnknownWebhook",e[e.UnknownWebhookService=10016]="UnknownWebhookService",e[e.UnknownSession=10020]="UnknownSession",e[e.UnknownBan=10026]="UnknownBan",e[e.UnknownSKU=10027]="UnknownSKU",e[e.UnknownStoreListing=10028]="UnknownStoreListing",e[e.UnknownEntitlement=10029]="UnknownEntitlement",e[e.UnknownBuild=10030]="UnknownBuild",e[e.UnknownLobby=10031]="UnknownLobby",e[e.UnknownBranch=10032]="UnknownBranch",e[e.UnknownStoreDirectoryLayout=10033]="UnknownStoreDirectoryLayout",e[e.UnknownRedistributable=10036]="UnknownRedistributable",e[e.UnknownGiftCode=10038]="UnknownGiftCode",e[e.UnknownStream=10049]="UnknownStream",e[e.UnknownPremiumServerSubscribeCooldown=10050]="UnknownPremiumServerSubscribeCooldown",e[e.UnknownGuildTemplate=10057]="UnknownGuildTemplate",e[e.UnknownDiscoverableServerCategory=10059]="UnknownDiscoverableServerCategory",e[e.UnknownSticker=10060]="UnknownSticker",e[e.UnknownInteraction=10062]="UnknownInteraction",e[e.UnknownApplicationCommand=10063]="UnknownApplicationCommand",e[e.UnknownVoiceState=10065]="UnknownVoiceState",e[e.UnknownApplicationCommandPermissions=10066]="UnknownApplicationCommandPermissions",e[e.UnknownStageInstance=10067]="UnknownStageInstance",e[e.UnknownGuildMemberVerificationForm=10068]="UnknownGuildMemberVerificationForm",e[e.UnknownGuildWelcomeScreen=10069]="UnknownGuildWelcomeScreen",e[e.UnknownGuildScheduledEvent=10070]="UnknownGuildScheduledEvent",e[e.UnknownGuildScheduledEventUser=10071]="UnknownGuildScheduledEventUser",e[e.UnknownTag=10087]="UnknownTag",e[e.BotsCannotUseThisEndpoint=20001]="BotsCannotUseThisEndpoint",e[e.OnlyBotsCanUseThisEndpoint=20002]="OnlyBotsCanUseThisEndpoint",e[e.ExplicitContentCannotBeSentToTheDesiredRecipient=20009]="ExplicitContentCannotBeSentToTheDesiredRecipient",e[e.NotAuthorizedToPerformThisActionOnThisApplication=20012]="NotAuthorizedToPerformThisActionOnThisApplication",e[e.ActionCannotBePerformedDueToSlowmodeRateLimit=20016]="ActionCannotBePerformedDueToSlowmodeRateLimit",e[e.TheMazeIsntMeantForYou=20017]="TheMazeIsntMeantForYou",e[e.OnlyTheOwnerOfThisAccountCanPerformThisAction=20018]="OnlyTheOwnerOfThisAccountCanPerformThisAction",e[e.AnnouncementEditLimitExceeded=20022]="AnnouncementEditLimitExceeded",e[e.UnderMinimumAge=20024]="UnderMinimumAge",e[e.ChannelSendRateLimit=20028]="ChannelSendRateLimit",e[e.ServerSendRateLimit=20029]="ServerSendRateLimit",e[e.StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords=20031]="StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords",e[e.GuildPremiumSubscriptionLevelTooLow=20035]="GuildPremiumSubscriptionLevelTooLow",e[e.MaximumNumberOfGuildsReached=30001]="MaximumNumberOfGuildsReached",e[e.MaximumNumberOfFriendsReached=30002]="MaximumNumberOfFriendsReached",e[e.MaximumNumberOfPinsReachedForTheChannel=30003]="MaximumNumberOfPinsReachedForTheChannel",e[e.MaximumNumberOfRecipientsReached=30004]="MaximumNumberOfRecipientsReached",e[e.MaximumNumberOfGuildRolesReached=30005]="MaximumNumberOfGuildRolesReached",e[e.MaximumNumberOfWebhooksReached=30007]="MaximumNumberOfWebhooksReached",e[e.MaximumNumberOfEmojisReached=30008]="MaximumNumberOfEmojisReached",e[e.MaximumNumberOfReactionsReached=30010]="MaximumNumberOfReactionsReached",e[e.MaximumNumberOfGuildChannelsReached=30013]="MaximumNumberOfGuildChannelsReached",e[e.MaximumNumberOfAttachmentsInAMessageReached=30015]="MaximumNumberOfAttachmentsInAMessageReached",e[e.MaximumNumberOfInvitesReached=30016]="MaximumNumberOfInvitesReached",e[e.MaximumNumberOfAnimatedEmojisReached=30018]="MaximumNumberOfAnimatedEmojisReached",e[e.MaximumNumberOfServerMembersReached=30019]="MaximumNumberOfServerMembersReached",e[e.MaximumNumberOfServerCategoriesReached=30030]="MaximumNumberOfServerCategoriesReached",e[e.GuildAlreadyHasTemplate=30031]="GuildAlreadyHasTemplate",e[e.MaximumNumberOfApplicationCommandsReached=30032]="MaximumNumberOfApplicationCommandsReached",e[e.MaximumThreadParticipantsReached=30033]="MaximumThreadParticipantsReached",e[e.MaximumDailyApplicationCommandCreatesReached=30034]="MaximumDailyApplicationCommandCreatesReached",e[e.MaximumNumberOfNonGuildMemberBansHasBeenExceeded=30035]="MaximumNumberOfNonGuildMemberBansHasBeenExceeded",e[e.MaximumNumberOfBanFetchesHasBeenReached=30037]="MaximumNumberOfBanFetchesHasBeenReached",e[e.MaximumNumberOfUncompletedGuildScheduledEventsReached=30038]="MaximumNumberOfUncompletedGuildScheduledEventsReached",e[e.MaximumNumberOfStickersReached=30039]="MaximumNumberOfStickersReached",e[e.MaximumNumberOfPruneRequestsHasBeenReached=30040]="MaximumNumberOfPruneRequestsHasBeenReached",e[e.MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached=30042]="MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached",e[e.MaximumNumberOfEditsToMessagesOlderThanOneHourReached=30046]="MaximumNumberOfEditsToMessagesOlderThanOneHourReached",e[e.MaximumNumberOfPinnedThreadsInForumHasBeenReached=30047]="MaximumNumberOfPinnedThreadsInForumHasBeenReached",e[e.MaximumNumberOfTagsInForumHasBeenReached=30048]="MaximumNumberOfTagsInForumHasBeenReached",e[e.BitrateIsTooHighForChannelOfThisType=30052]="BitrateIsTooHighForChannelOfThisType",e[e.MaximumNumberOfPremiumEmojisReached=30056]="MaximumNumberOfPremiumEmojisReached",e[e.MaximumNumberOfWebhooksPerGuildReached=30058]="MaximumNumberOfWebhooksPerGuildReached",e[e.Unauthorized=40001]="Unauthorized",e[e.VerifyYourAccount=40002]="VerifyYourAccount",e[e.OpeningDirectMessagesTooFast=40003]="OpeningDirectMessagesTooFast",e[e.SendMessagesHasBeenTemporarilyDisabled=40004]="SendMessagesHasBeenTemporarilyDisabled",e[e.RequestEntityTooLarge=40005]="RequestEntityTooLarge",e[e.FeatureTemporarilyDisabledServerSide=40006]="FeatureTemporarilyDisabledServerSide",e[e.UserBannedFromThisGuild=40007]="UserBannedFromThisGuild",e[e.ConnectionHasBeenRevoked=40012]="ConnectionHasBeenRevoked",e[e.TargetUserIsNotConnectedToVoice=40032]="TargetUserIsNotConnectedToVoice",e[e.ThisMessageWasAlreadyCrossposted=40033]="ThisMessageWasAlreadyCrossposted",e[e.ApplicationCommandWithThatNameAlreadyExists=40041]="ApplicationCommandWithThatNameAlreadyExists",e[e.ApplicationInteractionFailedToSend=40043]="ApplicationInteractionFailedToSend",e[e.CannotSendAMessageInAForumChannel=40058]="CannotSendAMessageInAForumChannel",e[e.InteractionHasAlreadyBeenAcknowledged=40060]="InteractionHasAlreadyBeenAcknowledged",e[e.TagNamesMustBeUnique=40061]="TagNamesMustBeUnique",e[e.ServiceResourceIsBeingRateLimited=40062]="ServiceResourceIsBeingRateLimited",e[e.ThereAreNoTagsAvailableThatCanBeSetByNonModerators=40066]="ThereAreNoTagsAvailableThatCanBeSetByNonModerators",e[e.TagRequiredToCreateAForumPostInThisChannel=40067]="TagRequiredToCreateAForumPostInThisChannel",e[e.MissingAccess=50001]="MissingAccess",e[e.InvalidAccountType=50002]="InvalidAccountType",e[e.CannotExecuteActionOnDMChannel=50003]="CannotExecuteActionOnDMChannel",e[e.GuildWidgetDisabled=50004]="GuildWidgetDisabled",e[e.CannotEditMessageAuthoredByAnotherUser=50005]="CannotEditMessageAuthoredByAnotherUser",e[e.CannotSendAnEmptyMessage=50006]="CannotSendAnEmptyMessage",e[e.CannotSendMessagesToThisUser=50007]="CannotSendMessagesToThisUser",e[e.CannotSendMessagesInNonTextChannel=50008]="CannotSendMessagesInNonTextChannel",e[e.ChannelVerificationLevelTooHighForYouToGainAccess=50009]="ChannelVerificationLevelTooHighForYouToGainAccess",e[e.OAuth2ApplicationDoesNotHaveBot=50010]="OAuth2ApplicationDoesNotHaveBot",e[e.OAuth2ApplicationLimitReached=50011]="OAuth2ApplicationLimitReached",e[e.InvalidOAuth2State=50012]="InvalidOAuth2State",e[e.MissingPermissions=50013]="MissingPermissions",e[e.InvalidToken=50014]="InvalidToken",e[e.NoteWasTooLong=50015]="NoteWasTooLong",e[e.ProvidedTooFewOrTooManyMessagesToDelete=50016]="ProvidedTooFewOrTooManyMessagesToDelete",e[e.InvalidMFALevel=50017]="InvalidMFALevel",e[e.MessageCanOnlyBePinnedInTheChannelItWasSentIn=50019]="MessageCanOnlyBePinnedInTheChannelItWasSentIn",e[e.InviteCodeInvalidOrTaken=50020]="InviteCodeInvalidOrTaken",e[e.CannotExecuteActionOnSystemMessage=50021]="CannotExecuteActionOnSystemMessage",e[e.CannotExecuteActionOnThisChannelType=50024]="CannotExecuteActionOnThisChannelType",e[e.InvalidOAuth2AccessToken=50025]="InvalidOAuth2AccessToken",e[e.MissingRequiredOAuth2Scope=50026]="MissingRequiredOAuth2Scope",e[e.InvalidWebhookToken=50027]="InvalidWebhookToken",e[e.InvalidRole=50028]="InvalidRole",e[e.InvalidRecipients=50033]="InvalidRecipients",e[e.OneOfTheMessagesProvidedWasTooOldForBulkDelete=50034]="OneOfTheMessagesProvidedWasTooOldForBulkDelete",e[e.InvalidFormBodyOrContentType=50035]="InvalidFormBodyOrContentType",e[e.InviteAcceptedToGuildWithoutTheBotBeingIn=50036]="InviteAcceptedToGuildWithoutTheBotBeingIn",e[e.InvalidActivityAction=50039]="InvalidActivityAction",e[e.InvalidAPIVersion=50041]="InvalidAPIVersion",e[e.FileUploadedExceedsMaximumSize=50045]="FileUploadedExceedsMaximumSize",e[e.InvalidFileUploaded=50046]="InvalidFileUploaded",e[e.CannotSelfRedeemThisGift=50054]="CannotSelfRedeemThisGift",e[e.InvalidGuild=50055]="InvalidGuild",e[e.InvalidRequestOrigin=50067]="InvalidRequestOrigin",e[e.InvalidMessageType=50068]="InvalidMessageType",e[e.PaymentSourceRequiredToRedeemGift=50070]="PaymentSourceRequiredToRedeemGift",e[e.CannotModifyASystemWebhook=50073]="CannotModifyASystemWebhook",e[e.CannotDeleteChannelRequiredForCommunityGuilds=50074]="CannotDeleteChannelRequiredForCommunityGuilds",e[e.CannotEditStickersWithinMessage=50080]="CannotEditStickersWithinMessage",e[e.InvalidStickerSent=50081]="InvalidStickerSent",e[e.InvalidActionOnArchivedThread=50083]="InvalidActionOnArchivedThread",e[e.InvalidThreadNotificationSettings=50084]="InvalidThreadNotificationSettings",e[e.ParameterEarlierThanCreation=50085]="ParameterEarlierThanCreation",e[e.CommunityServerChannelsMustBeTextChannels=50086]="CommunityServerChannelsMustBeTextChannels",e[e.TheEntityTypeOfTheEventIsDifferentFromTheEntityYouAreTryingToStartTheEventFor=50091]="TheEntityTypeOfTheEventIsDifferentFromTheEntityYouAreTryingToStartTheEventFor",e[e.ServerNotAvailableInYourLocation=50095]="ServerNotAvailableInYourLocation",e[e.ServerNeedsMonetizationEnabledToPerformThisAction=50097]="ServerNeedsMonetizationEnabledToPerformThisAction",e[e.ServerNeedsMoreBoostsToPerformThisAction=50101]="ServerNeedsMoreBoostsToPerformThisAction",e[e.RequestBodyContainsInvalidJSON=50109]="RequestBodyContainsInvalidJSON",e[e.OwnershipCannotBeMovedToABotUser=50132]="OwnershipCannotBeMovedToABotUser",e[e.FailedToResizeAssetBelowTheMinimumSize=50138]="FailedToResizeAssetBelowTheMinimumSize",e[e.CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji=50144]="CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji",e[e.CannotConvertBetweenPremiumEmojiAndNormalEmoji=50145]="CannotConvertBetweenPremiumEmojiAndNormalEmoji",e[e.UploadedFileNotFound=50146]="UploadedFileNotFound",e[e.YouDoNotHavePermissionToSendThisSticker=50600]="YouDoNotHavePermissionToSendThisSticker",e[e.TwoFactorAuthenticationIsRequired=60003]="TwoFactorAuthenticationIsRequired",e[e.NoUsersWithDiscordTagExist=80004]="NoUsersWithDiscordTagExist",e[e.ReactionWasBlocked=90001]="ReactionWasBlocked",e[e.ApplicationNotYetAvailable=110001]="ApplicationNotYetAvailable",e[e.APIResourceOverloaded=13e4]="APIResourceOverloaded",e[e.TheStageIsAlreadyOpen=150006]="TheStageIsAlreadyOpen",e[e.CannotReplyWithoutPermissionToReadMessageHistory=160002]="CannotReplyWithoutPermissionToReadMessageHistory",e[e.ThreadAlreadyCreatedForMessage=160004]="ThreadAlreadyCreatedForMessage",e[e.ThreadLocked=160005]="ThreadLocked",e[e.MaximumActiveThreads=160006]="MaximumActiveThreads",e[e.MaximumActiveAnnouncementThreads=160007]="MaximumActiveAnnouncementThreads",e[e.InvalidJSONForUploadedLottieFile=170001]="InvalidJSONForUploadedLottieFile",e[e.UploadedLottiesCannotContainRasterizedImages=170002]="UploadedLottiesCannotContainRasterizedImages",e[e.StickerMaximumFramerateExceeded=170003]="StickerMaximumFramerateExceeded",e[e.StickerFrameCountExceedsMaximumOf1000Frames=170004]="StickerFrameCountExceedsMaximumOf1000Frames",e[e.LottieAnimationMaximumDimensionsExceeded=170005]="LottieAnimationMaximumDimensionsExceeded",e[e.StickerFramerateIsTooSmallOrTooLarge=170006]="StickerFramerateIsTooSmallOrTooLarge",e[e.StickerAnimationDurationExceedsMaximumOf5Seconds=170007]="StickerAnimationDurationExceedsMaximumOf5Seconds",e[e.CannotUpdateAFinishedEvent=18e4]="CannotUpdateAFinishedEvent",e[e.FailedToCreateStageNeededForStageEvent=180002]="FailedToCreateStageNeededForStageEvent",e[e.MessageWasBlockedByAutomaticModeration=2e5]="MessageWasBlockedByAutomaticModeration",e[e.TitleWasBlockedByAutomaticModeration=200001]="TitleWasBlockedByAutomaticModeration",e[e.WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId=220001]="WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId",e[e.WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId=220002]="WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId",e[e.WebhooksCanOnlyCreateThreadsInForumChannels=220003]="WebhooksCanOnlyCreateThreadsInForumChannels",e[e.WebhookServicesCannotBeUsedInForumChannels=220004]="WebhookServicesCannotBeUsedInForumChannels",e[e.MessageBlockedByHarmfulLinksFilter=24e4]="MessageBlockedByHarmfulLinksFilter"})(ks=L.RESTJSONErrorCodes||(L.RESTJSONErrorCodes={}));var Us;(function(e){e.Indonesian="id",e.EnglishUS="en-US",e.EnglishGB="en-GB",e.Bulgarian="bg",e.ChineseCN="zh-CN",e.ChineseTW="zh-TW",e.Croatian="hr",e.Czech="cs",e.Danish="da",e.Dutch="nl",e.Finnish="fi",e.French="fr",e.German="de",e.Greek="el",e.Hindi="hi",e.Hungarian="hu",e.Italian="it",e.Japanese="ja",e.Korean="ko",e.Lithuanian="lt",e.Norwegian="no",e.Polish="pl",e.PortugueseBR="pt-BR",e.Romanian="ro",e.Russian="ru",e.SpanishES="es-ES",e.Swedish="sv-SE",e.Thai="th",e.Turkish="tr",e.Ukrainian="uk",e.Vietnamese="vi"})(Us=L.Locale||(L.Locale={}))});var en=a(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0})});var nn=a(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0})});var rn=a(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0})});var on=a(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0})});var cn=a(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0})});var dn=a(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0})});var mn=a(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0})});var pn=a(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0})});var vn=a(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0})});var _n=a(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0})});var Mn=a(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0})});var Pn=a(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0})});var kn=a(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0})});var Dn=a(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0})});var wn=a(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0})});var qn=a($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0})});var Wn=a(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0})});var xn=a(c=>{"use strict";var Ds=c&&c.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),_=c&&c.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&Ds(n,e,t)};Object.defineProperty(c,"__esModule",{value:!0});c.OAuth2Routes=c.RouteBases=c.ImageFormat=c.CDNRoutes=c.StickerPackApplicationId=c.Routes=c.APIVersion=void 0;_(St(),c);_(en(),c);_(nn(),c);_(rn(),c);_(on(),c);_(cn(),c);_(dn(),c);_(mn(),c);_(pn(),c);_(vn(),c);_(_n(),c);_(Mn(),c);_(Pn(),c);_(kn(),c);_(Dn(),c);_(wn(),c);_(qn(),c);_(Wn(),c);c.APIVersion="10";c.Routes={applicationRoleConnectionMetadata(e){return`/applications/${e}/role-connections/metadata`},guildAutoModerationRules(e){return`/guilds/${e}/auto-moderation/rules`},guildAutoModerationRule(e,n){return`/guilds/${e}/auto-moderation/rules/${n}`},guildAuditLog(e){return`/guilds/${e}/audit-logs`},channel(e){return`/channels/${e}`},channelMessages(e){return`/channels/${e}/messages`},channelMessage(e,n){return`/channels/${e}/messages/${n}`},channelMessageCrosspost(e,n){return`/channels/${e}/messages/${n}/crosspost`},channelMessageOwnReaction(e,n,t){return`/channels/${e}/messages/${n}/reactions/${t}/@me`},channelMessageUserReaction(e,n,t,i){return`/channels/${e}/messages/${n}/reactions/${t}/${i}`},channelMessageReaction(e,n,t){return`/channels/${e}/messages/${n}/reactions/${t}`},channelMessageAllReactions(e,n){return`/channels/${e}/messages/${n}/reactions`},channelBulkDelete(e){return`/channels/${e}/messages/bulk-delete`},channelPermission(e,n){return`/channels/${e}/permissions/${n}`},channelInvites(e){return`/channels/${e}/invites`},channelFollowers(e){return`/channels/${e}/followers`},channelTyping(e){return`/channels/${e}/typing`},channelPins(e){return`/channels/${e}/pins`},channelPin(e,n){return`/channels/${e}/pins/${n}`},channelRecipient(e,n){return`/channels/${e}/recipients/${n}`},guildEmojis(e){return`/guilds/${e}/emojis`},guildEmoji(e,n){return`/guilds/${e}/emojis/${n}`},guilds(){return"/guilds"},guild(e){return`/guilds/${e}`},guildPreview(e){return`/guilds/${e}/preview`},guildChannels(e){return`/guilds/${e}/channels`},guildMember(e,n="@me"){return`/guilds/${e}/members/${n}`},guildMembers(e){return`/guilds/${e}/members`},guildMembersSearch(e){return`/guilds/${e}/members/search`},guildCurrentMemberNickname(e){return`/guilds/${e}/members/@me/nick`},guildMemberRole(e,n,t){return`/guilds/${e}/members/${n}/roles/${t}`},guildMFA(e){return`/guilds/${e}/mfa`},guildBans(e){return`/guilds/${e}/bans`},guildBan(e,n){return`/guilds/${e}/bans/${n}`},guildRoles(e){return`/guilds/${e}/roles`},guildRole(e,n){return`/guilds/${e}/roles/${n}`},guildPrune(e){return`/guilds/${e}/prune`},guildVoiceRegions(e){return`/guilds/${e}/regions`},guildInvites(e){return`/guilds/${e}/invites`},guildIntegrations(e){return`/guilds/${e}/integrations`},guildIntegration(e,n){return`/guilds/${e}/integrations/${n}`},guildWidgetSettings(e){return`/guilds/${e}/widget`},guildWidgetJSON(e){return`/guilds/${e}/widget.json`},guildVanityUrl(e){return`/guilds/${e}/vanity-url`},guildWidgetImage(e){return`/guilds/${e}/widget.png`},invite(e){return`/invites/${e}`},template(e){return`/guilds/templates/${e}`},guildTemplates(e){return`/guilds/${e}/templates`},guildTemplate(e,n){return`/guilds/${e}/templates/${n}`},threads(e,n){let t=["","channels",e];return n&&t.push("messages",n),t.push("threads"),t.join("/")},guildActiveThreads(e){return`/guilds/${e}/threads/active`},channelThreads(e,n){return`/channels/${e}/threads/archived/${n}`},channelJoinedArchivedThreads(e){return`/channels/${e}/users/@me/threads/archived/private`},threadMembers(e,n){let t=["","channels",e,"thread-members"];return n&&t.push(n),t.join("/")},user(e="@me"){return`/users/${e}`},userApplicationRoleConnection(e){return`/users/@me/applications/${e}/role-connection`},userGuilds(){return"/users/@me/guilds"},userGuildMember(e){return`/users/@me/guilds/${e}/member`},userGuild(e){return`/users/@me/guilds/${e}`},userChannels(){return"/users/@me/channels"},userConnections(){return"/users/@me/connections"},voiceRegions(){return"/voice/regions"},channelWebhooks(e){return`/channels/${e}/webhooks`},guildWebhooks(e){return`/guilds/${e}/webhooks`},webhook(e,n){let t=["","webhooks",e];return n&&t.push(n),t.join("/")},webhookMessage(e,n,t="@original"){return`/webhooks/${e}/${n}/messages/${t}`},webhookPlatform(e,n,t){return`/webhooks/${e}/${n}/${t}`},gateway(){return"/gateway"},gatewayBot(){return"/gateway/bot"},oauth2CurrentApplication(){return"/oauth2/applications/@me"},oauth2CurrentAuthorization(){return"/oauth2/@me"},oauth2Authorization(){return"/oauth2/authorize"},oauth2TokenExchange(){return"/oauth2/token"},oauth2TokenRevocation(){return"/oauth2/token/revoke"},applicationCommands(e){return`/applications/${e}/commands`},applicationCommand(e,n){return`/applications/${e}/commands/${n}`},applicationGuildCommands(e,n){return`/applications/${e}/guilds/${n}/commands`},applicationGuildCommand(e,n,t){return`/applications/${e}/guilds/${n}/commands/${t}`},interactionCallback(e,n){return`/interactions/${e}/${n}/callback`},guildMemberVerification(e){return`/guilds/${e}/member-verification`},guildVoiceState(e,n="@me"){return`/guilds/${e}/voice-states/${n}`},guildApplicationCommandsPermissions(e,n){return`/applications/${e}/guilds/${n}/commands/permissions`},applicationCommandPermissions(e,n,t){return`/applications/${e}/guilds/${n}/commands/${t}/permissions`},guildWelcomeScreen(e){return`/guilds/${e}/welcome-screen`},stageInstances(){return"/stage-instances"},stageInstance(e){return`/stage-instances/${e}`},sticker(e){return`/stickers/${e}`},nitroStickerPacks(){return"/sticker-packs"},guildStickers(e){return`/guilds/${e}/stickers`},guildSticker(e,n){return`/guilds/${e}/stickers/${n}`},guildScheduledEvents(e){return`/guilds/${e}/scheduled-events`},guildScheduledEvent(e,n){return`/guilds/${e}/scheduled-events/${n}`},guildScheduledEventUsers(e,n){return`/guilds/${e}/scheduled-events/${n}/users`}};c.StickerPackApplicationId="710982414301790216";c.CDNRoutes={emoji(e,n){return`/emojis/${e}.${n}`},guildIcon(e,n,t){return`icons/${e}/${n}.${t}`},guildSplash(e,n,t){return`/splashes/${e}/${n}.${t}`},guildDiscoverySplash(e,n,t){return`/discovery-splashes/${e}/${n}.${t}`},guildBanner(e,n,t){return`/banners/${e}/${n}.${t}`},userBanner(e,n,t){return`/banners/${e}/${n}.${t}`},defaultUserAvatar(e){return`/embed/avatars/${e}.png`},userAvatar(e,n,t){return`/avatars/${e}/${n}.${t}`},guildMemberAvatar(e,n,t,i){return`/guilds/${e}/users/${n}/avatars/${t}.${i}`},applicationIcon(e,n,t){return`/app-icons/${e}/${n}.${t}`},applicationCover(e,n,t){return`/app-icons/${e}/${n}.${t}`},applicationAsset(e,n,t){return`/app-icons/${e}/${n}.${t}`},achievementIcon(e,n,t,i){return`/app-assets/${e}/achievements/${n}/icons/${t}.${i}`},stickerPackBanner(e,n){return`/app-assets/${c.StickerPackApplicationId}/store/${e}.${n}`},teamIcon(e,n,t){return`/team-icons/${e}/${n}.${t}`},sticker(e,n){return`/stickers/${e}.${n}`},roleIcon(e,n,t){return`/role-icons/${e}/${n}.${t}`},guildScheduledEventCover(e,n,t){return`/guild-events/${e}/${n}.${t}`},guildMemberBanner(e,n,t,i){return`/guilds/${e}/users/${n}/banners/${t}.${i}`}};var Bs;(function(e){e.JPEG="jpeg",e.PNG="png",e.WebP="webp",e.GIF="gif",e.Lottie="json"})(Bs=c.ImageFormat||(c.ImageFormat={}));c.RouteBases={api:`https://discord.com/api/v${c.APIVersion}`,cdn:"https://cdn.discordapp.com",invite:"https://discord.gg",template:"https://discord.new",gift:"https://discord.gift",scheduledEvent:"https://discord.com/events"};Object.freeze(c.RouteBases);c.OAuth2Routes={authorizationURL:`${c.RouteBases.api}${c.Routes.oauth2Authorization()}`,tokenURL:`${c.RouteBases.api}${c.Routes.oauth2TokenExchange()}`,tokenRevocationURL:`${c.RouteBases.api}${c.Routes.oauth2TokenRevocation()}`};Object.freeze(c.OAuth2Routes)});var jn=a(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.RPCCloseEventCodes=V.RPCErrorCodes=void 0;var ws;(function(e){e[e.UnknownError=1e3]="UnknownError",e[e.InvalidPayload=4e3]="InvalidPayload",e[e.InvalidCommand=4002]="InvalidCommand",e[e.InvalidGuild=4003]="InvalidGuild",e[e.InvalidEvent=4004]="InvalidEvent",e[e.InvalidChannel=4005]="InvalidChannel",e[e.InvalidPermissions=4006]="InvalidPermissions",e[e.InvalidClientId=4007]="InvalidClientId",e[e.InvalidOrigin=4008]="InvalidOrigin",e[e.InvalidToken=4009]="InvalidToken",e[e.InvalidUser=4010]="InvalidUser",e[e.OAuth2Error=5e3]="OAuth2Error",e[e.SelectChannelTimedOut=5001]="SelectChannelTimedOut",e[e.GetGuildTimedOut=5002]="GetGuildTimedOut",e[e.SelectVoiceForceRequired=5003]="SelectVoiceForceRequired",e[e.CaptureShortcutAlreadyListening=5004]="CaptureShortcutAlreadyListening"})(ws=V.RPCErrorCodes||(V.RPCErrorCodes={}));var $s;(function(e){e[e.InvalidClientId=4e3]="InvalidClientId",e[e.InvalidOrigin=4001]="InvalidOrigin",e[e.RateLimited=4002]="RateLimited",e[e.TokenRevoked=4003]="TokenRevoked",e[e.InvalidVersion=4004]="InvalidVersion",e[e.InvalidEncoding=4005]="InvalidEncoding"})($s=V.RPCCloseEventCodes||(V.RPCCloseEventCodes={}))});var Hn=a(Y=>{"use strict";var qs=Y&&Y.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),Gs=Y&&Y.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&qs(n,e,t)};Object.defineProperty(Y,"__esModule",{value:!0});Gs(jn(),Y)});var Ln=a(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.isContextMenuApplicationCommandInteraction=m.isChatInputApplicationCommandInteraction=m.isMessageComponentSelectMenuInteraction=m.isMessageComponentButtonInteraction=m.isMessageComponentInteraction=m.isInteractionButton=m.isLinkButton=m.isMessageComponentGuildInteraction=m.isMessageComponentDMInteraction=m.isApplicationCommandGuildInteraction=m.isApplicationCommandDMInteraction=m.isGuildInteraction=m.isDMInteraction=void 0;var w=he();function me(e){return Reflect.has(e,"user")}m.isDMInteraction=me;function fe(e){return Reflect.has(e,"guild_id")}m.isGuildInteraction=fe;function Ws(e){return me(e)}m.isApplicationCommandDMInteraction=Ws;function xs(e){return fe(e)}m.isApplicationCommandGuildInteraction=xs;function js(e){return me(e)}m.isMessageComponentDMInteraction=js;function Hs(e){return fe(e)}m.isMessageComponentGuildInteraction=Hs;function Ls(e){return e.style===w.ButtonStyle.Link}m.isLinkButton=Ls;function Vs(e){return e.style!==w.ButtonStyle.Link}m.isInteractionButton=Vs;function Ts(e){return e.type===w.InteractionType.MessageComponent}m.isMessageComponentInteraction=Ts;function Rs(e){return e.data.component_type===w.ComponentType.Button}m.isMessageComponentButtonInteraction=Rs;function Ys(e){return[w.ComponentType.StringSelect,w.ComponentType.UserSelect,w.ComponentType.RoleSelect,w.ComponentType.MentionableSelect,w.ComponentType.ChannelSelect].includes(e.data.component_type)}m.isMessageComponentSelectMenuInteraction=Ys;function zs(e){return e.data.type===w.ApplicationCommandType.ChatInput}m.isChatInputApplicationCommandInteraction=zs;function Fs(e){return e.data.type===w.ApplicationCommandType.Message||e.data.type===w.ApplicationCommandType.User}m.isContextMenuApplicationCommandInteraction=Fs});var Vn=a(D=>{"use strict";var Os=D&&D.__createBinding||(Object.create?function(e,n,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(n,t);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,s)}:function(e,n,t,i){i===void 0&&(i=t),e[i]=n[t]}),S=D&&D.__exportStar||function(e,n){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(n,t)&&Os(n,e,t)};Object.defineProperty(D,"__esModule",{value:!0});D.Utils=void 0;S(Te(),D);S(Re(),D);S(he(),D);S(xn(),D);S(Hn(),D);D.Utils=Ln()});var Yn=a((wa,Rn)=>{"use strict";var Tn=require("events"),M=ke(F()),Cs=je(),Ks=(le(),ie(ce)),Qs=Vn(),Xs=/EAI_AGAIN/,pe=class extends Tn.EventEmitter{constructor(t,i){super();this.heartbeatTimeout=null;this.heartbeatInterval=0;this._trace=null;this.seq=0;this.status="disconnected";this.sessionId=null;this.lastACKAt=0;this.lastHeartbeatSend=0;this.latency=0;this._closing=!1;this.resumeAddress=null;this.reconnecting=!1;this.id=t,this.client=i,this.options=i.options,this.reconnect=this.options.reconnect||!0,this.identifyAddress=this.options.endpoint,this.betterWs=new Cs(this.identifyAddress,this.options.ws),this.betterWs.on("ws_open",()=>{this.status="connecting",this.emit("stateChange","connecting"),this.reconnecting=!1}),this.betterWs.on("ws_receive",s=>this.messageAction(s)),this.betterWs.on("ws_close",(s,o)=>this.handleWsClose(s,o)),this.betterWs.on("debug",s=>this.client.emit("error",s)),this.betterWs.on("ws_send",s=>this.client.emit("rawSend",s))}async connect(){return this._closing=!1,this.client.emit("debug",`Shard ${this.id} connecting to gateway`),this.betterWs.connect().catch(t=>{let i=String(t);Xs.test(i)&&setTimeout(()=>this.connect(),5e3)})}async disconnect(){return this._closing=!0,this.betterWs.close(1e3,"Disconnected by User")}async messageAction(t){this.client.emit("rawReceive",t);let i=Object.assign(t,{shard_id:this.id});switch(this.client.emit("event",i),i.op){case M.GATEWAY_OP_CODES.DISPATCH:this.handleDispatch(i);break;case M.GATEWAY_OP_CODES.HEARTBEAT:this.heartbeat();break;case M.GATEWAY_OP_CODES.RECONNECT:this.client.emit("debug",`Gateway asked shard ${this.id} to reconnect`),this.options.reconnect&&this.betterWs.status!==2?this._reconnect(!0):this.disconnect();break;case M.GATEWAY_OP_CODES.INVALID_SESSION:this.client.emit("debug",`Shard ${this.id}'s session was invalidated`),i.d&&this.sessionId?this.resume():(this.seq=0,this.sessionId="",this.emit("queueIdentify",this.id));break;case M.GATEWAY_OP_CODES.HELLO:this.client.emit("debug",`Shard ${this.id} received HELLO`),this.heartbeat(),this.heartbeatInterval=i.d.heartbeat_interval,this.heartbeatTimeout=setInterval(()=>{this.lastACKAt<=Date.now()-(this.heartbeatInterval+5e3)?(this.client.emit("debug",`Shard ${this.id} has not received a heartbeat ACK in ${this.heartbeatInterval+5e3}ms.`),this.options.reconnect&&this.betterWs.status!==2?this._reconnect(!0):this.disconnect()):this.heartbeat()},this.heartbeatInterval),this._trace=i.d._trace,this.emit("queueIdentify",this.id);break;case M.GATEWAY_OP_CODES.HEARTBEAT_ACK:this.lastACKAt=Date.now(),this.latency=this.lastACKAt-this.lastHeartbeatSend;break;default:}}async _reconnect(t=!1){if(t&&(this.reconnecting=!0),this.betterWs.status===2)return void this.client.emit("error",`Client was attempting to ${t?"resume":"reconnect"} while the WebSocket was still in the connecting state. This should never happen.`);await this.betterWs.close(t?4e3:1012,"reconnecting"),t?(this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress):(this.reset(),this.betterWs.address=this.identifyAddress),this.connect()}reset(){this.sessionId=null,this.seq=0,this.lastACKAt=0,this._trace=null,this.clearHeartBeat()}clearHeartBeat(){this.heartbeatTimeout&&clearInterval(this.heartbeatTimeout),this.heartbeatTimeout=null,this.heartbeatInterval=0}async identify(t){if(this.betterWs.status!==1&&this.client.emit("error","Client was attempting to identify when the ws was not open"),this.sessionId&&!t)return this.resume();this.client.emit("debug",`Shard ${this.id} is identifying`),this.status="identifying",this.emit("stateChange","identifying");let i={op:M.GATEWAY_OP_CODES.IDENTIFY,d:{token:this.options.token,properties:{os:process.platform,browser:"CloudStorm",device:"CloudStorm"},large_threshold:this.options.largeGuildThreshold,shard:[this.id,this.options.totalShards||1],intents:this.options.intents?Ks.resolve(this.options.intents):0}};return this.options.initialPresence&&Object.assign(i.d,{presence:this._checkPresenceData(this.options.initialPresence)}),this.betterWs.sendMessage(i)}async resume(){return this.betterWs.status!==1?void this.client.emit("error","Client was attempting to resume when the ws was not open"):(this.client.emit("debug",`Shard ${this.id} is resuming`),this.status="resuming",this.emit("stateChange","resuming"),this.betterWs.sendMessage({op:M.GATEWAY_OP_CODES.RESUME,d:{seq:this.seq,token:this.options.token,session_id:this.sessionId}}))}heartbeat(){this.betterWs.status===1&&(this.betterWs.sendMessage({op:M.GATEWAY_OP_CODES.HEARTBEAT,d:this.seq}),this.lastHeartbeatSend=Date.now())}handleDispatch(t){var i,s;switch(this.client.emit("dispatch",t),t.s&&(t.s>this.seq+1&&(this.client.emit("debug",`Shard ${this.id} invalid sequence: { current: ${this.seq} message: ${t.s} }`),this.seq=t.s,this.resume()),this.seq=t.s),t.t){case"READY":case"RESUMED":t.t==="READY"&&(t.d.resume_gateway_url&&(this.resumeAddress=`${t.d.resume_gateway_url}?v=${M.GATEWAY_VERSION}&encoding=${((i=this.options.ws)==null?void 0:i.encoding)==="etf"?"etf":"json"}${(s=this.options.ws)!=null&&s.compress?"&compress=zlib-stream":""}`),this.sessionId=t.d.session_id),this.status="ready",this.emit("stateChange","ready"),this._trace=t.d._trace,this.emit("ready",t.t==="RESUMED");break;default:}}handleWsClose(t,i){let s=!1;this.status="disconnected",this.emit("stateChange","disconnected"),t===4014&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Disallowed Intents, check your client options and application page.")),t===4013&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid Intents data, check your client options.")),t===4012&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid API version.")),t===4011&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Shard would be on over 2500 guilds. Add more shards.")),t===4010&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Invalid sharding data, check your client options.")),t===4009&&(this.client.emit("error","Session timed out."),this.clearHeartBeat(),this.betterWs.address=this.identifyAddress,this.connect()),t===4008&&(this.client.emit("error","You are being rate limited. Wait before sending more packets."),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),t===4007&&(this.client.emit("error","Invalid sequence. Reconnecting and starting a new session."),this.reset(),this.betterWs.address=this.identifyAddress,this.connect()),t===4005&&(this.client.emit("error","You sent more than one OP 2 IDENTIFY payload while the websocket was open."),this.clearHeartBeat(),this.resumeAddress&&(this.betterWs.address=this.resumeAddress),this.connect()),t===4004&&(this.betterWs.address=this.identifyAddress,this.client.emit("error","Tried to connect with an invalid token")),t===4003&&(this.client.emit("error","You tried to send a packet before sending an OP 2 IDENTIFY or OP 6 RESUME."),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),t===4002&&(this.client.emit("error","You sent an invalid payload"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),t===4001&&(this.client.emit("error","You sent an invalid opcode or invalid payload for an opcode"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect()),t===4e3&&(this.reconnecting?s=!0:(this.client.emit("error","Error code 4000 received. Attempting to resume"),this.clearHeartBeat(),this.resumeAddress?this.betterWs.address=this.resumeAddress:this.betterWs.address=this.identifyAddress,this.connect())),t===1e3&&this._closing&&(s=!0),this._closing=!1,s&&this.clearHeartBeat(),this.emit("disconnect",t,i,s)}async presenceUpdate(t){return this.betterWs.sendMessage({op:M.GATEWAY_OP_CODES.PRESENCE_UPDATE,d:this._checkPresenceData(t)})}async voiceStateUpdate(t){return t?this.betterWs.sendMessage({op:M.GATEWAY_OP_CODES.VOICE_STATE_UPDATE,d:this._checkVoiceStateUpdateData(t)}):Promise.resolve()}async requestGuildMembers(t){return this.betterWs.sendMessage({op:M.GATEWAY_OP_CODES.REQUEST_GUILD_MEMBERS,d:this._checkRequestGuildMembersData(t)})}_checkPresenceData(t){if(t.status=t.status||Qs.PresenceUpdateStatus.Online,t.activities=t.activities&&Array.isArray(t.activities)?t.activities:[],t.activities)for(let i of t.activities){let s=t.activities.indexOf(i);i.type===void 0&&(i.type=i.url?1:0),i.name||t.activities.splice(s,1)}return t.afk=t.afk||!1,t.since=t.since||Date.now(),t}_checkVoiceStateUpdateData(t){return t.channel_id=t.channel_id||null,t.self_mute=t.self_mute||!1,t.self_deaf=t.self_deaf||!1,t}_checkRequestGuildMembersData(t){let i=t,s=t;return!i.query&&!s.user_ids&&(i.query=""),i.query&&s.user_ids&&delete t.query,t.limit=t.limit||10,t}},ne=pe;ne.default=pe;Rn.exports=ne});var ve=a(($a,Fn)=>{"use strict";var zn=require("events"),Zs=Yn(),be=class extends zn.EventEmitter{constructor(t,i){super();this.id=t,this.client=i,this.ready=!1,this.connector=new Zs(t,i),this.connector.on("disconnect",(...s)=>{this.ready=!1,this.emit("disconnect",...s)}),this.connector.on("ready",s=>this.emit("ready",s)),this.connector.on("queueIdentify",()=>this.emit("queueIdentify",this.id))}get latency(){return this.connector.latency}connect(){this.connector.connect()}disconnect(){return this.connector.disconnect()}presenceUpdate(t){return this.connector.presenceUpdate(t)}voiceStateUpdate(t){return this.connector.voiceStateUpdate(t)}requestGuildMembers(t){return this.connector.requestGuildMembers(t)}};Fn.exports=be});var _e=a((qa,On)=>{"use strict";var Ns=ve(),Es=ee(),ge=class{constructor(n){this.concurrencyBucket=null;this.client=n,this.options=n.options,this.shards={},this.identifyBucket=new Es(1e3,1e3*60*60*24,1e3*60*60*24)}spawn(){if(!this.concurrencyBucket)throw new Error("Trying to spawn shards without calling Client.connect()");for(let n of this.options.shards==="auto"?Array(this.options.totalShards).fill(0).map((t,i)=>i):this.options.shards||[0])this.client.emit("debug",`Spawned shard ${n}`),this.shards[n]=new Ns(n,this.client),this._addListener(this.shards[n]),this.shards[n].connector.connect()}disconnect(){for(let n in this.shards)this.shards[n].disconnect()}_addListener(n){n.on("ready",t=>{n.ready=!0,this.client.emit("debug",`Shard ${n.id} ${t?"has resumed":"is ready"}`),this.client.emit("shardReady",{id:n.id,ready:!t}),this._checkReady()}),n.on("queueIdentify",t=>{var i;if(!this.shards[t])return this.client.emit("debug",`Received a queueIdentify event for shard ${t} but it does not exist. Was it removed?`);if(this.client.emit("debug",`Shard ${t} is ready to identify`),n.connector.reconnecting)return n.connector.resume();(i=this.concurrencyBucket)==null||i.queue(()=>{this.identifyBucket.queue(()=>this.shards[t].connector.identify())})}),n.on("disconnect",(t,i,s)=>{if(this.client.emit("debug",`Websocket of shard ${n.id} closed with code ${t} and reason: ${i||"None"}`),t===1e3&&s)return this._checkDisconnect()})}_checkReady(){for(let n in this.shards)if(this.shards[n]&&!this.shards[n].ready)return;this.client.emit("ready")}_checkDisconnect(){for(let n in this.shards)if(this.shards[n]&&this.shards[n].connector.status!=="disconnected")return;this.client.emit("disconnected")}async presenceUpdate(n){for(let t in this.shards)if(this.shards[t]){let i=this.shards[t];this.shardPresenceUpdate(i.id,n)}}shardPresenceUpdate(n,t){return new Promise((i,s)=>{let o=this.shards[n];o||s(new Error(`Shard ${n} does not exist`)),o.ready||o.once("ready",()=>o.presenceUpdate(t).then(r=>i(r)).catch(r=>s(r))),o.presenceUpdate(t).then(r=>i(r)).catch(r=>s(r))})}voiceStateUpdate(n,t){return new Promise((i,s)=>{let o=this.shards[n];o||s(new Error(`Shard ${n} does not exist`)),o.ready||o.once("ready",()=>o.voiceStateUpdate(t).then(r=>i(r)).catch(r=>s(r))),o.voiceStateUpdate(t).then(r=>i(r)).catch(r=>s(r))})}requestGuildMembers(n,t){return new Promise((i,s)=>{let o=this.shards[n];o||s(new Error(`Shard ${n} does not exist`)),o.ready||o.once("ready",()=>o.requestGuildMembers(t).then(r=>i(r)).catch(r=>s(r))),o.requestGuildMembers(t).then(r=>i(r)).catch(r=>s(r))})}};On.exports=ge});var Xn=a((Ga,Qn)=>{"use strict";var Cn=require("events"),Kn=require("snowtransfer"),Ss=Ue().version,Js=F(),er=_e(),tr=ee(),Ie=class extends Cn.EventEmitter{constructor(t,i={}){super();if(!t)throw new Error("Missing token!");this.options={largeGuildThreshold:250,shards:"auto",reconnect:!0,intents:0,token:"",ws:{compress:!0,encoding:"json"}},this._restClient=i.snowtransferInstance?i.snowtransferInstance:new Kn.SnowTransfer(t),delete i.snowtransferInstance,this.token=t.startsWith("Bot ")?t.substring(4):t,Object.assign(this.options,i),this.options.token=t,this.shardManager=new er(this),this.version=Ss}async connect(){let t=await this.fetchConnectInfo();this.options.shards==="auto"&&(this.options.totalShards=t),this.shardManager.spawn()}async fetchConnectInfo(){let t=await this.getGatewayBot();this._updateEndpoint(t.url);let i=[],s=[];this.shardManager.concurrencyBucket&&this.shardManager.concurrencyBucket.fnQueue.length&&(i.push(...this.shardManager.concurrencyBucket.fnQueue.map(o=>[o.fn,o.callback])),this.shardManager.concurrencyBucket.dropQueue()),this.shardManager.identifyBucket.fnQueue.length&&s.push(...this.shardManager.identifyBucket.fnQueue.map(o=>[o.fn,o.callback])),this.shardManager.identifyBucket.dropQueue(),this.shardManager.concurrencyBucket=new tr(t.session_start_limit.max_concurrency,5e3),this.shardManager.identifyBucket.remaining=t.session_start_limit.remaining,this.shardManager.identifyBucket.limitReset=t.session_start_limit.reset_after;for(let[o,r]of i)this.shardManager.concurrencyBucket.queue(o).then(r);for(let[o,r]of s)this.shardManager.identifyBucket.queue(o).then(r);return t.shards}async getGateway(){return(await this._restClient.bot.getGateway()).url}async getGatewayBot(){return this._restClient.bot.getGatewayBot()}disconnect(){return this.shardManager.disconnect()}async presenceUpdate(t){return this.shardManager.presenceUpdate(t)}shardStatusUpdate(t,i){return this.shardManager.shardPresenceUpdate(t,i)}voiceStateUpdate(t,i){return this.shardManager.voiceStateUpdate(t,i)}requestGuildMembers(t,i){if(!i.guild_id)throw new Error("You need to pass a guild_id");return this.shardManager.requestGuildMembers(t,i)}_updateEndpoint(t){var i,s;this.options.endpoint=`${t}?v=${Js.GATEWAY_VERSION}&encoding=${((i=this.options.ws)==null?void 0:i.encoding)==="etf"?"etf":"json"}${(s=this.options.ws)!=null&&s.compress?"&compress=zlib-stream":""}`}};Qn.exports=Ie});var or={};Pe(or,{Client:()=>nr,Constants:()=>ir,Intents:()=>sr,Shard:()=>rr,ShardManager:()=>ar});module.exports=ie(or);var nr=Xn(),ir=F(),sr=(le(),ie(ce)),rr=ve(),ar=_e();0&&(module.exports={Client,Constants,Intents,Shard,ShardManager});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|