disgroove 2.0.0 → 2.1.0-dev.c430b6f
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/lib/Client.d.ts +10 -1
- package/dist/lib/Client.js +193 -179
- package/dist/lib/constants.d.ts +17 -5
- package/dist/lib/constants.js +221 -209
- package/dist/lib/gateway/Shard.js +6 -1
- package/dist/lib/gateway/ShardManager.js +0 -1
- package/dist/lib/gateway/index.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/rest/CDN.js +0 -1
- package/dist/lib/rest/Endpoints.d.ts +4 -2
- package/dist/lib/rest/Endpoints.js +8 -5
- package/dist/lib/rest/RequestManager.d.ts +2 -3
- package/dist/lib/rest/RequestManager.js +17 -18
- package/dist/lib/rest/index.js +0 -1
- package/dist/lib/types/application-command.js +0 -1
- package/dist/lib/types/application-role-connection-metadata.js +0 -1
- package/dist/lib/types/application.js +0 -1
- package/dist/lib/types/audit-log.js +0 -1
- package/dist/lib/types/auto-moderation.js +0 -1
- package/dist/lib/types/channel.d.ts +4 -0
- package/dist/lib/types/channel.js +0 -1
- package/dist/lib/types/emoji.js +0 -1
- package/dist/lib/types/entitlements.js +0 -1
- package/dist/lib/types/gateway-events.d.ts +28 -0
- package/dist/lib/types/gateway-events.js +0 -1
- package/dist/lib/types/guild-scheduled-event.js +0 -1
- package/dist/lib/types/guild-template.js +0 -1
- package/dist/lib/types/guild.js +0 -1
- package/dist/lib/types/index.js +0 -1
- package/dist/lib/types/interaction.d.ts +3 -0
- package/dist/lib/types/interaction.js +0 -1
- package/dist/lib/types/invite.js +0 -1
- package/dist/lib/types/message-components.js +0 -1
- package/dist/lib/types/poll.d.ts +52 -0
- package/dist/lib/types/poll.js +2 -0
- package/dist/lib/types/role.js +0 -1
- package/dist/lib/types/sku.js +0 -1
- package/dist/lib/types/stage-instance.js +0 -1
- package/dist/lib/types/sticker.js +0 -1
- package/dist/lib/types/team.js +0 -1
- package/dist/lib/types/user.js +0 -1
- package/dist/lib/types/voice.js +0 -1
- package/dist/lib/types/webhook.d.ts +3 -0
- package/dist/lib/types/webhook.js +0 -1
- package/dist/lib/utils/Util.js +0 -1
- package/dist/lib/utils/errors.d.ts +1 -1
- package/dist/lib/utils/errors.js +4 -5
- package/dist/lib/utils/index.js +0 -1
- package/dist/package.json +4 -1
- package/package.json +4 -1
- package/dist/lib/Client.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/gateway/Shard.js.map +0 -1
- package/dist/lib/gateway/ShardManager.js.map +0 -1
- package/dist/lib/gateway/ShardsManager.d.ts +0 -6
- package/dist/lib/gateway/ShardsManager.js +0 -14
- package/dist/lib/gateway/ShardsManager.js.map +0 -1
- package/dist/lib/gateway/index.js.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/rest/CDN.js.map +0 -1
- package/dist/lib/rest/Endpoints.js.map +0 -1
- package/dist/lib/rest/REST.d.ts +0 -17
- package/dist/lib/rest/REST.js +0 -35
- package/dist/lib/rest/REST.js.map +0 -1
- package/dist/lib/rest/RequestManager.js.map +0 -1
- package/dist/lib/rest/RequestsManager.d.ts +0 -22
- package/dist/lib/rest/RequestsManager.js +0 -123
- package/dist/lib/rest/RequestsManager.js.map +0 -1
- package/dist/lib/rest/index.js.map +0 -1
- package/dist/lib/structures/Application.d.ts +0 -174
- package/dist/lib/structures/Application.js +0 -328
- package/dist/lib/structures/Application.js.map +0 -1
- package/dist/lib/structures/ApplicationCommand.d.ts +0 -45
- package/dist/lib/structures/ApplicationCommand.js +0 -127
- package/dist/lib/structures/ApplicationCommand.js.map +0 -1
- package/dist/lib/structures/AuditLog.d.ts +0 -19
- package/dist/lib/structures/AuditLog.js +0 -101
- package/dist/lib/structures/AuditLog.js.map +0 -1
- package/dist/lib/structures/AutoModerationRule.d.ts +0 -34
- package/dist/lib/structures/AutoModerationRule.js +0 -96
- package/dist/lib/structures/AutoModerationRule.js.map +0 -1
- package/dist/lib/structures/Base.d.ts +0 -10
- package/dist/lib/structures/Base.js +0 -23
- package/dist/lib/structures/Base.js.map +0 -1
- package/dist/lib/structures/Channel.d.ts +0 -254
- package/dist/lib/structures/Channel.js +0 -592
- package/dist/lib/structures/Channel.js.map +0 -1
- package/dist/lib/structures/ClientApplication.d.ts +0 -150
- package/dist/lib/structures/ClientApplication.js +0 -241
- package/dist/lib/structures/ClientApplication.js.map +0 -1
- package/dist/lib/structures/Emoji.d.ts +0 -26
- package/dist/lib/structures/Emoji.js +0 -75
- package/dist/lib/structures/Emoji.js.map +0 -1
- package/dist/lib/structures/Entitlement.d.ts +0 -24
- package/dist/lib/structures/Entitlement.js +0 -68
- package/dist/lib/structures/Entitlement.js.map +0 -1
- package/dist/lib/structures/Guild.d.ts +0 -474
- package/dist/lib/structures/Guild.js +0 -1141
- package/dist/lib/structures/Guild.js.map +0 -1
- package/dist/lib/structures/GuildMember.d.ts +0 -49
- package/dist/lib/structures/GuildMember.js +0 -146
- package/dist/lib/structures/GuildMember.js.map +0 -1
- package/dist/lib/structures/GuildScheduledEvent.d.ts +0 -49
- package/dist/lib/structures/GuildScheduledEvent.js +0 -118
- package/dist/lib/structures/GuildScheduledEvent.js.map +0 -1
- package/dist/lib/structures/GuildTemplate.d.ts +0 -30
- package/dist/lib/structures/GuildTemplate.js +0 -72
- package/dist/lib/structures/GuildTemplate.js.map +0 -1
- package/dist/lib/structures/IdentifiableBase.d.ts +0 -15
- package/dist/lib/structures/IdentifiableBase.js +0 -25
- package/dist/lib/structures/IdentifiableBase.js.map +0 -1
- package/dist/lib/structures/Integration.d.ts +0 -31
- package/dist/lib/structures/Integration.js +0 -103
- package/dist/lib/structures/Integration.js.map +0 -1
- package/dist/lib/structures/Interaction.d.ts +0 -76
- package/dist/lib/structures/Interaction.js +0 -346
- package/dist/lib/structures/Interaction.js.map +0 -1
- package/dist/lib/structures/Invite.d.ts +0 -26
- package/dist/lib/structures/Invite.js +0 -82
- package/dist/lib/structures/Invite.js.map +0 -1
- package/dist/lib/structures/Message.d.ts +0 -86
- package/dist/lib/structures/Message.js +0 -303
- package/dist/lib/structures/Message.js.map +0 -1
- package/dist/lib/structures/Role.d.ts +0 -37
- package/dist/lib/structures/Role.js +0 -90
- package/dist/lib/structures/Role.js.map +0 -1
- package/dist/lib/structures/SKU.d.ts +0 -23
- package/dist/lib/structures/SKU.js +0 -63
- package/dist/lib/structures/SKU.js.map +0 -1
- package/dist/lib/structures/StageInstance.d.ts +0 -24
- package/dist/lib/structures/StageInstance.js +0 -57
- package/dist/lib/structures/StageInstance.js.map +0 -1
- package/dist/lib/structures/Sticker.d.ts +0 -31
- package/dist/lib/structures/Sticker.js +0 -86
- package/dist/lib/structures/Sticker.js.map +0 -1
- package/dist/lib/structures/Team.d.ts +0 -14
- package/dist/lib/structures/Team.js +0 -39
- package/dist/lib/structures/Team.js.map +0 -1
- package/dist/lib/structures/TestEntitlement.d.ts +0 -23
- package/dist/lib/structures/TestEntitlement.js +0 -61
- package/dist/lib/structures/TestEntitlement.js.map +0 -1
- package/dist/lib/structures/UnavailableGuild.d.ts +0 -11
- package/dist/lib/structures/UnavailableGuild.js +0 -25
- package/dist/lib/structures/UnavailableGuild.js.map +0 -1
- package/dist/lib/structures/User.d.ts +0 -63
- package/dist/lib/structures/User.js +0 -177
- package/dist/lib/structures/User.js.map +0 -1
- package/dist/lib/structures/VoiceState.d.ts +0 -24
- package/dist/lib/structures/VoiceState.js +0 -66
- package/dist/lib/structures/VoiceState.js.map +0 -1
- package/dist/lib/structures/Webhook.d.ts +0 -82
- package/dist/lib/structures/Webhook.js +0 -223
- package/dist/lib/structures/Webhook.js.map +0 -1
- package/dist/lib/structures/index.d.ts +0 -28
- package/dist/lib/structures/index.js +0 -45
- package/dist/lib/structures/index.js.map +0 -1
- package/dist/lib/types/application-command.js.map +0 -1
- package/dist/lib/types/application-role-connection-metadata.js.map +0 -1
- package/dist/lib/types/application.js.map +0 -1
- package/dist/lib/types/audit-log.js.map +0 -1
- package/dist/lib/types/auto-moderation.js.map +0 -1
- package/dist/lib/types/channel.js.map +0 -1
- package/dist/lib/types/emoji.js.map +0 -1
- package/dist/lib/types/entitlements.js.map +0 -1
- package/dist/lib/types/gateway-events.js.map +0 -1
- package/dist/lib/types/guild-scheduled-event.js.map +0 -1
- package/dist/lib/types/guild-template.js.map +0 -1
- package/dist/lib/types/guild.js.map +0 -1
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/interaction.js.map +0 -1
- package/dist/lib/types/invite.js.map +0 -1
- package/dist/lib/types/message-components.js.map +0 -1
- package/dist/lib/types/role.js.map +0 -1
- package/dist/lib/types/sku.js.map +0 -1
- package/dist/lib/types/stage-instance.js.map +0 -1
- package/dist/lib/types/sticker.js.map +0 -1
- package/dist/lib/types/team.js.map +0 -1
- package/dist/lib/types/user.js.map +0 -1
- package/dist/lib/types/voice.js.map +0 -1
- package/dist/lib/types/webhook.js.map +0 -1
- package/dist/lib/utils/Collection.d.ts +0 -24
- package/dist/lib/utils/Collection.js +0 -65
- package/dist/lib/utils/Collection.js.map +0 -1
- package/dist/lib/utils/Util.js.map +0 -1
- package/dist/lib/utils/errors.js.map +0 -1
- package/dist/lib/utils/index.js.map +0 -1
@@ -311,6 +311,12 @@ class Shard {
|
|
311
311
|
case "WEBHOOKS_UPDATE":
|
312
312
|
this.client.emit(constants_1.GatewayEvents.WebhooksUpdate, packet.d.channel_id, packet.d.guild_id);
|
313
313
|
break;
|
314
|
+
case "MESSAGE_POLL_VOTE_ADD":
|
315
|
+
this.client.emit(constants_1.GatewayEvents.MessagePollVoteAdd, this.client.util.toCamelCase(packet.d));
|
316
|
+
break;
|
317
|
+
case "MESSAGE_POLL_VOTE_REMOVE":
|
318
|
+
this.client.emit(constants_1.GatewayEvents.MessagePollVoteRemove, this.client.util.toCamelCase(packet.d));
|
319
|
+
break;
|
314
320
|
}
|
315
321
|
}
|
316
322
|
onWebSocketError(err) {
|
@@ -323,4 +329,3 @@ class Shard {
|
|
323
329
|
}
|
324
330
|
}
|
325
331
|
exports.Shard = Shard;
|
326
|
-
//# sourceMappingURL=Shard.js.map
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./Shard"), exports);
|
18
18
|
__exportStar(require("./ShardManager"), exports);
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js
CHANGED
package/dist/lib/rest/CDN.js
CHANGED
@@ -43,4 +43,3 @@ const userAvatarDecoration = (userId, avatarDecoration) => `https://cdn.discorda
|
|
43
43
|
exports.userAvatarDecoration = userAvatarDecoration;
|
44
44
|
const userBanner = (userId, banner) => `https://cdn.discordapp.com/banners/${userId}/${banner}.png`;
|
45
45
|
exports.userBanner = userBanner;
|
46
|
-
//# sourceMappingURL=CDN.js.map
|
@@ -37,7 +37,7 @@ export declare const guildVoiceState: (guildId: string, userId?: string | "@me")
|
|
37
37
|
export declare const guildWebhooks: (guildId: string) => `guilds/${string}/webhooks`;
|
38
38
|
export declare const guildWelcomeScreen: (guildId: string) => `guilds/${string}/welcome-screen`;
|
39
39
|
export declare const guildWidgetImage: (guildId: string) => `guilds/${string}/widget.png`;
|
40
|
-
export declare const
|
40
|
+
export declare const guildWidgetJSON: (guildId: string) => `guilds/${string}/widget.json`;
|
41
41
|
export declare const guildWidgetSettings: (guildId: string) => `guilds/${string}/widget`;
|
42
42
|
export declare const template: (code: string) => `guilds/templates/${string}`;
|
43
43
|
export declare const channel: (channelId: string) => `channels/${string}`;
|
@@ -53,11 +53,13 @@ export declare const channelPermission: (channelId: string, overwriteId: string)
|
|
53
53
|
export declare const channelPin: (channelId: string, messageId: string) => `channels/${string}/pins/${string}`;
|
54
54
|
export declare const channelPins: (channelId: string) => `channels/${string}/pins`;
|
55
55
|
export declare const channelRecipient: (channelId: string, userId: string) => `channels/${string}/recipients/${string}`;
|
56
|
-
export declare const channelThreads: (channelId: string, archivedStatus: "public" | "private", joined: boolean) => `channels/${string}/threads/archived/
|
56
|
+
export declare const channelThreads: (channelId: string, archivedStatus: "public" | "private", joined: boolean) => `channels/${string}/threads/archived/private` | `channels/${string}/threads/archived/public`;
|
57
57
|
export declare const channelTyping: (channelId: string) => `channels/${string}/typing`;
|
58
58
|
export declare const channelWebhooks: (channelId: string) => `channels/${string}/webhooks`;
|
59
59
|
export declare const threads: (channelId: string, messageId?: string) => `channels/${string}/threads`;
|
60
60
|
export declare const threadMembers: (threadId: string, userId?: string | "@me") => `channels/${string}/thread-members` | `channels/${string}/thread-members/${string}`;
|
61
|
+
export declare const pollAnswerVoters: (channelId: string, messageId: string, answerId: string) => `channels/${string}/polls/${string}/answers/${string}`;
|
62
|
+
export declare const pollExpire: (channelId: string, messageId: string) => `channels/${string}/polls/${string}/expire`;
|
61
63
|
export declare const user: (userId?: string | "@me") => `users/${string}`;
|
62
64
|
export declare const userApplicationRoleConnection: (applicationId: string) => `users/@me/applications/${string}/role-connection`;
|
63
65
|
export declare const userChannels: () => "users/@me/channels";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.channelMessageReaction = exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.
|
4
|
-
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2CurrentAuthorization = exports.oauth2CurrentApplication = exports.oauth2Authorization = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSkus = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlement = exports.applicationCurrentUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = void 0;
|
3
|
+
exports.channelMessageReaction = exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityUrl = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.guildCurrentMemberNickname = exports.guildChannels = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
4
|
+
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2CurrentAuthorization = exports.oauth2CurrentApplication = exports.oauth2Authorization = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSkus = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlement = exports.applicationCurrentUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = void 0;
|
5
5
|
// Guilds
|
6
6
|
const guild = (guildId) => `guilds/${guildId}`;
|
7
7
|
exports.guild = guild;
|
@@ -81,8 +81,8 @@ const guildWelcomeScreen = (guildId) => `guilds/${guildId}/welcome-screen`;
|
|
81
81
|
exports.guildWelcomeScreen = guildWelcomeScreen;
|
82
82
|
const guildWidgetImage = (guildId) => `guilds/${guildId}/widget.png`;
|
83
83
|
exports.guildWidgetImage = guildWidgetImage;
|
84
|
-
const
|
85
|
-
exports.
|
84
|
+
const guildWidgetJSON = (guildId) => `guilds/${guildId}/widget.json`;
|
85
|
+
exports.guildWidgetJSON = guildWidgetJSON;
|
86
86
|
const guildWidgetSettings = (guildId) => `guilds/${guildId}/widget`;
|
87
87
|
exports.guildWidgetSettings = guildWidgetSettings;
|
88
88
|
const template = (code) => `guilds/templates/${code}`;
|
@@ -132,6 +132,10 @@ const threadMembers = (threadId, userId) => userId
|
|
132
132
|
? `channels/${threadId}/thread-members`
|
133
133
|
: `channels/${threadId}/thread-members/${userId}`;
|
134
134
|
exports.threadMembers = threadMembers;
|
135
|
+
const pollAnswerVoters = (channelId, messageId, answerId) => `channels/${channelId}/polls/${messageId}/answers/${answerId}`;
|
136
|
+
exports.pollAnswerVoters = pollAnswerVoters;
|
137
|
+
const pollExpire = (channelId, messageId) => `channels/${channelId}/polls/${messageId}/expire`;
|
138
|
+
exports.pollExpire = pollExpire;
|
135
139
|
// Users
|
136
140
|
const user = (userId = "@me") => `users/${userId}`;
|
137
141
|
exports.user = user;
|
@@ -208,4 +212,3 @@ const stickerPacks = () => "sticker-packs";
|
|
208
212
|
exports.stickerPacks = stickerPacks;
|
209
213
|
const voiceRegions = () => "voice/regions";
|
210
214
|
exports.voiceRegions = voiceRegions;
|
211
|
-
//# sourceMappingURL=Endpoints.js.map
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
|
3
|
-
export declare enum RestMethods {
|
2
|
+
export declare enum RESTMethods {
|
4
3
|
Get = "GET",
|
5
4
|
Post = "POST",
|
6
5
|
Delete = "DELETE",
|
@@ -24,5 +23,5 @@ export declare class RequestManager {
|
|
24
23
|
auth: "Bot" | "Bearer";
|
25
24
|
globalBlock: boolean;
|
26
25
|
constructor(token: string, auth: "Bot" | "Bearer");
|
27
|
-
request<T = unknown>(method:
|
26
|
+
request<T = unknown>(method: RESTMethods, endpoint: string, data?: RequestData): Promise<T>;
|
28
27
|
}
|
@@ -23,18 +23,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.RequestManager = exports.
|
26
|
+
exports.RequestManager = exports.RESTMethods = void 0;
|
27
27
|
const constants_1 = require("../constants");
|
28
28
|
const utils_1 = require("../utils");
|
29
29
|
const pkg = __importStar(require("../../package.json"));
|
30
|
-
var
|
31
|
-
(function (
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
})(
|
30
|
+
var RESTMethods;
|
31
|
+
(function (RESTMethods) {
|
32
|
+
RESTMethods["Get"] = "GET";
|
33
|
+
RESTMethods["Post"] = "POST";
|
34
|
+
RESTMethods["Delete"] = "DELETE";
|
35
|
+
RESTMethods["Patch"] = "PATCH";
|
36
|
+
RESTMethods["Put"] = "PUT";
|
37
|
+
})(RESTMethods || (exports.RESTMethods = RESTMethods = {}));
|
38
38
|
class RequestManager {
|
39
39
|
token;
|
40
40
|
auth;
|
@@ -59,7 +59,7 @@ class RequestManager {
|
|
59
59
|
let body;
|
60
60
|
if (data?.authorization === false)
|
61
61
|
delete headers["Authorization"];
|
62
|
-
if (method !==
|
62
|
+
if (method !== RESTMethods.Get) {
|
63
63
|
if (data?.form || (data?.files && data?.files?.length !== 0)) {
|
64
64
|
const formData = data.form ?? new FormData();
|
65
65
|
if (data?.files && data?.files?.length !== 0) {
|
@@ -103,13 +103,13 @@ class RequestManager {
|
|
103
103
|
.catch(reject), 5 * 1000);
|
104
104
|
}
|
105
105
|
else {
|
106
|
-
const
|
107
|
-
reject(
|
108
|
-
typeof
|
109
|
-
"code" in
|
110
|
-
"message" in
|
111
|
-
|
112
|
-
? new utils_1.
|
106
|
+
const responseJSON = await response.json();
|
107
|
+
reject(responseJSON &&
|
108
|
+
typeof responseJSON === "object" &&
|
109
|
+
"code" in responseJSON &&
|
110
|
+
"message" in responseJSON &&
|
111
|
+
responseJSON.code !== 0
|
112
|
+
? new utils_1.RESTError(`[${responseJSON.code}] ${responseJSON.message}`)
|
113
113
|
: new utils_1.HTTPError(`[${response.status}] ${response.statusText}`));
|
114
114
|
}
|
115
115
|
}
|
@@ -127,4 +127,3 @@ class RequestManager {
|
|
127
127
|
}
|
128
128
|
}
|
129
129
|
exports.RequestManager = RequestManager;
|
130
|
-
//# sourceMappingURL=RequestManager.js.map
|
package/dist/lib/rest/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { AllowedMentionTypes, AttachmentFlags, ChannelFlags, ChannelTypes, ForumLayoutTypes, InviteTargetTypes, MessageActivityTypes, MessageFlags, MessageTypes, SortOrderTypes, VideoQualityModes } from "../constants";
|
2
2
|
import type { RawApplication, RawGuildMember, RawUser, RawEmoji, RawSticker, RawStickerItem, RawMessageInteraction, MessageInteraction, StickerItem, Sticker, Emoji, User, Application, GuildMember, RawActionRow, ActionRow, RawResolvedData, ResolvedData } from ".";
|
3
3
|
import type { File } from "../rest";
|
4
|
+
import type { Poll, RawPoll } from "./poll";
|
4
5
|
/** https://discord.com/developers/docs/resources/channel#channel-object-channel-structure */
|
5
6
|
export interface RawChannel {
|
6
7
|
id: string;
|
@@ -73,6 +74,7 @@ export interface RawMessage {
|
|
73
74
|
position?: number;
|
74
75
|
role_subscription_data?: RawRoleSubscriptionData;
|
75
76
|
resolved?: RawResolvedData;
|
77
|
+
poll?: RawPoll;
|
76
78
|
}
|
77
79
|
/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
|
78
80
|
export interface RawMessageActivity {
|
@@ -310,6 +312,7 @@ export interface Message {
|
|
310
312
|
position?: number;
|
311
313
|
roleSubscriptionData?: RoleSubscriptionData;
|
312
314
|
resolved?: ResolvedData;
|
315
|
+
poll?: Poll;
|
313
316
|
}
|
314
317
|
export interface MessageActivity {
|
315
318
|
type: MessageActivityTypes;
|
@@ -495,6 +498,7 @@ export interface CreateMessageParams {
|
|
495
498
|
attachments?: Array<Attachment>;
|
496
499
|
flags?: MessageFlags;
|
497
500
|
enforceNonce?: boolean;
|
501
|
+
poll?: Poll;
|
498
502
|
}
|
499
503
|
export interface EditMessageParams {
|
500
504
|
content?: string | null;
|
package/dist/lib/types/emoji.js
CHANGED
@@ -257,6 +257,20 @@ export interface RawVoiceServerUpdateEventFields {
|
|
257
257
|
guild_id: string;
|
258
258
|
endpoint: string | null;
|
259
259
|
}
|
260
|
+
export interface RawMessagePollVoteAddFields {
|
261
|
+
user_id: string;
|
262
|
+
channel_id: string;
|
263
|
+
message_id: string;
|
264
|
+
guild_id?: string;
|
265
|
+
answer_id: number;
|
266
|
+
}
|
267
|
+
export interface RawMessagePollVoteRemoveFields {
|
268
|
+
user_id: string;
|
269
|
+
channel_id: string;
|
270
|
+
message_id: string;
|
271
|
+
guild_id?: string;
|
272
|
+
answer_id: number;
|
273
|
+
}
|
260
274
|
export interface AutoModerationActionExecutionEventFields {
|
261
275
|
guildId: string;
|
262
276
|
action: AutoModerationAction;
|
@@ -479,3 +493,17 @@ export interface VoiceServerUpdateEventFields {
|
|
479
493
|
guildId: string;
|
480
494
|
endpoint: string | null;
|
481
495
|
}
|
496
|
+
export interface MessagePollVoteAddFields {
|
497
|
+
userId: string;
|
498
|
+
channelId: string;
|
499
|
+
messageId: string;
|
500
|
+
guildId?: string;
|
501
|
+
answerId: number;
|
502
|
+
}
|
503
|
+
export interface MessagePollVoteRemoveFields {
|
504
|
+
userId: string;
|
505
|
+
channelId: string;
|
506
|
+
messageId: string;
|
507
|
+
guildId?: string;
|
508
|
+
answerId: number;
|
509
|
+
}
|
package/dist/lib/types/guild.js
CHANGED
package/dist/lib/types/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { RawAttachment, RawChannel, RawGuildMember, RawMessage, RawUser, RawRole, Attachment, User, GuildMember, Message, Role, Channel, Entitlement, RawEntitlement, RawEmbed, RawAllowedMentions, RawActionRow, RawApplicationCommandOptionChoice, Embed, AllowedMentions, ActionRow, ApplicationCommandOptionChoice, RawTextInput, TextInput, ExecuteWebhookParams } from ".";
|
2
2
|
import type { ApplicationCommandOptionType, ApplicationCommandTypes, ComponentTypes, InteractionCallbackType, InteractionType, MessageFlags } from "../constants";
|
3
3
|
import type { File } from "../rest";
|
4
|
+
import type { Poll, RawPoll } from "./poll";
|
4
5
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure */
|
5
6
|
export interface RawInteraction {
|
6
7
|
id: string;
|
@@ -84,6 +85,7 @@ export interface RawInteractionCallbackData {
|
|
84
85
|
flags?: MessageFlags;
|
85
86
|
components?: Array<RawActionRow>;
|
86
87
|
attachments?: Array<RawAttachment>;
|
88
|
+
poll?: RawPoll;
|
87
89
|
files?: Array<File>;
|
88
90
|
choices?: Array<RawApplicationCommandOptionChoice>;
|
89
91
|
custom_id?: string;
|
@@ -163,6 +165,7 @@ export interface InteractionCallbackData {
|
|
163
165
|
flags?: MessageFlags;
|
164
166
|
components?: Array<ActionRow>;
|
165
167
|
attachments?: Array<Attachment>;
|
168
|
+
poll?: Poll;
|
166
169
|
files?: Array<File>;
|
167
170
|
choices?: Array<ApplicationCommandOptionChoice>;
|
168
171
|
customId?: string;
|
package/dist/lib/types/invite.js
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
import type { LayoutType } from "../constants";
|
2
|
+
import type { Emoji, RawEmoji } from "./emoji";
|
3
|
+
export interface RawPoll {
|
4
|
+
question: RawPollMedia;
|
5
|
+
answers: Array<RawPollAnswer>;
|
6
|
+
expiry: string;
|
7
|
+
allow_multiselect: boolean;
|
8
|
+
layout_type: LayoutType;
|
9
|
+
results: RawPollResults;
|
10
|
+
}
|
11
|
+
export interface RawPollMedia {
|
12
|
+
text?: string;
|
13
|
+
emoji?: Pick<RawEmoji, "id" | "name">;
|
14
|
+
}
|
15
|
+
export interface RawPollAnswer {
|
16
|
+
answer_id: number;
|
17
|
+
poll_media: RawPollMedia;
|
18
|
+
}
|
19
|
+
export interface RawPollResults {
|
20
|
+
is_finalized: boolean;
|
21
|
+
answer_counts: Array<RawPollAnswerCount>;
|
22
|
+
}
|
23
|
+
export interface RawPollAnswerCount {
|
24
|
+
id: number;
|
25
|
+
count: number;
|
26
|
+
me_voted: boolean;
|
27
|
+
}
|
28
|
+
export interface Poll {
|
29
|
+
question: PollMedia;
|
30
|
+
answers: Array<PollAnswer>;
|
31
|
+
expiry: string;
|
32
|
+
allowMultiselect: boolean;
|
33
|
+
layoutType: LayoutType;
|
34
|
+
results: PollResults;
|
35
|
+
}
|
36
|
+
export interface PollMedia {
|
37
|
+
text?: string;
|
38
|
+
emoji?: Pick<Emoji, "id" | "name">;
|
39
|
+
}
|
40
|
+
export interface PollAnswer {
|
41
|
+
answerId: number;
|
42
|
+
pollMedia: PollMedia;
|
43
|
+
}
|
44
|
+
export interface PollResults {
|
45
|
+
isFinalized: boolean;
|
46
|
+
answerCounts: Array<PollAnswerCount>;
|
47
|
+
}
|
48
|
+
export interface PollAnswerCount {
|
49
|
+
id: number;
|
50
|
+
count: number;
|
51
|
+
meVoted: boolean;
|
52
|
+
}
|
package/dist/lib/types/role.js
CHANGED
package/dist/lib/types/sku.js
CHANGED
package/dist/lib/types/team.js
CHANGED
package/dist/lib/types/user.js
CHANGED
package/dist/lib/types/voice.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { MessageFlags, WebhookTypes } from "../constants";
|
2
2
|
import type { ActionRow, AllowedMentions, Attachment, Channel, Embed, Guild, User, RawChannel, RawGuild, RawUser } from ".";
|
3
3
|
import type { File } from "../rest";
|
4
|
+
import type { Poll } from "./poll";
|
4
5
|
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
5
6
|
export interface RawWebhook {
|
6
7
|
id: string;
|
@@ -51,6 +52,8 @@ export interface ExecuteWebhookParams {
|
|
51
52
|
attachments?: Array<Attachment> | null;
|
52
53
|
flags?: MessageFlags | null;
|
53
54
|
threadName?: string;
|
55
|
+
appliedTags?: Array<string>;
|
56
|
+
poll?: Poll;
|
54
57
|
}
|
55
58
|
export interface EditWebhookMessageParams {
|
56
59
|
content?: string | null;
|
package/dist/lib/utils/Util.js
CHANGED
package/dist/lib/utils/errors.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GatewayError = exports.HTTPError = exports.
|
4
|
-
class
|
5
|
-
name = "
|
3
|
+
exports.GatewayError = exports.HTTPError = exports.RESTError = void 0;
|
4
|
+
class RESTError extends Error {
|
5
|
+
name = "RESTError";
|
6
6
|
constructor(message) {
|
7
7
|
super(message);
|
8
8
|
}
|
9
9
|
}
|
10
|
-
exports.
|
10
|
+
exports.RESTError = RESTError;
|
11
11
|
class HTTPError extends Error {
|
12
12
|
name = "HTTPError";
|
13
13
|
constructor(message) {
|
@@ -22,4 +22,3 @@ class GatewayError extends Error {
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
exports.GatewayError = GatewayError;
|
25
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/lib/utils/index.js
CHANGED
package/dist/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "disgroove",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.1.0-dev.c430b6f",
|
4
4
|
"description": "A module to interface with Discord",
|
5
5
|
"main": "./dist/lib/index.js",
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
@@ -25,6 +25,9 @@
|
|
25
25
|
"@types/node": "^20.11.25",
|
26
26
|
"@types/ws": "^8.5.10",
|
27
27
|
"node": "^21.7.1",
|
28
|
+
"typescript": "^5.4.2"
|
29
|
+
},
|
30
|
+
"dependencies": {
|
28
31
|
"ws": "^8.16.0"
|
29
32
|
}
|
30
33
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "disgroove",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.1.0-dev.c430b6f",
|
4
4
|
"description": "A module to interface with Discord",
|
5
5
|
"main": "./dist/lib/index.js",
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
@@ -25,6 +25,9 @@
|
|
25
25
|
"@types/node": "^20.11.25",
|
26
26
|
"@types/ws": "^8.5.10",
|
27
27
|
"node": "^21.7.1",
|
28
|
+
"typescript": "^5.4.2"
|
29
|
+
},
|
30
|
+
"dependencies": {
|
28
31
|
"ws": "^8.16.0"
|
29
32
|
}
|
30
33
|
}
|