disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.4f98e3d
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/README.md +5 -9
- package/dist/lib/Client.d.ts +116 -126
- package/dist/lib/Client.js +360 -267
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +194 -170
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +6 -6
- package/dist/lib/rest/Endpoints.js +13 -13
- package/dist/lib/rest/RequestManager.d.ts +1 -1
- package/dist/lib/rest/RequestManager.js +1 -1
- package/dist/lib/rest/index.d.ts +0 -1
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +5 -0
- package/dist/lib/transformers/Applications.js +97 -0
- package/dist/lib/transformers/AuditLogs.d.ts +7 -0
- package/dist/lib/transformers/AuditLogs.js +97 -0
- package/dist/lib/transformers/AutoModeration.d.ts +9 -0
- package/dist/lib/transformers/AutoModeration.js +76 -0
- package/dist/lib/transformers/Channels.d.ts +16 -0
- package/dist/lib/transformers/Channels.js +676 -0
- package/dist/lib/transformers/Emojis.d.ts +5 -0
- package/dist/lib/transformers/Emojis.js +31 -0
- package/dist/lib/transformers/Entitlements.d.ts +7 -0
- package/dist/lib/transformers/Entitlements.js +58 -0
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
- package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
- package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
- package/dist/lib/transformers/GuildTemplates.js +38 -0
- package/dist/lib/transformers/Guilds.d.ts +12 -0
- package/dist/lib/transformers/Guilds.js +264 -0
- package/dist/lib/transformers/Interactions.d.ts +10 -0
- package/dist/lib/transformers/Interactions.js +273 -0
- package/dist/lib/transformers/Invites.d.ts +5 -0
- package/dist/lib/transformers/Invites.js +79 -0
- package/dist/lib/transformers/Polls.d.ts +5 -0
- package/dist/lib/transformers/Polls.js +50 -0
- package/dist/lib/transformers/Presences.d.ts +5 -0
- package/dist/lib/transformers/Presences.js +116 -0
- package/dist/lib/transformers/Roles.d.ts +5 -0
- package/dist/lib/transformers/Roles.js +56 -0
- package/dist/lib/transformers/SKUs.d.ts +5 -0
- package/dist/lib/transformers/SKUs.js +26 -0
- package/dist/lib/transformers/StageInstances.d.ts +5 -0
- package/dist/lib/transformers/StageInstances.js +28 -0
- package/dist/lib/transformers/Stickers.d.ts +5 -0
- package/dist/lib/transformers/Stickers.js +41 -0
- package/dist/lib/transformers/Teams.d.ts +5 -0
- package/dist/lib/transformers/Teams.js +35 -0
- package/dist/lib/transformers/Users.d.ts +5 -0
- package/dist/lib/transformers/Users.js +62 -0
- package/dist/lib/transformers/Voice.d.ts +5 -0
- package/dist/lib/transformers/Voice.js +45 -0
- package/dist/lib/transformers/Webhooks.d.ts +5 -0
- package/dist/lib/transformers/Webhooks.js +51 -0
- package/dist/lib/transformers/index.d.ts +23 -0
- package/dist/lib/transformers/index.js +39 -0
- package/dist/lib/types/entitlements.d.ts +0 -6
- package/dist/lib/types/gateway-events.d.ts +21 -8
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/CDN.d.ts +24 -0
- package/dist/lib/utils/CDN.js +49 -0
- package/dist/lib/utils/errors.d.ts +3 -3
- package/dist/lib/utils/errors.js +10 -12
- package/dist/lib/utils/formatters.d.ts +16 -0
- package/dist/lib/utils/formatters.js +44 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +15 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/lib/rest/CDN.d.ts +0 -22
- package/dist/lib/rest/CDN.js +0 -45
- package/dist/lib/types/voice-connections.d.ts +0 -64
- package/dist/lib/types/voice-connections.js +0 -2
- package/dist/lib/utils/Util.d.ts +0 -94
- package/dist/lib/utils/Util.js +0 -2228
- package/dist/lib/voice/VoiceConnection.d.ts +0 -57
- package/dist/lib/voice/VoiceConnection.js +0 -150
- package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
- package/dist/lib/voice/VoiceConnectionManager.js +0 -66
- package/dist/lib/voice/index.d.ts +0 -2
- package/dist/lib/voice/index.js +0 -18
@@ -1,57 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import WebSocket from "ws";
|
3
|
-
import type { snowflake } from "../types/common";
|
4
|
-
import EventEmitter from "node:events";
|
5
|
-
import type { ResumeConnectionPayload, SelectProtocolPayload, SessionDescriptionPayload, VoiceIdentifyPayload, VoiceReadyPayload } from "../types/voice-connections";
|
6
|
-
export declare class VoiceConnection extends EventEmitter {
|
7
|
-
ws: WebSocket;
|
8
|
-
endpoint: string;
|
9
|
-
serverID: snowflake;
|
10
|
-
userID: snowflake;
|
11
|
-
sessionID: string;
|
12
|
-
token: string;
|
13
|
-
private heartbeatInterval;
|
14
|
-
ssrc: number;
|
15
|
-
constructor(endpoint: string, options: VoiceIdentifyPayload);
|
16
|
-
/** https://discord.com/developers/docs/topics/voice-connections#connecting-to-voice */
|
17
|
-
connect(): void;
|
18
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
19
|
-
disconnect(): void;
|
20
|
-
/** https://discord.com/developers/docs/topics/voice-connections#heartbeating */
|
21
|
-
heartbeat(): void;
|
22
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload */
|
23
|
-
identify(options: VoiceIdentifyPayload): void;
|
24
|
-
private onWebSocketOpen;
|
25
|
-
private onWebSocketMessage;
|
26
|
-
private onWebSocketError;
|
27
|
-
private onWebSocketClose;
|
28
|
-
/** https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection */
|
29
|
-
resume(options: ResumeConnectionPayload): void;
|
30
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection */
|
31
|
-
selectProtocol(options: SelectProtocolPayload): void;
|
32
|
-
/** https://discord.com/developers/docs/topics/voice-connections#speaking */
|
33
|
-
speaking(speaking: number): void;
|
34
|
-
}
|
35
|
-
export declare interface VoiceConnection extends EventEmitter {
|
36
|
-
addListener<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
37
|
-
emit<K extends keyof VoiceConnectionEvents>(eventName: K, ...args: VoiceConnectionEvents[K]): boolean;
|
38
|
-
listenerCount(eventName: keyof VoiceConnectionEvents): number;
|
39
|
-
listeners(eventName: keyof VoiceConnectionEvents): Array<Function>;
|
40
|
-
off<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
41
|
-
on<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
42
|
-
once<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
43
|
-
prependListener<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
44
|
-
prependOnceListener<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
45
|
-
rawListeners(eventName: keyof VoiceConnectionEvents): Array<Function>;
|
46
|
-
removeAllListeners(event?: keyof VoiceConnectionEvents): this;
|
47
|
-
removeListener<K extends keyof VoiceConnectionEvents>(eventName: K, listener: (...args: VoiceConnectionEvents[K]) => void): this;
|
48
|
-
}
|
49
|
-
export interface VoiceConnectionEvents {
|
50
|
-
ready: [voiceServer: VoiceReadyPayload];
|
51
|
-
sessionDescription: [session: SessionDescriptionPayload];
|
52
|
-
speaking: [speaking: number];
|
53
|
-
heartbeatACK: [heartbeat: number];
|
54
|
-
hello: [];
|
55
|
-
resumed: [];
|
56
|
-
clientDisconnect: [];
|
57
|
-
}
|
@@ -1,150 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.VoiceConnection = void 0;
|
7
|
-
const ws_1 = __importDefault(require("ws"));
|
8
|
-
const constants_1 = require("../constants");
|
9
|
-
const utils_1 = require("../utils");
|
10
|
-
const node_events_1 = __importDefault(require("node:events"));
|
11
|
-
class VoiceConnection extends node_events_1.default {
|
12
|
-
ws;
|
13
|
-
endpoint;
|
14
|
-
serverID;
|
15
|
-
userID;
|
16
|
-
sessionID;
|
17
|
-
token;
|
18
|
-
heartbeatInterval;
|
19
|
-
ssrc;
|
20
|
-
constructor(endpoint, options) {
|
21
|
-
super();
|
22
|
-
this.ws = new ws_1.default(`wss://${endpoint}?v=4`);
|
23
|
-
this.endpoint = endpoint;
|
24
|
-
this.serverID = options.serverID;
|
25
|
-
this.userID = options.userID;
|
26
|
-
this.sessionID = options.sessionID;
|
27
|
-
this.token = options.token;
|
28
|
-
}
|
29
|
-
/** https://discord.com/developers/docs/topics/voice-connections#connecting-to-voice */
|
30
|
-
connect() {
|
31
|
-
this.ws.on("open", () => this.onWebSocketOpen());
|
32
|
-
this.ws.on("message", (data) => this.onWebSocketMessage(data));
|
33
|
-
this.ws.on("error", (err) => this.onWebSocketError(err));
|
34
|
-
this.ws.on("close", (code, reason) => this.onWebSocketClose(code, reason));
|
35
|
-
}
|
36
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
37
|
-
disconnect() {
|
38
|
-
if (this.heartbeatInterval) {
|
39
|
-
clearInterval(this.heartbeatInterval);
|
40
|
-
this.heartbeatInterval = null;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
/** https://discord.com/developers/docs/topics/voice-connections#heartbeating */
|
44
|
-
heartbeat() {
|
45
|
-
this.ws.send(JSON.stringify({
|
46
|
-
op: constants_1.VoiceOPCodes.Heartbeat,
|
47
|
-
d: Date.now(),
|
48
|
-
}));
|
49
|
-
}
|
50
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload */
|
51
|
-
identify(options) {
|
52
|
-
this.ws.send(JSON.stringify({
|
53
|
-
op: constants_1.VoiceOPCodes.Identify,
|
54
|
-
d: {
|
55
|
-
server_id: options.serverID,
|
56
|
-
user_id: options.userID,
|
57
|
-
session_id: options.sessionID,
|
58
|
-
token: options.token,
|
59
|
-
},
|
60
|
-
}));
|
61
|
-
}
|
62
|
-
onWebSocketOpen() {
|
63
|
-
this.identify({
|
64
|
-
serverID: this.serverID,
|
65
|
-
userID: this.userID,
|
66
|
-
sessionID: this.sessionID,
|
67
|
-
token: this.token,
|
68
|
-
});
|
69
|
-
}
|
70
|
-
onWebSocketMessage(data) {
|
71
|
-
const packet = JSON.parse(data.toString());
|
72
|
-
switch (packet.op) {
|
73
|
-
case constants_1.VoiceOPCodes.Ready:
|
74
|
-
{
|
75
|
-
this.ssrc = packet.d.ssrc;
|
76
|
-
this.emit("ready", {
|
77
|
-
ssrc: packet.d.ssrc,
|
78
|
-
ip: packet.d.ip,
|
79
|
-
port: packet.d.port,
|
80
|
-
modes: packet.d.modes,
|
81
|
-
});
|
82
|
-
}
|
83
|
-
break;
|
84
|
-
case constants_1.VoiceOPCodes.SessionDescription:
|
85
|
-
this.emit("sessionDescription", {
|
86
|
-
mode: packet.d.mode,
|
87
|
-
secretKey: packet.d.secret_key,
|
88
|
-
});
|
89
|
-
break;
|
90
|
-
case constants_1.VoiceOPCodes.Speaking:
|
91
|
-
this.emit("speaking", packet.d.speaking);
|
92
|
-
break;
|
93
|
-
case constants_1.VoiceOPCodes.HeartbeatACK:
|
94
|
-
this.emit("heartbeatACK", packet.d);
|
95
|
-
break;
|
96
|
-
case constants_1.VoiceOPCodes.Hello:
|
97
|
-
{
|
98
|
-
this.heartbeatInterval = setInterval(() => this.heartbeat(), packet.d.heartbeat_interval);
|
99
|
-
this.emit("hello");
|
100
|
-
}
|
101
|
-
break;
|
102
|
-
case constants_1.VoiceOPCodes.Resumed:
|
103
|
-
this.emit("resumed");
|
104
|
-
break;
|
105
|
-
case constants_1.VoiceOPCodes.ClientDisconnect:
|
106
|
-
this.emit("clientDisconnect");
|
107
|
-
break;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
onWebSocketError(err) {
|
111
|
-
throw err;
|
112
|
-
}
|
113
|
-
onWebSocketClose(code, reason) {
|
114
|
-
if (code === 1000)
|
115
|
-
return;
|
116
|
-
if (code === constants_1.VoiceCloseEventCodes.Disconnect)
|
117
|
-
return this.disconnect();
|
118
|
-
throw new utils_1.GatewayError(`[${code}] ${reason}`);
|
119
|
-
}
|
120
|
-
/** https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection */
|
121
|
-
resume(options) {
|
122
|
-
this.ws.send(JSON.stringify({
|
123
|
-
op: constants_1.VoiceOPCodes.Resume,
|
124
|
-
d: {
|
125
|
-
server_id: options.serverID,
|
126
|
-
session_id: options.sessionID,
|
127
|
-
token: options.token,
|
128
|
-
},
|
129
|
-
}));
|
130
|
-
}
|
131
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection */
|
132
|
-
selectProtocol(options) {
|
133
|
-
this.ws.send(JSON.stringify({
|
134
|
-
op: constants_1.VoiceOPCodes.SelectProtocol,
|
135
|
-
d: options,
|
136
|
-
}));
|
137
|
-
}
|
138
|
-
/** https://discord.com/developers/docs/topics/voice-connections#speaking */
|
139
|
-
speaking(speaking) {
|
140
|
-
this.ws.send(JSON.stringify({
|
141
|
-
op: constants_1.VoiceOPCodes.Speaking,
|
142
|
-
d: {
|
143
|
-
speaking,
|
144
|
-
delay: 0,
|
145
|
-
ssrc: this.ssrc,
|
146
|
-
},
|
147
|
-
}));
|
148
|
-
}
|
149
|
-
}
|
150
|
-
exports.VoiceConnection = VoiceConnection;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import type { snowflake } from "../types/common";
|
2
|
-
import type { ResumeConnectionPayload, SelectProtocolPayload, VoiceIdentifyPayload } from "../types/voice-connections";
|
3
|
-
import { VoiceConnection } from ".";
|
4
|
-
export declare class VoiceConnectionManager extends Map<snowflake, VoiceConnection> {
|
5
|
-
/** https://discord.com/developers/docs/topics/voice-connections#connecting-to-voice */
|
6
|
-
connect(endpoint: string, options: VoiceIdentifyPayload): VoiceConnection;
|
7
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
8
|
-
disconnect(guildID: snowflake): void;
|
9
|
-
/** https://discord.com/developers/docs/topics/voice-connections#heartbeating */
|
10
|
-
heartbeat(guildID: snowflake): void;
|
11
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload */
|
12
|
-
identify(guildID: snowflake, options: VoiceIdentifyPayload): void;
|
13
|
-
/** https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection */
|
14
|
-
resume(guildID: snowflake, options: ResumeConnectionPayload): void;
|
15
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection */
|
16
|
-
selectProtocol(guildID: snowflake, options: SelectProtocolPayload): void;
|
17
|
-
/** https://discord.com/developers/docs/topics/voice-connections#speaking */
|
18
|
-
speaking(guildID: snowflake, speaking: number): void;
|
19
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.VoiceConnectionManager = void 0;
|
4
|
-
const _1 = require(".");
|
5
|
-
class VoiceConnectionManager extends Map {
|
6
|
-
/** https://discord.com/developers/docs/topics/voice-connections#connecting-to-voice */
|
7
|
-
connect(endpoint, options) {
|
8
|
-
let voiceConnection = new _1.VoiceConnection(endpoint, options);
|
9
|
-
if (!this.has(options.serverID)) {
|
10
|
-
this.set(options.serverID, voiceConnection);
|
11
|
-
voiceConnection.connect();
|
12
|
-
}
|
13
|
-
else {
|
14
|
-
this.disconnect(options.serverID);
|
15
|
-
this.set(options.serverID, voiceConnection);
|
16
|
-
}
|
17
|
-
return voiceConnection;
|
18
|
-
}
|
19
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
20
|
-
disconnect(guildID) {
|
21
|
-
if (this.has(guildID)) {
|
22
|
-
this.get(guildID).disconnect();
|
23
|
-
this.delete(guildID);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
/** https://discord.com/developers/docs/topics/voice-connections#heartbeating */
|
27
|
-
heartbeat(guildID) {
|
28
|
-
if (this.has(guildID)) {
|
29
|
-
this.get(guildID).heartbeat();
|
30
|
-
}
|
31
|
-
}
|
32
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload */
|
33
|
-
identify(guildID, options) {
|
34
|
-
if (this.has(guildID)) {
|
35
|
-
this.get(guildID).identify({
|
36
|
-
serverID: options.serverID,
|
37
|
-
userID: options.userID,
|
38
|
-
sessionID: options.sessionID,
|
39
|
-
token: options.token,
|
40
|
-
});
|
41
|
-
}
|
42
|
-
}
|
43
|
-
/** https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection */
|
44
|
-
resume(guildID, options) {
|
45
|
-
if (this.has(guildID)) {
|
46
|
-
this.get(guildID).resume({
|
47
|
-
serverID: options.serverID,
|
48
|
-
sessionID: options.sessionID,
|
49
|
-
token: options.token,
|
50
|
-
});
|
51
|
-
}
|
52
|
-
}
|
53
|
-
/** https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection */
|
54
|
-
selectProtocol(guildID, options) {
|
55
|
-
if (this.has(guildID)) {
|
56
|
-
this.get(guildID).selectProtocol(options);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
/** https://discord.com/developers/docs/topics/voice-connections#speaking */
|
60
|
-
speaking(guildID, speaking) {
|
61
|
-
if (this.has(guildID)) {
|
62
|
-
this.get(guildID).speaking(speaking);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
exports.VoiceConnectionManager = VoiceConnectionManager;
|
package/dist/lib/voice/index.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./VoiceConnection"), exports);
|
18
|
-
__exportStar(require("./VoiceConnectionManager"), exports);
|