seyfert 1.1.1 → 1.2.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/lib/api/Routes/applications.d.ts +2 -2
- package/lib/api/Routes/channels.d.ts +2 -2
- package/lib/api/Routes/gateway.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -1
- package/lib/api/Routes/interactions.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/Routes/stage-instances.d.ts +2 -2
- package/lib/api/Routes/stickers.d.ts +2 -2
- package/lib/api/Routes/users.d.ts +2 -2
- package/lib/api/Routes/voice.d.ts +2 -2
- package/lib/api/Routes/webhooks.d.ts +2 -2
- package/lib/builders/ActionRow.d.ts +2 -1
- package/lib/builders/ActionRow.js +3 -3
- package/lib/builders/Base.d.ts +1 -1
- package/lib/builders/Button.d.ts +2 -1
- package/lib/builders/Button.js +2 -2
- package/lib/builders/Embed.d.ts +2 -1
- package/lib/builders/Modal.d.ts +9 -2
- package/lib/builders/Modal.js +12 -3
- package/lib/builders/SelectMenu.d.ts +18 -1
- package/lib/builders/SelectMenu.js +36 -12
- package/lib/builders/index.d.ts +1 -1
- package/lib/builders/index.js +9 -9
- package/lib/builders/types.d.ts +1 -1
- package/lib/cache/index.d.ts +5 -5
- package/lib/cache/index.js +3 -3
- package/lib/cache/resources/default/base.d.ts +1 -1
- package/lib/cache/resources/default/guild-based.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -1
- package/lib/cache/resources/presence.d.ts +1 -1
- package/lib/cache/resources/stage-instances.d.ts +1 -1
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/client/base.d.ts +4 -3
- package/lib/client/client.d.ts +2 -1
- package/lib/client/client.js +2 -2
- package/lib/client/httpclient.d.ts +2 -1
- package/lib/client/httpclient.js +3 -3
- package/lib/client/oninteractioncreate.js +11 -12
- package/lib/client/onmessagecreate.js +2 -3
- package/lib/client/workerclient.d.ts +3 -2
- package/lib/client/workerclient.js +4 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +4 -3
- package/lib/commands/applications/chatcontext.d.ts +6 -9
- package/lib/commands/applications/chatcontext.js +6 -17
- package/lib/commands/applications/menu.d.ts +2 -1
- package/lib/commands/applications/menucontext.d.ts +4 -8
- package/lib/commands/applications/menucontext.js +7 -20
- package/lib/commands/basecontex.d.ts +15 -0
- package/lib/commands/basecontex.js +34 -0
- package/lib/commands/decorators.d.ts +2 -1
- package/lib/commands/decorators.js +4 -4
- package/lib/commands/handler.js +4 -3
- package/lib/commands/optionresolver.d.ts +3 -3
- package/lib/commands/optionresolver.js +14 -14
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.js +0 -1
- package/lib/common/it/constants.d.ts +3 -1
- package/lib/common/it/constants.js +2 -0
- package/lib/common/shorters/channels.d.ts +1 -1
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/guilds.d.ts +1 -1
- package/lib/common/shorters/guilds.js +6 -1
- package/lib/common/shorters/members.d.ts +6 -1
- package/lib/common/shorters/members.js +25 -2
- package/lib/common/shorters/webhook.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +2 -1
- package/lib/common/types/util.d.ts +1 -1
- package/lib/common/types/write.d.ts +1 -1
- package/lib/components/ActionRow.d.ts +4 -3
- package/lib/components/ActionRow.js +6 -3
- package/lib/components/BaseComponent.d.ts +18 -0
- package/lib/components/BaseComponent.js +21 -0
- package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
- package/lib/components/BaseSelectMenuComponent.js +22 -0
- package/lib/components/ButtonComponent.d.ts +14 -14
- package/lib/components/ButtonComponent.js +36 -25
- package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
- package/lib/components/ChannelSelectMenuComponent.js +6 -5
- package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
- package/lib/components/MentionableSelectMenuComponent.js +4 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
- package/lib/components/RoleSelectMenuComponent.js +4 -1
- package/lib/components/StringSelectMenuComponent.d.ts +3 -4
- package/lib/components/StringSelectMenuComponent.js +3 -5
- package/lib/components/TextInputComponent.d.ts +10 -5
- package/lib/components/TextInputComponent.js +24 -7
- package/lib/components/UserSelectMenuComponent.d.ts +3 -2
- package/lib/components/UserSelectMenuComponent.js +4 -1
- package/lib/components/command.d.ts +6 -5
- package/lib/components/command.js +4 -0
- package/lib/components/componentcontext.d.ts +42 -0
- package/lib/components/componentcontext.js +79 -0
- package/lib/components/handler.d.ts +3 -3
- package/lib/components/handler.js +9 -4
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +9 -9
- package/lib/events/handler.d.ts +2 -1
- package/lib/events/hooks/application_command.d.ts +2 -2
- package/lib/events/hooks/auto_moderation.d.ts +4 -4
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -4
- package/lib/events/hooks/guild.d.ts +42 -42
- package/lib/events/hooks/integration.d.ts +19 -19
- package/lib/events/hooks/interactions.d.ts +2 -2
- package/lib/events/hooks/invite.d.ts +5 -5
- package/lib/events/hooks/message.d.ts +6 -5
- package/lib/events/hooks/presence.d.ts +7 -7
- package/lib/events/hooks/stage.d.ts +4 -4
- package/lib/events/hooks/thread.d.ts +49 -49
- package/lib/events/hooks/typing.d.ts +2 -2
- package/lib/events/hooks/user.d.ts +1 -1
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +3 -6
- package/lib/index.js +6 -7
- package/lib/langs/handler.d.ts +2 -1
- package/lib/structures/AutoModerationRule.d.ts +3 -2
- package/lib/structures/ClientUser.d.ts +1 -1
- package/lib/structures/Guild.d.ts +27 -27
- package/lib/structures/GuildEmoji.d.ts +2 -1
- package/lib/structures/GuildMember.d.ts +15 -6
- package/lib/structures/GuildMember.js +32 -6
- package/lib/structures/GuildPreview.d.ts +1 -1
- package/lib/structures/GuildRole.d.ts +2 -1
- package/lib/structures/GuildTemplate.d.ts +3 -2
- package/lib/structures/Interaction.d.ts +3 -3
- package/lib/structures/Interaction.js +33 -33
- package/lib/structures/Message.d.ts +5 -4
- package/lib/structures/Sticker.d.ts +2 -1
- package/lib/structures/User.d.ts +6 -3
- package/lib/structures/Webhook.d.ts +63 -4
- package/lib/structures/Webhook.js +53 -0
- package/lib/structures/channels.d.ts +2 -2
- package/lib/structures/extra/BaseGuild.d.ts +2 -1
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/BitField.d.ts +2 -2
- package/lib/structures/extra/BitField.js +2 -2
- package/lib/structures/extra/Permissions.d.ts +1 -1
- package/lib/structures/extra/functions.d.ts +2 -1
- package/lib/structures/extra/functions.js +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +17 -0
- package/lib/websocket/SharedTypes.d.ts +2 -1
- package/lib/websocket/SharedTypes.js +1 -0
- package/lib/websocket/discord/shard.d.ts +2 -1
- package/lib/websocket/discord/shard.js +30 -41
- package/lib/websocket/discord/sharder.d.ts +3 -2
- package/lib/websocket/discord/sharder.js +7 -6
- package/lib/websocket/discord/shared.d.ts +2 -1
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.d.ts +3 -2
- package/lib/websocket/discord/workermanager.js +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { APIGuild, GatewayGuildCreateDispatchData } from 'discord-api-types/v10';
|
|
1
2
|
import type { UsingClient } from '../commands';
|
|
2
|
-
import type {
|
|
3
|
-
import type { StructPropState, StructStates, ToClass } from '../common/types/util';
|
|
3
|
+
import type { ObjectToLower, StructPropState, StructStates, ToClass } from '../common/types/util';
|
|
4
4
|
import { GuildEmoji } from './GuildEmoji';
|
|
5
5
|
import { GuildMember } from './GuildMember';
|
|
6
6
|
import { GuildRole } from './GuildRole';
|
|
@@ -23,56 +23,56 @@ export declare class Guild<State extends StructStates = 'api'> extends Guild_bas
|
|
|
23
23
|
get maxEmojis(): MaxEmojis;
|
|
24
24
|
fetchOwner(force?: boolean): Promise<null> | Promise<GuildMember>;
|
|
25
25
|
templates: {
|
|
26
|
-
fetch: (code: string) => Promise<import("discord-api-types/
|
|
27
|
-
list: () => Promise<import("discord-api-types/
|
|
28
|
-
create: (body: import("discord-api-types/
|
|
29
|
-
sync: (code: string) => Promise<import("discord-api-types/
|
|
30
|
-
edit: (code: string, body: import("discord-api-types/utils/internals").AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<import("discord-api-types/
|
|
31
|
-
delete: (code: string) => Promise<import("discord-api-types/
|
|
26
|
+
fetch: (code: string) => Promise<import("discord-api-types/v10").APITemplate>;
|
|
27
|
+
list: () => Promise<import("discord-api-types/v10").RESTGetAPIGuildTemplatesResult>;
|
|
28
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody) => Promise<import("discord-api-types/v10").APITemplate>;
|
|
29
|
+
sync: (code: string) => Promise<import("discord-api-types/v10").APITemplate>;
|
|
30
|
+
edit: (code: string, body: import("discord-api-types/utils/internals").AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody>>) => Promise<import("discord-api-types/v10").APITemplate>;
|
|
31
|
+
delete: (code: string) => Promise<import("discord-api-types/v10").APITemplate>;
|
|
32
32
|
};
|
|
33
33
|
stickers: {
|
|
34
34
|
list: () => Promise<Sticker[]>;
|
|
35
35
|
create: (payload: import("./Sticker").CreateStickerBodyRequest, reason?: string | undefined) => Promise<Sticker>;
|
|
36
|
-
edit: (stickerId: string, body: import("discord-api-types/
|
|
36
|
+
edit: (stickerId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildStickerJSONBody, reason?: string | undefined) => Promise<Sticker>;
|
|
37
37
|
fetch: (stickerId: string, force?: boolean) => Promise<Sticker>;
|
|
38
38
|
delete: (stickerId: string, reason?: string | undefined) => Promise<void>;
|
|
39
39
|
};
|
|
40
40
|
members: {
|
|
41
41
|
resolve: (resolve: import("../common").GuildMemberResolvable) => Promise<GuildMember | undefined>;
|
|
42
|
-
search: (query?: import("discord-api-types/
|
|
43
|
-
unban: (id: string, body?: import("discord-api-types/
|
|
44
|
-
ban: (id: string, body?: import("discord-api-types/
|
|
42
|
+
search: (query?: import("discord-api-types/v10").RESTGetAPIGuildMembersSearchQuery | undefined) => Promise<GuildMember[]>;
|
|
43
|
+
unban: (id: string, body?: import("discord-api-types/v10").RESTPutAPIGuildBanJSONBody | undefined, reason?: string | undefined) => Promise<void>;
|
|
44
|
+
ban: (id: string, body?: import("discord-api-types/v10").RESTPutAPIGuildBanJSONBody | undefined, reason?: string | undefined) => Promise<void>;
|
|
45
45
|
kick: (id: string, reason?: string | undefined) => Promise<void>;
|
|
46
|
-
edit: (id: string, body: import("discord-api-types/
|
|
47
|
-
add: (id: string, body: import("discord-api-types/
|
|
46
|
+
edit: (id: string, body: import("discord-api-types/v10").RESTPatchAPIGuildMemberJSONBody, reason?: string | undefined) => Promise<GuildMember>;
|
|
47
|
+
add: (id: string, body: import("discord-api-types/v10").RESTPutAPIGuildMemberJSONBody) => Promise<GuildMember | undefined>;
|
|
48
48
|
fetch: (memberId: string, force?: boolean) => Promise<GuildMember>;
|
|
49
|
-
list: (query?: import("discord-api-types/
|
|
49
|
+
list: (query?: import("discord-api-types/v10").RESTGetAPIGuildMembersQuery | undefined, force?: boolean) => Promise<GuildMember[]>;
|
|
50
50
|
};
|
|
51
51
|
moderationRules: {
|
|
52
|
-
list: () => Promise<import("discord-api-types/
|
|
53
|
-
create: (body: import("discord-api-types/
|
|
52
|
+
list: () => Promise<import("discord-api-types/v10").RESTGetAPIAutoModerationRulesResult>;
|
|
53
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIAutoModerationRuleJSONBody) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
54
54
|
delete: (ruleId: string, reason?: string | undefined) => Promise<never>;
|
|
55
|
-
fetch: (ruleId: string) => Promise<import("discord-api-types/
|
|
56
|
-
edit: (ruleId: string, body: import("discord-api-types/
|
|
55
|
+
fetch: (ruleId: string) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
56
|
+
edit: (ruleId: string, body: import("discord-api-types/v10").RESTPatchAPIAutoModerationRuleJSONBody, reason?: string | undefined) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
57
57
|
};
|
|
58
58
|
roles: {
|
|
59
|
-
create: (body: import("discord-api-types/
|
|
59
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIGuildRoleJSONBody) => Promise<any>;
|
|
60
60
|
list: (force?: boolean) => Promise<GuildRole[]>;
|
|
61
|
-
edit: (roleId: string, body: import("discord-api-types/
|
|
61
|
+
edit: (roleId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildRoleJSONBody, reason?: string | undefined) => Promise<any>;
|
|
62
62
|
delete: (roleId: string, reason?: string | undefined) => Promise<void | undefined>;
|
|
63
|
-
editPositions: (body: import("discord-api-types/
|
|
63
|
+
editPositions: (body: import("discord-api-types/v10").RESTPatchAPIGuildRolePositionsJSONBody) => Promise<GuildRole[]>;
|
|
64
64
|
};
|
|
65
65
|
channels: {
|
|
66
66
|
list: (force?: boolean) => Promise<import("./channels").AllChannels[]>;
|
|
67
67
|
fetch: (id: string, force?: boolean) => Promise<import("./channels").AllChannels>;
|
|
68
|
-
create: (body: import("discord-api-types/
|
|
68
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIGuildChannelJSONBody) => Promise<import("./channels").AllChannels>;
|
|
69
69
|
delete: (id: string, reason?: string | undefined) => Promise<import("./channels").AllChannels>;
|
|
70
|
-
edit: (id: string, body: import("discord-api-types/
|
|
71
|
-
editPositions: (body: import("discord-api-types/
|
|
70
|
+
edit: (id: string, body: import("discord-api-types/v10").RESTPatchAPIChannelJSONBody, reason?: string | undefined) => Promise<import("./channels").AllChannels>;
|
|
71
|
+
editPositions: (body: import("discord-api-types/v10").RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<never>;
|
|
72
72
|
};
|
|
73
73
|
emojis: {
|
|
74
|
-
edit: (emojiId: string, body: import("discord-api-types/
|
|
75
|
-
create: (body: Omit<import("discord-api-types/
|
|
74
|
+
edit: (emojiId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildEmojiJSONBody, reason?: string | undefined) => Promise<GuildEmoji>;
|
|
75
|
+
create: (body: Omit<import("discord-api-types/v10").RESTPostAPIGuildEmojiJSONBody, "image"> & {
|
|
76
76
|
image: import("../common").ImageResolvable;
|
|
77
77
|
}) => Promise<void>;
|
|
78
78
|
fetch: (emojiId: string, force?: boolean) => Promise<GuildEmoji>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { APIEmoji, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildEmojiJSONBody } from 'discord-api-types/v10';
|
|
1
2
|
import type { BaseImageURLOptions } from '../api';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
|
-
import type {
|
|
4
|
+
import type { EmojiShorter, MethodContext, ObjectToLower } from '../common';
|
|
4
5
|
import { DiscordBase } from './extra/DiscordBase';
|
|
5
6
|
export interface GuildEmoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'id'>> {
|
|
6
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { APIGuildMember, APIInteractionDataResolvedGuildMember, APIUser, GatewayGuildMemberAddDispatchData, GatewayGuildMemberUpdateDispatchData, MakeRequired, MessageCreateBodyRequest, ObjectToLower, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersSearchQuery, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildMemberJSONBody, ToClass } from '../common';
|
|
2
1
|
import { DiscordBase } from './extra/DiscordBase';
|
|
3
2
|
export type GuildMemberData = APIGuildMember | GatewayGuildMemberUpdateDispatchData | GatewayGuildMemberAddDispatchData | APIInteractionDataResolvedGuildMember;
|
|
3
|
+
import type { APIGuildMember, APIInteractionDataResolvedGuildMember, APIUser, GatewayGuildMemberAddDispatchData, GatewayGuildMemberUpdateDispatchData, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersSearchQuery, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildMemberJSONBody } from 'discord-api-types/v10';
|
|
4
4
|
import type { UsingClient } from '../commands';
|
|
5
|
+
import type { MakeRequired, MessageCreateBodyRequest, ObjectToLower, ToClass } from '../common';
|
|
5
6
|
import type { ImageOptions, MethodContext } from '../common/types/options';
|
|
6
7
|
import type { GuildMemberResolvable } from '../common/types/resolvables';
|
|
7
8
|
import { User } from './User';
|
|
@@ -25,12 +26,12 @@ export declare class BaseGuildMember extends DiscordBase {
|
|
|
25
26
|
ban(body?: RESTPutAPIGuildBanJSONBody, reason?: string): Promise<void>;
|
|
26
27
|
kick(reason?: string): Promise<void>;
|
|
27
28
|
edit(body: RESTPatchAPIGuildMemberJSONBody, reason?: string): Promise<GuildMember>;
|
|
28
|
-
presence(): import("..").ReturnCache<(Omit<import("discord-api-types/
|
|
29
|
+
presence(): import("..").ReturnCache<(Omit<import("discord-api-types/v10").GatewayPresenceUpdate, "user"> & {
|
|
29
30
|
id: string;
|
|
30
31
|
} & {
|
|
31
32
|
guild_id: string;
|
|
32
33
|
}) | undefined>;
|
|
33
|
-
voice(): import("..").ReturnCache<(Omit<import("discord-api-types/
|
|
34
|
+
voice(): import("..").ReturnCache<(Omit<import("discord-api-types/v10").GatewayVoiceState, "member"> & {
|
|
34
35
|
guild_id: string;
|
|
35
36
|
} & {
|
|
36
37
|
guild_id: string;
|
|
@@ -38,10 +39,13 @@ export declare class BaseGuildMember extends DiscordBase {
|
|
|
38
39
|
toString(): string;
|
|
39
40
|
private patch;
|
|
40
41
|
get roles(): {
|
|
41
|
-
|
|
42
|
+
keys: string[];
|
|
43
|
+
list: (force?: boolean) => Promise<import("./GuildRole").GuildRole[]>;
|
|
42
44
|
add: (id: string) => void;
|
|
43
45
|
remove: (id: string) => Promise<never>;
|
|
44
|
-
permissions: () => Promise<PermissionsBitField>;
|
|
46
|
+
permissions: (force?: boolean) => Promise<PermissionsBitField>;
|
|
47
|
+
sorted: (force?: boolean) => Promise<import("./GuildRole").GuildRole[]>;
|
|
48
|
+
highest: (force?: boolean) => Promise<import("./GuildRole").GuildRole>;
|
|
45
49
|
};
|
|
46
50
|
static methods({ client, guildId }: MethodContext<{
|
|
47
51
|
guildId: string;
|
|
@@ -67,6 +71,7 @@ export declare class GuildMember extends BaseGuildMember {
|
|
|
67
71
|
/** the choosen guild id */
|
|
68
72
|
readonly guildId: string;
|
|
69
73
|
user: User;
|
|
74
|
+
private __me?;
|
|
70
75
|
constructor(client: UsingClient, data: GuildMemberData, user: APIUser | User,
|
|
71
76
|
/** the choosen guild id */
|
|
72
77
|
guildId: string);
|
|
@@ -82,7 +87,11 @@ export declare class GuildMember extends BaseGuildMember {
|
|
|
82
87
|
avatarURL(options?: ImageOptions): string;
|
|
83
88
|
dynamicAvatarURL(options?: ImageOptions): string;
|
|
84
89
|
bannerURL(options?: ImageOptions): string | undefined;
|
|
85
|
-
fetchPermissions(): Promise<PermissionsBitField>;
|
|
90
|
+
fetchPermissions(force?: boolean): Promise<PermissionsBitField>;
|
|
91
|
+
manageable(force?: boolean): Promise<boolean>;
|
|
92
|
+
bannable(force?: boolean): Promise<boolean>;
|
|
93
|
+
kickable(force?: boolean): Promise<boolean>;
|
|
94
|
+
moderatable(force?: boolean): Promise<boolean>;
|
|
86
95
|
}
|
|
87
96
|
export interface UnavailableMember {
|
|
88
97
|
pending: true;
|
|
@@ -54,12 +54,15 @@ class BaseGuildMember extends DiscordBase_1.DiscordBase {
|
|
|
54
54
|
}
|
|
55
55
|
get roles() {
|
|
56
56
|
return {
|
|
57
|
-
|
|
57
|
+
keys: Object.freeze(this._roles.concat(this.guildId)),
|
|
58
|
+
list: (force = false) => this.client.roles
|
|
59
|
+
.list(this.guildId, force)
|
|
60
|
+
.then(roles => roles.filter(role => this.roles.keys.includes(role.id))),
|
|
58
61
|
add: (id) => this.client.members.addRole(this.guildId, this.id, id),
|
|
59
62
|
remove: (id) => this.client.members.removeRole(this.guildId, this.id, id),
|
|
60
|
-
permissions:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
permissions: (force = false) => this.roles.list(force).then(roles => new Permissions_1.PermissionsBitField(roles.map(x => BigInt(x.permissions.bits)))),
|
|
64
|
+
sorted: (force = false) => this.roles.list(force).then(roles => roles.sort((a, b) => b.position - a.position)),
|
|
65
|
+
highest: (force = false) => this.roles.sorted(force).then(roles => roles[0]),
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
static methods({ client, guildId }) {
|
|
@@ -84,6 +87,7 @@ exports.BaseGuildMember = BaseGuildMember;
|
|
|
84
87
|
class GuildMember extends BaseGuildMember {
|
|
85
88
|
guildId;
|
|
86
89
|
user;
|
|
90
|
+
__me;
|
|
87
91
|
constructor(client, data, user,
|
|
88
92
|
/** the choosen guild id */
|
|
89
93
|
guildId) {
|
|
@@ -128,10 +132,32 @@ class GuildMember extends BaseGuildMember {
|
|
|
128
132
|
bannerURL(options) {
|
|
129
133
|
return this.user.bannerURL(options);
|
|
130
134
|
}
|
|
131
|
-
async fetchPermissions() {
|
|
135
|
+
async fetchPermissions(force = false) {
|
|
132
136
|
if ('permissions' in this)
|
|
133
137
|
return this.permissions;
|
|
134
|
-
return this.roles.permissions();
|
|
138
|
+
return this.roles.permissions(force);
|
|
139
|
+
}
|
|
140
|
+
async manageable(force = false) {
|
|
141
|
+
this.__me = await this.client.guilds.fetchSelf(this.guildId, force);
|
|
142
|
+
const ownerId = (await this.client.guilds.fetch(this.guildId, force)).ownerId;
|
|
143
|
+
if (this.user.id === ownerId)
|
|
144
|
+
return false;
|
|
145
|
+
if (this.user.id === this.client.botId)
|
|
146
|
+
return false;
|
|
147
|
+
if (this.client.botId === ownerId)
|
|
148
|
+
return true;
|
|
149
|
+
return (await this.__me.roles.highest()).position > (await this.roles.highest(force)).position;
|
|
150
|
+
}
|
|
151
|
+
async bannable(force = false) {
|
|
152
|
+
return (await this.manageable(force)) && (await this.__me.fetchPermissions(force)).has('BanMembers');
|
|
153
|
+
}
|
|
154
|
+
async kickable(force = false) {
|
|
155
|
+
return (await this.manageable(force)) && (await this.__me.fetchPermissions(force)).has('KickMembers');
|
|
156
|
+
}
|
|
157
|
+
async moderatable(force = false) {
|
|
158
|
+
return (!(await this.roles.permissions(force)).has('Administrator') &&
|
|
159
|
+
(await this.manageable(force)) &&
|
|
160
|
+
(await this.__me.fetchPermissions(force)).has('KickMembers'));
|
|
135
161
|
}
|
|
136
162
|
}
|
|
137
163
|
exports.GuildMember = GuildMember;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { APIRole, RESTPatchAPIGuildRoleJSONBody, RESTPatchAPIGuildRolePositionsJSONBody, RESTPostAPIGuildRoleJSONBody } from 'discord-api-types/v10';
|
|
1
2
|
import type { UsingClient } from '../commands';
|
|
2
|
-
import type {
|
|
3
|
+
import type { MethodContext, ObjectToLower } from '../common';
|
|
3
4
|
import { DiscordBase } from './extra/DiscordBase';
|
|
4
5
|
import { PermissionsBitField } from './extra/Permissions';
|
|
5
6
|
export interface GuildRole extends DiscordBase, ObjectToLower<Omit<APIRole, 'permissions'>> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { APITemplate, RESTPatchAPIGuildTemplateJSONBody, RESTPostAPIGuildTemplatesJSONBody } from 'discord-api-types/v10';
|
|
1
2
|
import type { UsingClient } from '../commands';
|
|
2
|
-
import type {
|
|
3
|
+
import type { MethodContext, ObjectToLower } from '../common';
|
|
3
4
|
import { Base } from './extra/Base';
|
|
4
5
|
export interface GuildTemplate extends Base, ObjectToLower<APITemplate> {
|
|
5
6
|
}
|
|
@@ -14,7 +15,7 @@ export declare class GuildTemplate extends Base {
|
|
|
14
15
|
guildId: string;
|
|
15
16
|
}>): {
|
|
16
17
|
fetch: (code: string) => Promise<APITemplate>;
|
|
17
|
-
list: () => Promise<import("discord-api-types/
|
|
18
|
+
list: () => Promise<import("discord-api-types/v10").RESTGetAPIGuildTemplatesResult>;
|
|
18
19
|
create: (body: RESTPostAPIGuildTemplatesJSONBody) => Promise<APITemplate>;
|
|
19
20
|
sync: (code: string) => Promise<APITemplate>;
|
|
20
21
|
edit: (code: string, body: RESTPatchAPIGuildTemplateJSONBody) => Promise<APITemplate>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIInteraction, type APIInteractionResponse, type APIInteractionResponseChannelMessageWithSource, type APIInteractionResponseDeferredChannelMessageWithSource, type APIInteractionResponseDeferredMessageUpdate, type APIInteractionResponsePong, type APIInteractionResponseUpdateMessage, type APIMessageApplicationCommandInteraction, type APIMessageApplicationCommandInteractionData, type APIMessageButtonInteractionData, type APIMessageComponentInteraction, type APIMessageComponentSelectMenuInteraction, type APIMessageStringSelectInteractionData, type APIModalSubmission, type APIModalSubmitInteraction, type APIUserApplicationCommandInteraction, type APIUserApplicationCommandInteractionData, ApplicationCommandType, ComponentType, type GatewayInteractionCreateDispatchData, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody } from 'discord-api-types/v10';
|
|
1
2
|
import { OptionResolver, type UsingClient } from '../commands';
|
|
2
|
-
import type {
|
|
3
|
-
import { ApplicationCommandType, ComponentType, InteractionResponseType, InteractionType } from '../common';
|
|
3
|
+
import type { ObjectToLower, OmitInsert, ToClass, When } from '../common';
|
|
4
4
|
import type { ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MessageCreateBodyRequest, MessageUpdateBodyRequest, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest } from '../common/types/write';
|
|
5
5
|
import { InteractionGuildMember, type AllChannels } from './';
|
|
6
6
|
import { GuildRole } from './GuildRole';
|
|
@@ -32,7 +32,7 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
|
|
|
32
32
|
private matchReplied;
|
|
33
33
|
reply(body: ReplyInteractionBody): Promise<void>;
|
|
34
34
|
deferReply(flags?: MessageFlags): Promise<void>;
|
|
35
|
-
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): StringSelectMenuInteraction<string[]> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("discord-api-types/
|
|
35
|
+
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): StringSelectMenuInteraction<string[]> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("discord-api-types/v10").APIPingInteraction>;
|
|
36
36
|
fetchGuild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
|
|
37
37
|
}
|
|
38
38
|
export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | BaseInteraction;
|
|
@@ -10,10 +10,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ModalSubmitInteraction = exports.MessageCommandInteraction = exports.UserCommandInteraction = exports.ChatInputCommandInteraction = exports.UserSelectMenuInteraction = exports.RoleSelectMenuInteraction = exports.MentionableSelectMenuInteraction = exports.ChannelSelectMenuInteraction = exports.StringSelectMenuInteraction = exports.SelectMenuInteraction = exports.ButtonInteraction = exports.ComponentInteraction = exports.ApplicationCommandInteraction = exports.Interaction = exports.AutocompleteInteraction = exports.BaseInteraction = void 0;
|
|
13
|
+
const v10_1 = require("discord-api-types/v10");
|
|
13
14
|
const ts_mixer_1 = require("ts-mixer");
|
|
14
15
|
const builders_1 = require("../builders");
|
|
15
16
|
const commands_1 = require("../commands");
|
|
16
|
-
const common_1 = require("../common");
|
|
17
17
|
const _1 = require("./");
|
|
18
18
|
const GuildRole_1 = require("./GuildRole");
|
|
19
19
|
const Message_1 = require("./Message");
|
|
@@ -50,12 +50,12 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
50
50
|
}
|
|
51
51
|
static transformBodyRequest(body) {
|
|
52
52
|
switch (body.type) {
|
|
53
|
-
case
|
|
54
|
-
case
|
|
55
|
-
case
|
|
53
|
+
case v10_1.InteractionResponseType.ApplicationCommandAutocompleteResult:
|
|
54
|
+
case v10_1.InteractionResponseType.DeferredMessageUpdate:
|
|
55
|
+
case v10_1.InteractionResponseType.DeferredChannelMessageWithSource:
|
|
56
56
|
return body;
|
|
57
|
-
case
|
|
58
|
-
case
|
|
57
|
+
case v10_1.InteractionResponseType.ChannelMessageWithSource:
|
|
58
|
+
case v10_1.InteractionResponseType.UpdateMessage:
|
|
59
59
|
return {
|
|
60
60
|
type: body.type,
|
|
61
61
|
// @ts-ignore
|
|
@@ -68,7 +68,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
68
68
|
attachments: body.data?.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
|
-
case
|
|
71
|
+
case v10_1.InteractionResponseType.Modal:
|
|
72
72
|
return {
|
|
73
73
|
type: body.type,
|
|
74
74
|
data: body.data instanceof builders_1.Modal
|
|
@@ -122,7 +122,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
122
122
|
}
|
|
123
123
|
deferReply(flags) {
|
|
124
124
|
return this.reply({
|
|
125
|
-
type:
|
|
125
|
+
type: v10_1.InteractionResponseType.DeferredChannelMessageWithSource,
|
|
126
126
|
data: {
|
|
127
127
|
flags,
|
|
128
128
|
},
|
|
@@ -130,35 +130,35 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
130
130
|
}
|
|
131
131
|
static from(client, gateway, __reply) {
|
|
132
132
|
switch (gateway.type) {
|
|
133
|
-
case
|
|
133
|
+
case v10_1.InteractionType.ApplicationCommandAutocomplete:
|
|
134
134
|
return new AutocompleteInteraction(client, gateway, __reply);
|
|
135
135
|
// biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
|
|
136
|
-
case
|
|
136
|
+
case v10_1.InteractionType.ApplicationCommand:
|
|
137
137
|
switch (gateway.data.type) {
|
|
138
|
-
case
|
|
138
|
+
case v10_1.ApplicationCommandType.ChatInput:
|
|
139
139
|
return new ChatInputCommandInteraction(client, gateway, __reply);
|
|
140
|
-
case
|
|
140
|
+
case v10_1.ApplicationCommandType.User:
|
|
141
141
|
return new UserCommandInteraction(client, gateway, __reply);
|
|
142
|
-
case
|
|
142
|
+
case v10_1.ApplicationCommandType.Message:
|
|
143
143
|
return new MessageCommandInteraction(client, gateway, __reply);
|
|
144
144
|
}
|
|
145
145
|
// biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
|
|
146
|
-
case
|
|
146
|
+
case v10_1.InteractionType.MessageComponent:
|
|
147
147
|
switch (gateway.data.component_type) {
|
|
148
|
-
case
|
|
148
|
+
case v10_1.ComponentType.Button:
|
|
149
149
|
return new ButtonInteraction(client, gateway, __reply);
|
|
150
|
-
case
|
|
150
|
+
case v10_1.ComponentType.ChannelSelect:
|
|
151
151
|
return new ChannelSelectMenuInteraction(client, gateway, __reply);
|
|
152
|
-
case
|
|
152
|
+
case v10_1.ComponentType.RoleSelect:
|
|
153
153
|
return new RoleSelectMenuInteraction(client, gateway, __reply);
|
|
154
|
-
case
|
|
154
|
+
case v10_1.ComponentType.MentionableSelect:
|
|
155
155
|
return new MentionableSelectMenuInteraction(client, gateway, __reply);
|
|
156
|
-
case
|
|
156
|
+
case v10_1.ComponentType.UserSelect:
|
|
157
157
|
return new UserSelectMenuInteraction(client, gateway, __reply);
|
|
158
|
-
case
|
|
158
|
+
case v10_1.ComponentType.StringSelect:
|
|
159
159
|
return new StringSelectMenuInteraction(client, gateway, __reply);
|
|
160
160
|
}
|
|
161
|
-
case
|
|
161
|
+
case v10_1.InteractionType.ModalSubmit:
|
|
162
162
|
return new ModalSubmitInteraction(client, gateway);
|
|
163
163
|
default:
|
|
164
164
|
return new BaseInteraction(client, gateway);
|
|
@@ -181,7 +181,7 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
181
181
|
return this.options.getAutocompleteValue() ?? '';
|
|
182
182
|
}
|
|
183
183
|
respond(choices) {
|
|
184
|
-
return super.reply({ data: { choices }, type:
|
|
184
|
+
return super.reply({ data: { choices }, type: v10_1.InteractionResponseType.ApplicationCommandAutocompleteResult });
|
|
185
185
|
}
|
|
186
186
|
/** @intenal */
|
|
187
187
|
async reply(..._args) {
|
|
@@ -198,7 +198,7 @@ class Interaction extends BaseInteraction {
|
|
|
198
198
|
}
|
|
199
199
|
async write(body, fetchReply) {
|
|
200
200
|
(await this.reply({
|
|
201
|
-
type:
|
|
201
|
+
type: v10_1.InteractionResponseType.ChannelMessageWithSource,
|
|
202
202
|
data: body,
|
|
203
203
|
}));
|
|
204
204
|
if (fetchReply)
|
|
@@ -207,7 +207,7 @@ class Interaction extends BaseInteraction {
|
|
|
207
207
|
}
|
|
208
208
|
modal(body) {
|
|
209
209
|
return this.reply({
|
|
210
|
-
type:
|
|
210
|
+
type: v10_1.InteractionResponseType.Modal,
|
|
211
211
|
data: body,
|
|
212
212
|
});
|
|
213
213
|
}
|
|
@@ -255,7 +255,7 @@ class Interaction extends BaseInteraction {
|
|
|
255
255
|
}
|
|
256
256
|
exports.Interaction = Interaction;
|
|
257
257
|
class ApplicationCommandInteraction extends Interaction {
|
|
258
|
-
type =
|
|
258
|
+
type = v10_1.ApplicationCommandType.ChatInput;
|
|
259
259
|
respond(data) {
|
|
260
260
|
return this.reply(data);
|
|
261
261
|
}
|
|
@@ -264,13 +264,13 @@ exports.ApplicationCommandInteraction = ApplicationCommandInteraction;
|
|
|
264
264
|
class ComponentInteraction extends Interaction {
|
|
265
265
|
update(data) {
|
|
266
266
|
return this.reply({
|
|
267
|
-
type:
|
|
267
|
+
type: v10_1.InteractionResponseType.UpdateMessage,
|
|
268
268
|
data,
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
deferUpdate() {
|
|
272
272
|
return this.reply({
|
|
273
|
-
type:
|
|
273
|
+
type: v10_1.InteractionResponseType.DeferredMessageUpdate,
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
get customId() {
|
|
@@ -280,22 +280,22 @@ class ComponentInteraction extends Interaction {
|
|
|
280
280
|
return this.data.componentType;
|
|
281
281
|
}
|
|
282
282
|
isButton() {
|
|
283
|
-
return this.data.componentType ===
|
|
283
|
+
return this.data.componentType === v10_1.ComponentType.Button;
|
|
284
284
|
}
|
|
285
285
|
isChannelSelectMenu() {
|
|
286
|
-
return this.componentType ===
|
|
286
|
+
return this.componentType === v10_1.ComponentType.ChannelSelect;
|
|
287
287
|
}
|
|
288
288
|
isRoleSelectMenu() {
|
|
289
|
-
return this.componentType ===
|
|
289
|
+
return this.componentType === v10_1.ComponentType.RoleSelect;
|
|
290
290
|
}
|
|
291
291
|
isMentionableSelectMenu() {
|
|
292
|
-
return this.componentType ===
|
|
292
|
+
return this.componentType === v10_1.ComponentType.MentionableSelect;
|
|
293
293
|
}
|
|
294
294
|
isUserSelectMenu() {
|
|
295
|
-
return this.componentType ===
|
|
295
|
+
return this.componentType === v10_1.ComponentType.UserSelect;
|
|
296
296
|
}
|
|
297
297
|
isStringSelectMenu() {
|
|
298
|
-
return this.componentType ===
|
|
298
|
+
return this.componentType === v10_1.ComponentType.StringSelect;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
exports.ComponentInteraction = ComponentInteraction;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { APIChannelMention, APIMessage, GatewayMessageCreateDispatchData } from 'discord-api-types/v10';
|
|
1
2
|
import type { ListenerOptions } from '../builders';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
|
-
import type {
|
|
4
|
+
import type { ObjectToLower } from '../common';
|
|
4
5
|
import type { EmojiResolvable } from '../common/types/resolvables';
|
|
5
6
|
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../common/types/write';
|
|
6
7
|
import type { ActionRowMessageComponents } from '../components';
|
|
@@ -26,8 +27,8 @@ export declare class BaseMessage extends DiscordBase {
|
|
|
26
27
|
constructor(client: UsingClient, data: MessageData);
|
|
27
28
|
get user(): User;
|
|
28
29
|
createComponentCollector(options?: ListenerOptions): {
|
|
29
|
-
run
|
|
30
|
-
stop
|
|
30
|
+
run<T extends import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction> = import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction>>(customId: string | RegExp | string[], callback: import("../builders").ComponentCallback<T>): any;
|
|
31
|
+
stop(reason?: string | undefined): any;
|
|
31
32
|
};
|
|
32
33
|
get url(): string;
|
|
33
34
|
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
|
|
@@ -52,7 +53,7 @@ export declare class WebhookMessage extends BaseMessage {
|
|
|
52
53
|
readonly webhookId: string;
|
|
53
54
|
readonly webhookToken: string;
|
|
54
55
|
constructor(client: UsingClient, data: MessageData, webhookId: string, webhookToken: string);
|
|
55
|
-
fetch(): Promise<import("discord-api-types/
|
|
56
|
+
fetch(): Promise<import("discord-api-types/v10").RESTGetAPIWebhookWithTokenResult>;
|
|
56
57
|
edit(body: EditMessageWebhook): Promise<WebhookMessage>;
|
|
57
58
|
write(body: WriteMessageWebhook): Promise<WebhookMessage | null>;
|
|
58
59
|
delete(reason?: string): Promise<never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { APISticker, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIGuildStickerFormDataBody } from 'discord-api-types/v10';
|
|
1
2
|
import type { UsingClient } from '..';
|
|
2
3
|
import type { Attachment } from '../builders';
|
|
3
|
-
import type {
|
|
4
|
+
import type { MethodContext, ObjectToLower } from '../common';
|
|
4
5
|
import { User } from './User';
|
|
5
6
|
import { DiscordBase } from './extra/DiscordBase';
|
|
6
7
|
export interface Sticker extends DiscordBase, ObjectToLower<Omit<APISticker, 'user'>> {
|
package/lib/structures/User.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { APIUser
|
|
1
|
+
import type { APIUser } from 'discord-api-types/v10';
|
|
2
|
+
import type { MessageCreateBodyRequest, ObjectToLower } from '../common';
|
|
2
3
|
import type { ImageOptions } from '../common/types/options';
|
|
3
4
|
import { DiscordBase } from './extra/DiscordBase';
|
|
4
5
|
export interface User extends ObjectToLower<APIUser> {
|
|
@@ -17,8 +18,10 @@ export declare class User extends DiscordBase<APIUser> {
|
|
|
17
18
|
write(body: MessageCreateBodyRequest): Promise<import("./Message").Message>;
|
|
18
19
|
avatarURL(options?: ImageOptions): string;
|
|
19
20
|
bannerURL(options?: ImageOptions): string | undefined;
|
|
20
|
-
presence(): import("..").ReturnCache<(Omit<import("discord-api-types/
|
|
21
|
-
id: string;
|
|
21
|
+
presence(): import("..").ReturnCache<(Omit<import("discord-api-types/v10").GatewayPresenceUpdate, "user"> & {
|
|
22
|
+
id: string; /**
|
|
23
|
+
* Fetch user
|
|
24
|
+
*/
|
|
22
25
|
} & {
|
|
23
26
|
guild_id: string;
|
|
24
27
|
}) | undefined>;
|