disgroove 3.0.0 → 3.0.1-dev.739a5a9
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 +15 -1
- package/dist/lib/Client.js +25 -0
- package/dist/lib/constants.d.ts +9 -0
- package/dist/lib/constants.js +11 -1
- package/dist/lib/rest/Endpoints.d.ts +2 -0
- package/dist/lib/rest/Endpoints.js +6 -1
- package/dist/lib/rest/RequestManager.js +4 -0
- package/dist/lib/transformers/Guilds.d.ts +2 -0
- package/dist/lib/transformers/Guilds.js +134 -0
- package/dist/lib/transformers/Invites.js +2 -2
- package/dist/lib/types/invite.d.ts +5 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/Client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes, type LobbyMemberFlags } from "./constants";
|
|
1
|
+
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes, type LobbyMemberFlags, InviteTargetUsersJobStatusErrorCodes } from "./constants";
|
|
2
2
|
import { RequestManager, type FileData } from "./rest";
|
|
3
3
|
import EventEmitter from "node:events";
|
|
4
4
|
import { Shard } from "./gateway";
|
|
@@ -181,6 +181,8 @@ export declare class Client extends EventEmitter {
|
|
|
181
181
|
targetType?: InviteTargetTypes;
|
|
182
182
|
targetUserId?: snowflake;
|
|
183
183
|
targetApplicationId?: snowflake;
|
|
184
|
+
targetUsersFile?: FileData;
|
|
185
|
+
rolesIds?: Array<snowflake>;
|
|
184
186
|
}, reason?: string): Promise<Invite>;
|
|
185
187
|
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
|
186
188
|
createChannelWebhook(channelId: snowflake, options: {
|
|
@@ -950,6 +952,16 @@ export declare class Client extends EventEmitter {
|
|
|
950
952
|
withCounts?: boolean;
|
|
951
953
|
guildScheduledEventId?: snowflake;
|
|
952
954
|
}): Promise<Invite>;
|
|
955
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users */
|
|
956
|
+
getInviteTargetUser(inviteCode: string): Promise<Blob>;
|
|
957
|
+
getInviteTargetUserJobStatus(inviteCode: string): Promise<{
|
|
958
|
+
status: InviteTargetUsersJobStatusErrorCodes;
|
|
959
|
+
totalUsers: number;
|
|
960
|
+
processedUsers: number;
|
|
961
|
+
createdAt: timestamp;
|
|
962
|
+
completedAt: timestamp | null;
|
|
963
|
+
errorMessage: string | null;
|
|
964
|
+
}>;
|
|
953
965
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
|
954
966
|
getJoinedPrivateArchivedThreads(channelId: snowflake, options?: {
|
|
955
967
|
before?: snowflake;
|
|
@@ -1100,6 +1112,8 @@ export declare class Client extends EventEmitter {
|
|
|
1100
1112
|
platformUsername?: string;
|
|
1101
1113
|
metadata?: ApplicationRoleConnectionMetadata;
|
|
1102
1114
|
}): Promise<ApplicationRoleConnection>;
|
|
1115
|
+
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
1116
|
+
updateInviteTargetUser(inviteCode: string, targetUsersFile: FileData): void;
|
|
1103
1117
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
1104
1118
|
unpinMessage(channelId: snowflake, messageId: snowflake, reason?: string): void;
|
|
1105
1119
|
}
|
package/dist/lib/Client.js
CHANGED
|
@@ -244,7 +244,11 @@ class Client extends node_events_1.default {
|
|
|
244
244
|
target_type: options.targetType,
|
|
245
245
|
target_user_id: options.targetUserId,
|
|
246
246
|
target_application_id: options.targetApplicationId,
|
|
247
|
+
roles_ids: options.rolesIds,
|
|
247
248
|
},
|
|
249
|
+
files: options.targetUsersFile !== undefined
|
|
250
|
+
? [options.targetUsersFile]
|
|
251
|
+
: undefined,
|
|
248
252
|
reason,
|
|
249
253
|
});
|
|
250
254
|
return transformers_1.Invites.inviteFromRaw(response);
|
|
@@ -2163,6 +2167,21 @@ class Client extends node_events_1.default {
|
|
|
2163
2167
|
});
|
|
2164
2168
|
return transformers_1.Invites.inviteFromRaw(response);
|
|
2165
2169
|
}
|
|
2170
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users */
|
|
2171
|
+
getInviteTargetUser(inviteCode) {
|
|
2172
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode));
|
|
2173
|
+
}
|
|
2174
|
+
async getInviteTargetUserJobStatus(inviteCode) {
|
|
2175
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsersJobStatus(inviteCode));
|
|
2176
|
+
return {
|
|
2177
|
+
status: response.status,
|
|
2178
|
+
totalUsers: response.total_users,
|
|
2179
|
+
processedUsers: response.processed_users,
|
|
2180
|
+
createdAt: response.created_at,
|
|
2181
|
+
completedAt: response.completed_at,
|
|
2182
|
+
errorMessage: response.error_message,
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2166
2185
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
|
2167
2186
|
async getJoinedPrivateArchivedThreads(channelId, options) {
|
|
2168
2187
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(channelId, "private", true), {
|
|
@@ -2504,6 +2523,12 @@ class Client extends node_events_1.default {
|
|
|
2504
2523
|
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
|
2505
2524
|
};
|
|
2506
2525
|
}
|
|
2526
|
+
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
2527
|
+
updateInviteTargetUser(inviteCode, targetUsersFile) {
|
|
2528
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.inviteTargetUsers(inviteCode), {
|
|
2529
|
+
files: [targetUsersFile],
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2507
2532
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
2508
2533
|
unpinMessage(channelId, messageId, reason) {
|
|
2509
2534
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -522,6 +522,13 @@ export declare enum InviteTargetTypes {
|
|
|
522
522
|
export declare enum GuildInviteFlags {
|
|
523
523
|
IsGuestInvite = 1
|
|
524
524
|
}
|
|
525
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users-job-status-error-codes */
|
|
526
|
+
export declare enum InviteTargetUsersJobStatusErrorCodes {
|
|
527
|
+
Unspecified = 0,
|
|
528
|
+
Processing = 1,
|
|
529
|
+
Completed = 2,
|
|
530
|
+
Failed = 3
|
|
531
|
+
}
|
|
525
532
|
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
526
533
|
export declare enum LobbyMemberFlags {
|
|
527
534
|
CanLinkLobby = 1
|
|
@@ -1012,6 +1019,8 @@ export declare enum JSONErrorCodes {
|
|
|
1012
1019
|
UnknownGuildScheduledEventUser = 10071,
|
|
1013
1020
|
UnknownTag = 10087,
|
|
1014
1021
|
UnknownSound = 10091,
|
|
1022
|
+
UnknownInviteTargetUsersJob = 10124,
|
|
1023
|
+
UnknownInviteTargetUsers = 10129,
|
|
1015
1024
|
BotsCannotUseThisEndpoint = 20001,
|
|
1016
1025
|
OnlyBotsCanUseThisEndpoint = 20002,
|
|
1017
1026
|
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildScheduledEventRecurrenceRuleMonth = exports.GuildScheduledEventRecurrenceRuleWeekday = exports.GuildScheduledEventRecurrenceRuleFrequency = exports.GuildScheduledEventStatus = exports.GuildScheduledEventEntityTypes = exports.GuildScheduledEventPrivacyLevel = exports.ImageWidgetStyleOptions = exports.PromptTypes = exports.OnboardingMode = exports.IntegrationExpireBehaviors = exports.GuildMemberFlags = exports.MutableGuildFeatures = exports.GuildFeatures = exports.SystemChannelFlags = exports.PremiumTier = exports.GuildNSFWLevel = exports.VerificationLevel = exports.MFALevel = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.ForumLayoutTypes = exports.SortOrderTypes = exports.ChannelFlags = exports.VideoQualityModes = exports.ChannelTypes = exports.ActionTypes = exports.EventTypes = exports.KeywordPresetTypes = exports.TriggerTypes = exports.AuditLogEvents = exports.ApplicationRoleConnectionMetadataType = exports.ActivityLocationKind = exports.ApplicationFlags = exports.ApplicationEventWebhookStatus = exports.ApplicationIntegrationTypes = exports.SeparatorSpacing = exports.TextInputStyles = exports.ButtonStyles = exports.ComponentTypes = exports.InteractionCallbackType = exports.InteractionContextTypes = exports.InteractionType = exports.ApplicationCommandPermissionType = exports.EntryPointCommandHandlerTypes = exports.ApplicationCommandOptionType = exports.ApplicationCommandTypes = exports.Locales = exports.ImageFormats = exports.GuildNavigationTypes = exports.TimestampStyles = void 0;
|
|
4
|
-
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.LobbyMemberFlags = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
4
|
+
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.LobbyMemberFlags = exports.InviteTargetUsersJobStatusErrorCodes = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
5
5
|
/** https://discord.com/developers/docs/reference#message-formatting-timestamp-styles */
|
|
6
6
|
var TimestampStyles;
|
|
7
7
|
(function (TimestampStyles) {
|
|
@@ -579,6 +579,14 @@ var GuildInviteFlags;
|
|
|
579
579
|
(function (GuildInviteFlags) {
|
|
580
580
|
GuildInviteFlags[GuildInviteFlags["IsGuestInvite"] = 1] = "IsGuestInvite";
|
|
581
581
|
})(GuildInviteFlags || (exports.GuildInviteFlags = GuildInviteFlags = {}));
|
|
582
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users-job-status-error-codes */
|
|
583
|
+
var InviteTargetUsersJobStatusErrorCodes;
|
|
584
|
+
(function (InviteTargetUsersJobStatusErrorCodes) {
|
|
585
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Unspecified"] = 0] = "Unspecified";
|
|
586
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Processing"] = 1] = "Processing";
|
|
587
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Completed"] = 2] = "Completed";
|
|
588
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Failed"] = 3] = "Failed";
|
|
589
|
+
})(InviteTargetUsersJobStatusErrorCodes || (exports.InviteTargetUsersJobStatusErrorCodes = InviteTargetUsersJobStatusErrorCodes = {}));
|
|
582
590
|
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
583
591
|
var LobbyMemberFlags;
|
|
584
592
|
(function (LobbyMemberFlags) {
|
|
@@ -1102,6 +1110,8 @@ var JSONErrorCodes;
|
|
|
1102
1110
|
JSONErrorCodes[JSONErrorCodes["UnknownGuildScheduledEventUser"] = 10071] = "UnknownGuildScheduledEventUser";
|
|
1103
1111
|
JSONErrorCodes[JSONErrorCodes["UnknownTag"] = 10087] = "UnknownTag";
|
|
1104
1112
|
JSONErrorCodes[JSONErrorCodes["UnknownSound"] = 10091] = "UnknownSound";
|
|
1113
|
+
JSONErrorCodes[JSONErrorCodes["UnknownInviteTargetUsersJob"] = 10124] = "UnknownInviteTargetUsersJob";
|
|
1114
|
+
JSONErrorCodes[JSONErrorCodes["UnknownInviteTargetUsers"] = 10129] = "UnknownInviteTargetUsers";
|
|
1105
1115
|
JSONErrorCodes[JSONErrorCodes["BotsCannotUseThisEndpoint"] = 20001] = "BotsCannotUseThisEndpoint";
|
|
1106
1116
|
JSONErrorCodes[JSONErrorCodes["OnlyBotsCanUseThisEndpoint"] = 20002] = "OnlyBotsCanUseThisEndpoint";
|
|
1107
1117
|
JSONErrorCodes[JSONErrorCodes["ExplicitContentCannotBeSentToTheDesiredRecipient"] = 20009] = "ExplicitContentCannotBeSentToTheDesiredRecipient";
|
|
@@ -113,3 +113,5 @@ export declare const lobbies: () => "lobbies";
|
|
|
113
113
|
export declare const lobby: (lobbyId: snowflake) => `lobbies/${string}`;
|
|
114
114
|
export declare const lobbyMember: (lobbyId: snowflake, userId?: snowflake | "@me") => `lobbies/${string}/members/${string}`;
|
|
115
115
|
export declare const lobbyChannelLinking: (lobbyId: snowflake) => `lobbies/${string}/channel-linking`;
|
|
116
|
+
export declare const inviteTargetUsers: (inviteCode: string) => `invites/${string}/target-users`;
|
|
117
|
+
export declare const inviteTargetUsersJobStatus: (inviteCode: string) => `invites/${string}/target-users/job-status`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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.guildSoundboardSounds = exports.guildSoundboardSound = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRoleMemberCounts = 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.guildIncidentsActions = exports.guildEmojis = exports.guildEmoji = exports.guildMemberNickname = exports.guildChannels = exports.guildBulkBan = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
|
4
4
|
exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.soundboardDefaultSounds = exports.sendSoundboardSound = exports.skuSubscriptions = exports.skuSubscription = exports.stickerPacks = exports.stickerPack = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationEmojis = exports.applicationEmoji = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.applicationActivityInstance = 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 = exports.channelMessageReaction = exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = void 0;
|
|
5
|
-
exports.lobbyChannelLinking = exports.lobbyMember = exports.lobby = exports.lobbies = exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = void 0;
|
|
5
|
+
exports.inviteTargetUsersJobStatus = exports.inviteTargetUsers = exports.lobbyChannelLinking = exports.lobbyMember = exports.lobby = exports.lobbies = exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = void 0;
|
|
6
6
|
// Guilds
|
|
7
7
|
const guild = (guildId) => `guilds/${guildId}`;
|
|
8
8
|
exports.guild = guild;
|
|
@@ -253,3 +253,8 @@ const lobbyMember = (lobbyId, userId = "@me") => `lobbies/${lobbyId}/members/${u
|
|
|
253
253
|
exports.lobbyMember = lobbyMember;
|
|
254
254
|
const lobbyChannelLinking = (lobbyId) => `lobbies/${lobbyId}/channel-linking`;
|
|
255
255
|
exports.lobbyChannelLinking = lobbyChannelLinking;
|
|
256
|
+
// Invites
|
|
257
|
+
const inviteTargetUsers = (inviteCode) => `invites/${inviteCode}/target-users`;
|
|
258
|
+
exports.inviteTargetUsers = inviteTargetUsers;
|
|
259
|
+
const inviteTargetUsersJobStatus = (inviteCode) => `invites/${inviteCode}/target-users/job-status`;
|
|
260
|
+
exports.inviteTargetUsersJobStatus = inviteTargetUsersJobStatus;
|
|
@@ -9,4 +9,6 @@ export declare class Guilds {
|
|
|
9
9
|
static guildToRaw(guild: Guild): RawGuild;
|
|
10
10
|
static integrationFromRaw(integration: RawIntegration): Integration;
|
|
11
11
|
static integrationToRaw(integration: Integration): RawIntegration;
|
|
12
|
+
static partialGuildFromRaw(guild: Partial<RawGuild>): Partial<Guild>;
|
|
13
|
+
static partialGuildToRaw(guild: Partial<Guild>): Partial<RawGuild>;
|
|
12
14
|
}
|
|
@@ -276,5 +276,139 @@ class Guilds {
|
|
|
276
276
|
scopes: integration.scopes,
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
+
static partialGuildFromRaw(guild) {
|
|
280
|
+
return {
|
|
281
|
+
id: guild.id,
|
|
282
|
+
name: guild.name,
|
|
283
|
+
icon: guild.icon,
|
|
284
|
+
iconHash: guild.icon,
|
|
285
|
+
splash: guild.splash,
|
|
286
|
+
discoverySplash: guild.discovery_splash,
|
|
287
|
+
owner: guild.owner,
|
|
288
|
+
ownerId: guild.owner_id,
|
|
289
|
+
permissions: guild.permissions,
|
|
290
|
+
region: guild.region,
|
|
291
|
+
afkChannelId: guild.afk_channel_id,
|
|
292
|
+
afkTimeout: guild.afk_timeout,
|
|
293
|
+
widgetEnabled: guild.widget_enabled,
|
|
294
|
+
widgetChannelId: guild.widget_channel_id,
|
|
295
|
+
verificationLevel: guild.verification_level,
|
|
296
|
+
defaultMessageNotifications: guild.default_message_notifications,
|
|
297
|
+
explicitContentFilter: guild.explicit_content_filter,
|
|
298
|
+
roles: guild.roles?.map((role) => Roles_1.Roles.roleFromRaw(role)),
|
|
299
|
+
emojis: guild.emojis?.map((emoji) => Emojis_1.Emojis.emojiFromRaw(emoji)),
|
|
300
|
+
features: guild.features,
|
|
301
|
+
mfaLevel: guild.mfa_level,
|
|
302
|
+
applicationId: guild.application_id,
|
|
303
|
+
systemChannelId: guild.system_channel_id,
|
|
304
|
+
systemChannelFlags: guild.system_channel_flags,
|
|
305
|
+
rulesChannelId: guild.rules_channel_id,
|
|
306
|
+
maxPresences: guild.max_presences,
|
|
307
|
+
maxMembers: guild.max_members,
|
|
308
|
+
vanityURLCode: guild.vanity_url_code,
|
|
309
|
+
description: guild.description,
|
|
310
|
+
banner: guild.banner,
|
|
311
|
+
premiumTier: guild.premium_tier,
|
|
312
|
+
premiumSubscriptionCount: guild.premium_subscription_count,
|
|
313
|
+
preferredLocale: guild.preferred_locale,
|
|
314
|
+
publicUpdatesChannelId: guild.public_updates_channel_id,
|
|
315
|
+
maxVideoChannelUsers: guild.max_video_channel_users,
|
|
316
|
+
maxStageVideoChannelUsers: guild.max_stage_video_channel_users,
|
|
317
|
+
approximateMemberCount: guild.approximate_member_count,
|
|
318
|
+
approximatePresenceCount: guild.approximate_presence_count,
|
|
319
|
+
welcomeScreen: guild.welcome_screen !== undefined
|
|
320
|
+
? {
|
|
321
|
+
description: guild.welcome_screen.description,
|
|
322
|
+
welcomeChannels: guild.welcome_screen.welcome_channels.map((welcomeScreenChannel) => ({
|
|
323
|
+
channelId: welcomeScreenChannel.channel_id,
|
|
324
|
+
description: welcomeScreenChannel.description,
|
|
325
|
+
emojiId: welcomeScreenChannel.emoji_id,
|
|
326
|
+
emojiName: welcomeScreenChannel.emoji_name,
|
|
327
|
+
})),
|
|
328
|
+
}
|
|
329
|
+
: undefined,
|
|
330
|
+
nsfwLevel: guild.nsfw_level,
|
|
331
|
+
stickers: guild.stickers?.map((sticker) => Stickers_1.Stickers.stickerFromRaw(sticker)),
|
|
332
|
+
premiumProgressBarEnabled: guild.premium_progress_bar_enabled,
|
|
333
|
+
safetyAlertsChannelId: guild.safety_alerts_channel_id,
|
|
334
|
+
incidentsData: guild.incidents_data !== undefined
|
|
335
|
+
? guild.incidents_data !== null
|
|
336
|
+
? {
|
|
337
|
+
invitesDisabledUntil: guild.incidents_data.invites_disabled_until,
|
|
338
|
+
dmsDisabledUntil: guild.incidents_data.dms_disabled_until,
|
|
339
|
+
dmSpamDetectedAt: guild.incidents_data.dm_spam_detected_at,
|
|
340
|
+
raidDetectedAt: guild.incidents_data.raid_detected_at,
|
|
341
|
+
}
|
|
342
|
+
: null
|
|
343
|
+
: undefined,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
static partialGuildToRaw(guild) {
|
|
347
|
+
return {
|
|
348
|
+
id: guild.id,
|
|
349
|
+
name: guild.name,
|
|
350
|
+
icon: guild.icon,
|
|
351
|
+
icon_hash: guild.icon,
|
|
352
|
+
splash: guild.splash,
|
|
353
|
+
discovery_splash: guild.discoverySplash,
|
|
354
|
+
owner: guild.owner,
|
|
355
|
+
owner_id: guild.ownerId,
|
|
356
|
+
permissions: guild.permissions,
|
|
357
|
+
region: guild.region,
|
|
358
|
+
afk_channel_id: guild.afkChannelId,
|
|
359
|
+
afk_timeout: guild.afkTimeout,
|
|
360
|
+
widget_enabled: guild.widgetEnabled,
|
|
361
|
+
widget_channel_id: guild.widgetChannelId,
|
|
362
|
+
verification_level: guild.verificationLevel,
|
|
363
|
+
default_message_notifications: guild.defaultMessageNotifications,
|
|
364
|
+
explicit_content_filter: guild.explicitContentFilter,
|
|
365
|
+
roles: guild.roles?.map((role) => Roles_1.Roles.roleToRaw(role)),
|
|
366
|
+
emojis: guild.emojis?.map((emoji) => Emojis_1.Emojis.emojiToRaw(emoji)),
|
|
367
|
+
features: guild.features,
|
|
368
|
+
mfa_level: guild.mfaLevel,
|
|
369
|
+
application_id: guild.applicationId,
|
|
370
|
+
system_channel_id: guild.systemChannelId,
|
|
371
|
+
system_channel_flags: guild.systemChannelFlags,
|
|
372
|
+
rules_channel_id: guild.rulesChannelId,
|
|
373
|
+
max_presences: guild.maxPresences,
|
|
374
|
+
max_members: guild.maxMembers,
|
|
375
|
+
vanity_url_code: guild.vanityURLCode,
|
|
376
|
+
description: guild.description,
|
|
377
|
+
banner: guild.banner,
|
|
378
|
+
premium_tier: guild.premiumTier,
|
|
379
|
+
premium_subscription_count: guild.premiumSubscriptionCount,
|
|
380
|
+
preferred_locale: guild.preferredLocale,
|
|
381
|
+
public_updates_channel_id: guild.publicUpdatesChannelId,
|
|
382
|
+
max_video_channel_users: guild.maxVideoChannelUsers,
|
|
383
|
+
max_stage_video_channel_users: guild.maxStageVideoChannelUsers,
|
|
384
|
+
approximate_member_count: guild.approximateMemberCount,
|
|
385
|
+
approximate_presence_count: guild.approximatePresenceCount,
|
|
386
|
+
welcome_screen: guild.welcomeScreen !== undefined
|
|
387
|
+
? {
|
|
388
|
+
description: guild.welcomeScreen.description,
|
|
389
|
+
welcome_channels: guild.welcomeScreen.welcomeChannels.map((welcomeScreenChannel) => ({
|
|
390
|
+
channel_id: welcomeScreenChannel.channelId,
|
|
391
|
+
description: welcomeScreenChannel.description,
|
|
392
|
+
emoji_id: welcomeScreenChannel.emojiId,
|
|
393
|
+
emoji_name: welcomeScreenChannel.emojiName,
|
|
394
|
+
})),
|
|
395
|
+
}
|
|
396
|
+
: undefined,
|
|
397
|
+
nsfw_level: guild.nsfwLevel,
|
|
398
|
+
stickers: guild.stickers?.map((sticker) => Stickers_1.Stickers.stickerToRaw(sticker)),
|
|
399
|
+
premium_progress_bar_enabled: guild.premiumProgressBarEnabled,
|
|
400
|
+
safety_alerts_channel_id: guild.safetyAlertsChannelId,
|
|
401
|
+
incidents_data: guild.incidentsData !== undefined
|
|
402
|
+
? guild.incidentsData !== null
|
|
403
|
+
? {
|
|
404
|
+
invites_disabled_until: guild.incidentsData.invitesDisabledUntil,
|
|
405
|
+
dms_disabled_until: guild.incidentsData.dmsDisabledUntil,
|
|
406
|
+
dm_spam_detected_at: guild.incidentsData.dmSpamDetectedAt,
|
|
407
|
+
raid_detected_at: guild.incidentsData.raidDetectedAt,
|
|
408
|
+
}
|
|
409
|
+
: null
|
|
410
|
+
: undefined,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
279
413
|
}
|
|
280
414
|
exports.Guilds = Guilds;
|
|
@@ -12,7 +12,7 @@ class Invites {
|
|
|
12
12
|
type: invite.type,
|
|
13
13
|
code: invite.code,
|
|
14
14
|
guild: invite.guild !== undefined
|
|
15
|
-
? Guilds_1.Guilds.
|
|
15
|
+
? Guilds_1.Guilds.partialGuildFromRaw(invite.guild)
|
|
16
16
|
: undefined,
|
|
17
17
|
channel: Channels_1.Channels.channelFromRaw(invite.channel),
|
|
18
18
|
inviter: invite.inviter !== undefined
|
|
@@ -47,7 +47,7 @@ class Invites {
|
|
|
47
47
|
type: invite.type,
|
|
48
48
|
code: invite.code,
|
|
49
49
|
guild: invite.guild !== undefined
|
|
50
|
-
? Guilds_1.Guilds.
|
|
50
|
+
? Guilds_1.Guilds.partialGuildToRaw(invite.guild)
|
|
51
51
|
: undefined,
|
|
52
52
|
channel: Channels_1.Channels.channelToRaw(invite.channel),
|
|
53
53
|
inviter: invite.inviter !== undefined
|
|
@@ -4,12 +4,13 @@ import type { RawChannel, Channel } from "./channel";
|
|
|
4
4
|
import type { timestamp } from "./common";
|
|
5
5
|
import type { RawGuild, RawGuildMember, Guild, GuildMember } from "./guild";
|
|
6
6
|
import type { RawGuildScheduledEvent, GuildScheduledEvent } from "./guild-scheduled-event";
|
|
7
|
+
import type { RawRole, Role } from "./role";
|
|
7
8
|
import type { RawUser, User } from "./user";
|
|
8
9
|
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-structure */
|
|
9
10
|
export interface RawInvite {
|
|
10
11
|
type: InviteTypes;
|
|
11
12
|
code: string;
|
|
12
|
-
guild?: RawGuild
|
|
13
|
+
guild?: Partial<RawGuild>;
|
|
13
14
|
channel: RawChannel;
|
|
14
15
|
inviter?: RawUser;
|
|
15
16
|
target_type?: InviteTargetTypes;
|
|
@@ -21,6 +22,7 @@ export interface RawInvite {
|
|
|
21
22
|
stage_instance?: RawInviteStageInstance;
|
|
22
23
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
23
24
|
flags?: GuildInviteFlags;
|
|
25
|
+
roles?: Array<RawRole>;
|
|
24
26
|
}
|
|
25
27
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
26
28
|
export interface RawInviteMetadata {
|
|
@@ -41,7 +43,7 @@ export interface RawInviteStageInstance {
|
|
|
41
43
|
export interface Invite {
|
|
42
44
|
type: InviteTypes;
|
|
43
45
|
code: string;
|
|
44
|
-
guild?: Guild
|
|
46
|
+
guild?: Partial<Guild>;
|
|
45
47
|
channel: Channel;
|
|
46
48
|
inviter?: User;
|
|
47
49
|
targetType?: InviteTargetTypes;
|
|
@@ -53,6 +55,7 @@ export interface Invite {
|
|
|
53
55
|
stageInstance?: InviteStageInstance;
|
|
54
56
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
55
57
|
flags?: GuildInviteFlags;
|
|
58
|
+
roles?: Array<Role>;
|
|
56
59
|
}
|
|
57
60
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
58
61
|
export interface InviteMetadata {
|
package/dist/package.json
CHANGED