seyfert 2.2.1-dev-12848936875.0 → 2.2.1-dev-12856239159.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/commands/applications/chatcontext.d.ts +2 -2
- package/lib/commands/applications/chatcontext.js +1 -5
- package/lib/commands/applications/entrycontext.d.ts +1 -1
- package/lib/commands/applications/entrycontext.js +3 -2
- package/lib/commands/applications/menucontext.d.ts +1 -1
- package/lib/commands/applications/menucontext.js +1 -1
- package/lib/components/componentcontext.d.ts +1 -1
- package/lib/components/componentcontext.js +1 -1
- package/lib/components/modalcontext.d.ts +1 -1
- package/lib/components/modalcontext.js +1 -1
- package/lib/structures/AutoModerationRule.d.ts +3 -1
- package/lib/structures/AutoModerationRule.js +8 -2
- package/lib/structures/GuildBan.d.ts +3 -1
- package/lib/structures/GuildBan.js +8 -2
- package/lib/structures/GuildEmoji.d.ts +3 -1
- package/lib/structures/GuildEmoji.js +8 -4
- package/lib/structures/GuildMember.d.ts +4 -2
- package/lib/structures/GuildMember.js +8 -2
- package/lib/structures/GuildRole.d.ts +3 -1
- package/lib/structures/GuildRole.js +8 -4
- package/lib/structures/GuildTemplate.d.ts +3 -1
- package/lib/structures/GuildTemplate.js +8 -2
- package/lib/structures/Interaction.d.ts +3 -1
- package/lib/structures/Interaction.js +10 -2
- package/lib/structures/Message.d.ts +2 -1
- package/lib/structures/Message.js +10 -3
- package/lib/structures/Sticker.d.ts +3 -1
- package/lib/structures/Sticker.js +9 -3
- package/lib/structures/VoiceState.d.ts +6 -2
- package/lib/structures/VoiceState.js +18 -3
- package/lib/structures/Webhook.d.ts +5 -2
- package/lib/structures/Webhook.js +18 -18
- package/lib/structures/channels.d.ts +16 -11
- package/lib/structures/channels.js +16 -4
- package/lib/structures/extra/BaseGuild.d.ts +4 -1
- package/lib/structures/extra/BaseGuild.js +8 -6
- package/package.json +1 -1
|
@@ -32,9 +32,9 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
|
|
|
32
32
|
editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure | When<InferWithPrefix, MessageStructure, never>, void | WebhookMessageStructure | When<InferWithPrefix, MessageStructure, never>>>;
|
|
33
33
|
followup(body: MessageWebhookCreateBodyRequest): Promise<If<InferWithPrefix, WebhookMessageStructure | MessageStructure, WebhookMessageStructure>>;
|
|
34
34
|
fetchResponse(): Promise<If<InferWithPrefix, WebhookMessageStructure | MessageStructure, WebhookMessageStructure>>;
|
|
35
|
-
channel(mode?: 'rest' | 'flow'): Promise<
|
|
35
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
36
36
|
channel(mode: 'cache'): ReturnCache<If<InferWithPrefix, AllChannels | undefined, AllChannels>>;
|
|
37
|
-
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
37
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
|
|
38
38
|
me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
39
39
|
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
40
40
|
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
@@ -106,11 +106,7 @@ class CommandContext extends basecontext_1.BaseContext {
|
|
|
106
106
|
}
|
|
107
107
|
guild(mode = 'flow') {
|
|
108
108
|
if (!this.guildId)
|
|
109
|
-
return
|
|
110
|
-
? this.client.cache.adapter.isAsync
|
|
111
|
-
? Promise.resolve()
|
|
112
|
-
: undefined
|
|
113
|
-
: Promise.resolve());
|
|
109
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
114
110
|
switch (mode) {
|
|
115
111
|
case 'cache':
|
|
116
112
|
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
@@ -30,7 +30,7 @@ export declare class EntryPointContext<M extends keyof RegisteredMiddlewares = n
|
|
|
30
30
|
fetchResponse(): Promise<WebhookMessageStructure>;
|
|
31
31
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
32
32
|
channel(mode: 'cache'): ReturnCache<AllChannels>;
|
|
33
|
-
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
33
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
|
|
34
34
|
me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
35
35
|
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
36
36
|
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
@@ -48,7 +48,7 @@ class EntryPointContext extends basecontext_1.BaseContext {
|
|
|
48
48
|
return this.interaction.fetchResponse();
|
|
49
49
|
}
|
|
50
50
|
channel(mode = 'flow') {
|
|
51
|
-
if (
|
|
51
|
+
if (mode === 'cache')
|
|
52
52
|
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
53
53
|
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
54
54
|
}
|
|
@@ -57,7 +57,8 @@ class EntryPointContext extends basecontext_1.BaseContext {
|
|
|
57
57
|
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
58
58
|
switch (mode) {
|
|
59
59
|
case 'cache':
|
|
60
|
-
return this.client.cache.members?.get(this.client.botId, this.guildId)
|
|
60
|
+
return (this.client.cache.members?.get(this.client.botId, this.guildId) ||
|
|
61
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
61
62
|
default:
|
|
62
63
|
return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
|
|
63
64
|
}
|
|
@@ -31,7 +31,7 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
31
31
|
fetchResponse(): Promise<WebhookMessageStructure>;
|
|
32
32
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
33
33
|
channel(mode: 'cache'): ReturnCache<AllChannels>;
|
|
34
|
-
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
34
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
|
|
35
35
|
me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
36
36
|
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
37
37
|
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
@@ -63,7 +63,7 @@ class MenuCommandContext extends basecontext_1.BaseContext {
|
|
|
63
63
|
return this.interaction.fetchResponse();
|
|
64
64
|
}
|
|
65
65
|
channel(mode = 'flow') {
|
|
66
|
-
if (
|
|
66
|
+
if (mode === 'cache')
|
|
67
67
|
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
68
68
|
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
69
69
|
}
|
|
@@ -85,7 +85,7 @@ export declare class ComponentContext<Type extends keyof ContextComponentCommand
|
|
|
85
85
|
* @param mode - The mode to fetch the member.
|
|
86
86
|
* @returns A promise that resolves to the bot member.
|
|
87
87
|
*/
|
|
88
|
-
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
88
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
|
|
89
89
|
me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
90
90
|
/**
|
|
91
91
|
* Gets the guild of the interaction.
|
|
@@ -98,7 +98,7 @@ class ComponentContext extends basecontext_1.BaseContext {
|
|
|
98
98
|
return this.interaction.modal(body);
|
|
99
99
|
}
|
|
100
100
|
channel(mode = 'flow') {
|
|
101
|
-
if (
|
|
101
|
+
if (mode === 'cache')
|
|
102
102
|
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
103
103
|
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
104
104
|
}
|
|
@@ -81,7 +81,7 @@ export declare class ModalContext<M extends keyof RegisteredMiddlewares = never>
|
|
|
81
81
|
* @param mode - The mode to fetch the member.
|
|
82
82
|
* @returns A promise that resolves to the bot member.
|
|
83
83
|
*/
|
|
84
|
-
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
84
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
|
|
85
85
|
me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
86
86
|
/**
|
|
87
87
|
* Gets the guild of the interaction.
|
|
@@ -86,7 +86,7 @@ class ModalContext extends basecontext_1.BaseContext {
|
|
|
86
86
|
return this.interaction.modal(body);
|
|
87
87
|
}
|
|
88
88
|
channel(mode = 'flow') {
|
|
89
|
-
if (
|
|
89
|
+
if (mode === 'cache')
|
|
90
90
|
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
91
91
|
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
92
92
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import type { AutoModerationRuleStructure, GuildMemberStructure, GuildStructure } from '../client';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
4
|
import type { MethodContext, ObjectToLower } from '../common';
|
|
@@ -8,7 +9,8 @@ export interface AutoModerationRule extends ObjectToLower<APIAutoModerationRule>
|
|
|
8
9
|
export declare class AutoModerationRule extends DiscordBase<APIAutoModerationRule> {
|
|
9
10
|
constructor(client: UsingClient, data: APIAutoModerationRule);
|
|
10
11
|
fetchCreator(force?: boolean): Promise<GuildMemberStructure>;
|
|
11
|
-
guild(
|
|
12
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
13
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
12
14
|
fetch(): Promise<AutoModerationRuleStructure>;
|
|
13
15
|
edit(body: RESTPatchAPIAutoModerationRuleJSONBody, reason?: string): Promise<AutoModerationRuleStructure>;
|
|
14
16
|
delete(reason?: string): Promise<never>;
|
|
@@ -9,8 +9,14 @@ class AutoModerationRule extends DiscordBase_1.DiscordBase {
|
|
|
9
9
|
fetchCreator(force = false) {
|
|
10
10
|
return this.client.members.fetch(this.guildId, this.creatorId, force);
|
|
11
11
|
}
|
|
12
|
-
guild(
|
|
13
|
-
|
|
12
|
+
guild(mode = 'flow') {
|
|
13
|
+
switch (mode) {
|
|
14
|
+
case 'cache':
|
|
15
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
16
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
17
|
+
default:
|
|
18
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
21
|
fetch() {
|
|
16
22
|
return this.client.guilds.moderation.fetch(this.guildId, this.id);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import type { GuildBanStructure, GuildStructure } from '../client';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
4
|
import { type MethodContext, type ObjectToLower } from '../common';
|
|
@@ -11,7 +12,8 @@ export declare class GuildBan extends DiscordBase {
|
|
|
11
12
|
constructor(client: UsingClient, data: APIBan, guildId: string);
|
|
12
13
|
create(body?: Parameters<BanShorter['create']>[2], reason?: string): Promise<void>;
|
|
13
14
|
remove(reason?: string): Promise<never>;
|
|
14
|
-
guild(
|
|
15
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
16
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
15
17
|
fetch(force?: boolean): Promise<GuildBanStructure>;
|
|
16
18
|
toString(): `<@${string}>`;
|
|
17
19
|
static methods({ client, guildId }: MethodContext<{
|
|
@@ -15,8 +15,14 @@ class GuildBan extends DiscordBase_1.DiscordBase {
|
|
|
15
15
|
remove(reason) {
|
|
16
16
|
return this.client.bans.remove(this.guildId, this.id, reason);
|
|
17
17
|
}
|
|
18
|
-
guild(
|
|
19
|
-
|
|
18
|
+
guild(mode = 'flow') {
|
|
19
|
+
switch (mode) {
|
|
20
|
+
case 'cache':
|
|
21
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
22
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
23
|
+
default:
|
|
24
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
fetch(force = false) {
|
|
22
28
|
return this.client.bans.fetch(this.guildId, this.id, force);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import type { BaseCDNUrlOptions } from '../api';
|
|
2
3
|
import type { GuildEmojiStructure, GuildStructure } from '../client';
|
|
3
4
|
import type { UsingClient } from '../commands';
|
|
@@ -9,7 +10,8 @@ export interface GuildEmoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'i
|
|
|
9
10
|
export declare class GuildEmoji extends DiscordBase {
|
|
10
11
|
readonly guildId: string;
|
|
11
12
|
constructor(client: UsingClient, data: APIEmoji, guildId: string);
|
|
12
|
-
guild(
|
|
13
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
14
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
13
15
|
edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<GuildEmojiStructure>;
|
|
14
16
|
delete(reason?: string): Promise<void>;
|
|
15
17
|
fetch(force?: boolean): Promise<GuildEmojiStructure>;
|
|
@@ -9,10 +9,14 @@ class GuildEmoji extends DiscordBase_1.DiscordBase {
|
|
|
9
9
|
super(client, { ...data, id: data.id });
|
|
10
10
|
this.guildId = guildId;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
guild(mode = 'flow') {
|
|
13
|
+
switch (mode) {
|
|
14
|
+
case 'cache':
|
|
15
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
16
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
17
|
+
default:
|
|
18
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
edit(body, reason) {
|
|
18
22
|
return this.client.emojis.edit(this.guildId, this.id, body, reason);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DiscordBase } from './extra/DiscordBase';
|
|
2
2
|
export type GuildMemberData = APIGuildMember | Omit<APIGuildMember, 'user'> | GatewayGuildMemberUpdateDispatchData | GatewayGuildMemberAddDispatchData | APIInteractionDataResolvedGuildMember;
|
|
3
|
+
import type { ReturnCache } from '../../src';
|
|
3
4
|
import { type DMChannelStructure, type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type VoiceStateStructure } from '../client/transformers';
|
|
4
5
|
import type { UsingClient } from '../commands';
|
|
5
6
|
import { type GuildMemberResolvable, type ImageOptions, type MessageCreateBodyRequest, type MethodContext, type ObjectToLower, type ToClass } from '../common';
|
|
@@ -17,12 +18,13 @@ export declare class BaseGuildMember extends DiscordBase {
|
|
|
17
18
|
constructor(client: UsingClient, data: GuildMemberData, id: string,
|
|
18
19
|
/** the choosen guild id */
|
|
19
20
|
guildId: string);
|
|
20
|
-
guild(
|
|
21
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
22
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
21
23
|
fetch(force?: boolean): Promise<GuildMemberStructure>;
|
|
22
24
|
ban(body?: RESTPutAPIGuildBanJSONBody, reason?: string): Promise<void>;
|
|
23
25
|
kick(reason?: string): Promise<void>;
|
|
24
26
|
edit(body: RESTPatchAPIGuildMemberJSONBody, reason?: string): Promise<GuildMemberStructure>;
|
|
25
|
-
presence():
|
|
27
|
+
presence(): ReturnCache<(Omit<import("../types").GatewayPresenceUpdate, "user"> & {
|
|
26
28
|
id: string;
|
|
27
29
|
user_id: string;
|
|
28
30
|
} & {
|
|
@@ -19,8 +19,14 @@ class BaseGuildMember extends DiscordBase_1.DiscordBase {
|
|
|
19
19
|
this._roles = data.roles;
|
|
20
20
|
this.patch(data);
|
|
21
21
|
}
|
|
22
|
-
guild(
|
|
23
|
-
|
|
22
|
+
guild(mode = 'flow') {
|
|
23
|
+
switch (mode) {
|
|
24
|
+
case 'cache':
|
|
25
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
26
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
27
|
+
default:
|
|
28
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
fetch(force = false) {
|
|
26
32
|
return this.client.members.fetch(this.guildId, this.id, force);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import type { GuildRoleStructure, GuildStructure } from '../client';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
4
|
import { type MethodContext, type ObjectToLower } from '../common';
|
|
@@ -10,7 +11,8 @@ export declare class GuildRole extends DiscordBase {
|
|
|
10
11
|
readonly guildId: string;
|
|
11
12
|
permissions: PermissionsBitField;
|
|
12
13
|
constructor(client: UsingClient, data: APIRole, guildId: string);
|
|
13
|
-
guild(
|
|
14
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
15
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
14
16
|
fetch(force?: boolean): Promise<GuildRoleStructure>;
|
|
15
17
|
edit(body: RESTPatchAPIGuildRoleJSONBody): Promise<GuildRoleStructure>;
|
|
16
18
|
delete(reason?: string): Promise<GuildRoleStructure>;
|
|
@@ -12,10 +12,14 @@ class GuildRole extends DiscordBase_1.DiscordBase {
|
|
|
12
12
|
this.guildId = guildId;
|
|
13
13
|
this.permissions = new Permissions_1.PermissionsBitField(BigInt(data.permissions));
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
guild(mode = 'flow') {
|
|
16
|
+
switch (mode) {
|
|
17
|
+
case 'cache':
|
|
18
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
19
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
20
|
+
default:
|
|
21
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
fetch(force = false) {
|
|
21
25
|
return this.client.roles.fetch(this.guildId, this.id, force);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import type { GuildStructure, GuildTemplateStructure } from '../client';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
4
|
import type { MethodContext, ObjectToLower } from '../common';
|
|
@@ -7,7 +8,8 @@ export interface GuildTemplate extends Base, ObjectToLower<APITemplate> {
|
|
|
7
8
|
}
|
|
8
9
|
export declare class GuildTemplate extends Base {
|
|
9
10
|
constructor(client: UsingClient, data: APITemplate);
|
|
10
|
-
guild(
|
|
11
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
12
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
11
13
|
fetch(): Promise<GuildTemplateStructure>;
|
|
12
14
|
sync(): Promise<GuildTemplateStructure>;
|
|
13
15
|
edit(body: RESTPatchAPIGuildTemplateJSONBody): Promise<GuildTemplateStructure>;
|
|
@@ -7,8 +7,14 @@ class GuildTemplate extends Base_1.Base {
|
|
|
7
7
|
super(client);
|
|
8
8
|
this.__patchThis(data);
|
|
9
9
|
}
|
|
10
|
-
guild(
|
|
11
|
-
|
|
10
|
+
guild(mode = 'flow') {
|
|
11
|
+
switch (mode) {
|
|
12
|
+
case 'cache':
|
|
13
|
+
return (this.client.cache.guilds?.get(this.sourceGuildId) ||
|
|
14
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
15
|
+
default:
|
|
16
|
+
return this.client.guilds.fetch(this.sourceGuildId, mode === 'rest');
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
fetch() {
|
|
14
20
|
return this.client.templates.fetch(this.sourceGuildId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIEntryPointCommandInteraction, 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, type InteractionCallbackData, type InteractionCallbackResourceActivity, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody, type RESTPostAPIInteractionCallbackResult } from '../types';
|
|
2
|
+
import type { ReturnCache } from '../../src';
|
|
2
3
|
import type { RawFile } from '../api';
|
|
3
4
|
import { type EntitlementStructure, type GuildRoleStructure, type GuildStructure, type InteractionGuildMemberStructure, type MessageStructure, type OptionResolverStructure, type UserStructure, type WebhookMessageStructure } from '../client/transformers';
|
|
4
5
|
import type { UsingClient } from '../commands';
|
|
@@ -50,7 +51,8 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
|
|
|
50
51
|
isModal(): this is ModalSubmitInteraction;
|
|
51
52
|
isEntryPoint(): this is EntryPointInteraction;
|
|
52
53
|
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): RoleSelectMenuInteraction | UserSelectMenuInteraction | MentionableSelectMenuInteraction | ChannelSelectMenuInteraction | ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ButtonInteraction | StringSelectMenuInteraction<string[]> | ModalSubmitInteraction<boolean> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("../types").APIPingInteraction>;
|
|
53
|
-
fetchGuild(
|
|
54
|
+
fetchGuild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
55
|
+
fetchGuild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
54
56
|
}
|
|
55
57
|
export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | EntryPointInteraction | BaseInteraction;
|
|
56
58
|
export interface AutocompleteInteraction extends ObjectToLower<Omit<APIApplicationCommandAutocompleteInteraction, 'user' | 'member' | 'type' | 'data' | 'message' | 'channel' | 'app_permissions'>> {
|
|
@@ -216,8 +216,16 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
216
216
|
return new BaseInteraction(client, gateway);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
fetchGuild(mode = 'flow') {
|
|
220
|
+
if (!this.guildId)
|
|
221
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
222
|
+
switch (mode) {
|
|
223
|
+
case 'cache':
|
|
224
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
225
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
226
|
+
default:
|
|
227
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
228
|
+
}
|
|
221
229
|
}
|
|
222
230
|
}
|
|
223
231
|
exports.BaseInteraction = BaseInteraction;
|
|
@@ -32,7 +32,8 @@ export declare class BaseMessage extends DiscordBase {
|
|
|
32
32
|
get url(): `https://discord.com/channels/${string}/${string}/${string}`;
|
|
33
33
|
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
34
34
|
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
35
|
-
channel(
|
|
35
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
36
|
+
channel(mode: 'cache'): ReturnCache<AllChannels | undefined>;
|
|
36
37
|
react(emoji: EmojiResolvable): Promise<void>;
|
|
37
38
|
private patch;
|
|
38
39
|
}
|
|
@@ -34,13 +34,20 @@ class BaseMessage extends DiscordBase_1.DiscordBase {
|
|
|
34
34
|
return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
|
|
35
35
|
switch (mode) {
|
|
36
36
|
case 'cache':
|
|
37
|
-
return this.client.cache.guilds?.get(this.guildId)
|
|
37
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
38
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
38
39
|
default:
|
|
39
40
|
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
channel(
|
|
43
|
-
|
|
43
|
+
channel(mode = 'flow') {
|
|
44
|
+
switch (mode) {
|
|
45
|
+
case 'cache':
|
|
46
|
+
return (this.client.cache.channels?.get(this.channelId) ||
|
|
47
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
48
|
+
default:
|
|
49
|
+
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
react(emoji) {
|
|
46
53
|
return this.client.reactions.add(this.id, this.channelId, emoji);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GuildStructure, RawFile, StickerStructure, UsingClient } from '..';
|
|
2
|
+
import type { ReturnCache } from '../../src';
|
|
2
3
|
import type { Attachment, AttachmentBuilder } from '../builders';
|
|
3
4
|
import { type UserStructure } from '../client/transformers';
|
|
4
5
|
import type { MethodContext, ObjectToLower } from '../common';
|
|
@@ -9,7 +10,8 @@ export interface Sticker extends DiscordBase, ObjectToLower<Omit<APISticker, 'us
|
|
|
9
10
|
export declare class Sticker extends DiscordBase {
|
|
10
11
|
user?: UserStructure;
|
|
11
12
|
constructor(client: UsingClient, data: APISticker);
|
|
12
|
-
guild(
|
|
13
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
14
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
13
15
|
edit(body: RESTPatchAPIGuildStickerJSONBody, reason?: string): Promise<StickerStructure | undefined>;
|
|
14
16
|
fetch(force?: boolean): Promise<StickerStructure | undefined>;
|
|
15
17
|
delete(reason?: string): Promise<void>;
|
|
@@ -11,10 +11,16 @@ class Sticker extends DiscordBase_1.DiscordBase {
|
|
|
11
11
|
this.user = transformers_1.Transformers.User(this.client, data.user);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
guild(mode = 'flow') {
|
|
15
15
|
if (!this.guildId)
|
|
16
|
-
return;
|
|
17
|
-
|
|
16
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
17
|
+
switch (mode) {
|
|
18
|
+
case 'cache':
|
|
19
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
20
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
21
|
+
default:
|
|
22
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
25
|
async edit(body, reason) {
|
|
20
26
|
if (!this.guildId)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { UserStructure, UsingClient, VoiceStateStructure } from '../';
|
|
2
|
+
import type { GuildStructure, ReturnCache } from '../../src';
|
|
2
3
|
import type { VoiceStateResource } from '../cache/resources/voice-states';
|
|
3
4
|
import { type GuildMemberStructure } from '../client/transformers';
|
|
4
5
|
import type { ObjectToLower } from '../common';
|
|
5
6
|
import type { APIVoiceState } from '../types';
|
|
6
|
-
import type {
|
|
7
|
+
import type { AllChannels } from './channels';
|
|
7
8
|
import { Base } from './extra/Base';
|
|
8
9
|
export interface VoiceState extends Base, ObjectToLower<Omit<VoiceStateResource, 'member'>> {
|
|
9
10
|
}
|
|
@@ -13,7 +14,8 @@ export declare class VoiceState extends Base {
|
|
|
13
14
|
get isMuted(): boolean;
|
|
14
15
|
member(force?: boolean): Promise<GuildMemberStructure>;
|
|
15
16
|
user(force?: boolean): Promise<UserStructure>;
|
|
16
|
-
channel(
|
|
17
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels | undefined>;
|
|
18
|
+
channel(mode: 'cache'): ReturnCache<AllChannels | undefined>;
|
|
17
19
|
setMute(mute?: boolean, reason?: string): Promise<GuildMemberStructure>;
|
|
18
20
|
setDeaf(deaf?: boolean, reason?: string): Promise<GuildMemberStructure>;
|
|
19
21
|
setSuppress(suppress?: boolean): Promise<void>;
|
|
@@ -21,4 +23,6 @@ export declare class VoiceState extends Base {
|
|
|
21
23
|
disconnect(reason?: string): Promise<GuildMemberStructure>;
|
|
22
24
|
fetch(force?: boolean): Promise<VoiceStateStructure>;
|
|
23
25
|
setChannel(channel_id: null | string, reason?: string): Promise<GuildMemberStructure>;
|
|
26
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
27
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
24
28
|
}
|
|
@@ -21,10 +21,16 @@ class VoiceState extends Base_1.Base {
|
|
|
21
21
|
user(force) {
|
|
22
22
|
return this.client.users.fetch(this.userId, force);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
channel(mode = 'flow') {
|
|
25
25
|
if (!this.channelId)
|
|
26
|
-
return;
|
|
27
|
-
|
|
26
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
27
|
+
switch (mode) {
|
|
28
|
+
case 'cache':
|
|
29
|
+
return (this.client.cache.channels?.get(this.channelId) ||
|
|
30
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
31
|
+
default:
|
|
32
|
+
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
async setMute(mute = !this.mute, reason) {
|
|
30
36
|
const member = await this.client.members.edit(this.guildId, this.userId, { mute }, reason);
|
|
@@ -61,5 +67,14 @@ class VoiceState extends Base_1.Base {
|
|
|
61
67
|
this.channelId = channel_id;
|
|
62
68
|
return member;
|
|
63
69
|
}
|
|
70
|
+
guild(mode = 'flow') {
|
|
71
|
+
switch (mode) {
|
|
72
|
+
case 'cache':
|
|
73
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
74
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
75
|
+
default:
|
|
76
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
}
|
|
65
80
|
exports.VoiceState = VoiceState;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../src';
|
|
1
2
|
import { type AnonymousGuildStructure, type GuildStructure, type UserStructure, type WebhookMessageStructure, type WebhookStructure } from '../client/transformers';
|
|
2
3
|
import type { UsingClient } from '../commands';
|
|
3
4
|
import type { ImageOptions, MessageWebhookCreateBodyRequest, MessageWebhookPayload, MessageWebhookUpdateBodyRequest, MethodContext, ObjectToLower } from '../common';
|
|
@@ -30,13 +31,15 @@ export declare class Webhook extends DiscordBase {
|
|
|
30
31
|
* @param force Whether to force fetching the guild even if it's already cached.
|
|
31
32
|
* @returns A promise that resolves to the guild associated with the webhook, or undefined if not applicable.
|
|
32
33
|
*/
|
|
33
|
-
guild(
|
|
34
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
35
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
34
36
|
/**
|
|
35
37
|
* Fetches the channel associated with the webhook.
|
|
36
38
|
* @param force Whether to force fetching the channel even if it's already cached.
|
|
37
39
|
* @returns A promise that resolves to the channel associated with the webhook, or undefined if not applicable.
|
|
38
40
|
*/
|
|
39
|
-
channel(
|
|
41
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
42
|
+
channel(mode: 'cache'): ReturnCache<AllChannels | undefined>;
|
|
40
43
|
/**
|
|
41
44
|
* Retrieves the avatar URL of the webhook.
|
|
42
45
|
* @param options The image options for the avatar.
|
|
@@ -30,25 +30,25 @@ class Webhook extends DiscordBase_1.DiscordBase {
|
|
|
30
30
|
messages: Webhook.messages({ client, webhookId: this.id, webhookToken: this.token }),
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
guild(mode = 'flow') {
|
|
34
|
+
if (!this.guildId)
|
|
35
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
36
|
+
switch (mode) {
|
|
37
|
+
case 'cache':
|
|
38
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
39
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
40
|
+
default:
|
|
41
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
42
|
+
}
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return this.client.channels.fetch(this.sourceChannel.id, force);
|
|
44
|
+
channel(mode = 'flow') {
|
|
45
|
+
switch (mode) {
|
|
46
|
+
case 'cache':
|
|
47
|
+
return (this.client.cache.channels?.get(this.channelId) ||
|
|
48
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
49
|
+
default:
|
|
50
|
+
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Retrieves the avatar URL of the webhook.
|
|
@@ -14,7 +14,8 @@ export declare class BaseNoEditableChannel<T extends ChannelType> extends Discor
|
|
|
14
14
|
static __intent__(id: string): 'DirectMessages' | 'Guilds';
|
|
15
15
|
/** The URL to the channel */
|
|
16
16
|
get url(): string;
|
|
17
|
-
fetch(
|
|
17
|
+
fetch(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
18
|
+
fetch(mode: 'cache'): ReturnCache<AllChannels | undefined>;
|
|
18
19
|
delete(reason?: string): Promise<AllChannels>;
|
|
19
20
|
toString(): `<#${string}>`;
|
|
20
21
|
isStage(): this is StageChannel;
|
|
@@ -62,6 +63,7 @@ interface IChannelTypes {
|
|
|
62
63
|
export interface BaseGuildChannel extends ObjectToLower<Omit<APIGuildChannel<ChannelType>, 'permission_overwrites'>> {
|
|
63
64
|
}
|
|
64
65
|
export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
66
|
+
guildId: string;
|
|
65
67
|
constructor(client: UsingClient, data: APIGuildChannel<ChannelType>);
|
|
66
68
|
permissionOverwrites: {
|
|
67
69
|
fetch: () => ReturnType<Overwrites["get"]>;
|
|
@@ -92,7 +94,8 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
92
94
|
guildId: string;
|
|
93
95
|
} | undefined;
|
|
94
96
|
}>;
|
|
95
|
-
guild(
|
|
97
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
98
|
+
guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
96
99
|
get url(): string;
|
|
97
100
|
setPosition(position: number, reason?: string): Promise<this>;
|
|
98
101
|
setName(name: string, reason?: string): Promise<this>;
|
|
@@ -152,7 +155,7 @@ export declare class MessagesMethods extends DiscordBase {
|
|
|
152
155
|
};
|
|
153
156
|
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, files: RawFile[] | undefined, self: UsingClient): T;
|
|
154
157
|
}
|
|
155
|
-
export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites'>>, MessagesMethods {
|
|
158
|
+
export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, MessagesMethods {
|
|
156
159
|
}
|
|
157
160
|
export declare class TextBaseGuildChannel extends BaseGuildChannel {
|
|
158
161
|
}
|
|
@@ -206,7 +209,7 @@ export declare class WebhookChannelMethods extends DiscordBase {
|
|
|
206
209
|
create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<WebhookStructure>;
|
|
207
210
|
};
|
|
208
211
|
}
|
|
209
|
-
export interface TextGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites'>>, BaseGuildChannel, TextBaseGuildChannel, WebhookChannelMethods {
|
|
212
|
+
export interface TextGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, BaseGuildChannel, TextBaseGuildChannel, WebhookChannelMethods {
|
|
210
213
|
}
|
|
211
214
|
export declare class TextGuildChannel extends BaseGuildChannel {
|
|
212
215
|
type: ChannelType.GuildText;
|
|
@@ -216,27 +219,29 @@ export interface DMChannel extends ObjectToLower<APIDMChannel>, MessagesMethods
|
|
|
216
219
|
export declare class DMChannel extends BaseNoEditableChannel<ChannelType.DM> {
|
|
217
220
|
type: ChannelType.DM;
|
|
218
221
|
}
|
|
219
|
-
export interface VoiceChannel extends ObjectToLower<Omit<APIGuildVoiceChannel, 'permission_overwrites'>>, Omit<TextGuildChannel, keyof BaseGuildChannel>, VoiceChannelMethods, WebhookChannelMethods {
|
|
222
|
+
export interface VoiceChannel extends ObjectToLower<Omit<APIGuildVoiceChannel, 'permission_overwrites' | 'guild_id'>>, Omit<TextGuildChannel, keyof BaseGuildChannel>, VoiceChannelMethods, WebhookChannelMethods {
|
|
223
|
+
guildId: string;
|
|
220
224
|
}
|
|
221
225
|
export declare class VoiceChannel extends BaseGuildChannel {
|
|
222
226
|
type: ChannelType.GuildVoice;
|
|
223
227
|
}
|
|
224
|
-
export interface StageChannel extends ObjectToLower<Omit<APIGuildStageVoiceChannel, 'type' | 'permission_overwrites'>>, TopicableGuildChannel, VoiceChannelMethods {
|
|
228
|
+
export interface StageChannel extends ObjectToLower<Omit<APIGuildStageVoiceChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, TopicableGuildChannel, VoiceChannelMethods {
|
|
229
|
+
guildId: string;
|
|
225
230
|
}
|
|
226
231
|
export declare class StageChannel extends BaseGuildChannel {
|
|
227
232
|
type: ChannelType.GuildStageVoice;
|
|
228
233
|
}
|
|
229
|
-
export interface MediaChannel extends ObjectToLower<Omit<APIGuildMediaChannel, 'type' | 'permission_overwrites'>>, ThreadOnlyMethods {
|
|
234
|
+
export interface MediaChannel extends ObjectToLower<Omit<APIGuildMediaChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, ThreadOnlyMethods {
|
|
230
235
|
}
|
|
231
236
|
export declare class MediaChannel extends BaseGuildChannel {
|
|
232
237
|
type: ChannelType.GuildMedia;
|
|
233
238
|
}
|
|
234
|
-
export interface ForumChannel extends ObjectToLower<Omit<APIGuildForumChannel, 'permission_overwrites'>>, Omit<ThreadOnlyMethods, 'type' | 'edit'>, WebhookChannelMethods {
|
|
239
|
+
export interface ForumChannel extends ObjectToLower<Omit<APIGuildForumChannel, 'permission_overwrites' | 'guild_id'>>, Omit<ThreadOnlyMethods, 'type' | 'edit'>, WebhookChannelMethods {
|
|
235
240
|
}
|
|
236
241
|
export declare class ForumChannel extends BaseGuildChannel {
|
|
237
242
|
type: ChannelType.GuildForum;
|
|
238
243
|
}
|
|
239
|
-
export interface ThreadChannel extends ObjectToLower<Omit<APIThreadChannel, 'permission_overwrites'>>, Omit<TextBaseGuildChannel, 'edit' | 'parentId'> {
|
|
244
|
+
export interface ThreadChannel extends ObjectToLower<Omit<APIThreadChannel, 'permission_overwrites' | 'guild_id'>>, Omit<TextBaseGuildChannel, 'edit' | 'parentId'> {
|
|
240
245
|
}
|
|
241
246
|
export declare class ThreadChannel extends BaseChannel<ChannelType.PublicThread | ChannelType.AnnouncementThread | ChannelType.PrivateThread> {
|
|
242
247
|
parentId: string;
|
|
@@ -256,13 +261,13 @@ export declare class ThreadChannel extends BaseChannel<ChannelType.PublicThread
|
|
|
256
261
|
setInvitable(invitable?: boolean, reason?: string): Promise<this>;
|
|
257
262
|
setLocked(locked?: boolean, reason?: string): Promise<this>;
|
|
258
263
|
}
|
|
259
|
-
export interface CategoryChannel extends ObjectToLower<Omit<APIGuildCategoryChannel, 'permission_overwrites'>> {
|
|
264
|
+
export interface CategoryChannel extends ObjectToLower<Omit<APIGuildCategoryChannel, 'permission_overwrites' | 'guild_id'>> {
|
|
260
265
|
}
|
|
261
266
|
declare const CategoryChannel_base: ToClass<Omit<BaseGuildChannel, "setParent" | "type">, CategoryChannel>;
|
|
262
267
|
export declare class CategoryChannel extends CategoryChannel_base {
|
|
263
268
|
type: ChannelType.GuildCategory;
|
|
264
269
|
}
|
|
265
|
-
export interface NewsChannel extends ObjectToLower<Omit<APINewsChannel, 'permission_overwrites'>>, WebhookChannelMethods, Omit<TextGuildChannel, keyof BaseGuildChannel> {
|
|
270
|
+
export interface NewsChannel extends ObjectToLower<Omit<APINewsChannel, 'permission_overwrites' | 'guild_id'>>, WebhookChannelMethods, Omit<TextGuildChannel, keyof BaseGuildChannel> {
|
|
266
271
|
}
|
|
267
272
|
export declare class NewsChannel extends BaseGuildChannel {
|
|
268
273
|
type: ChannelType.GuildAnnouncement;
|
|
@@ -26,8 +26,14 @@ class BaseNoEditableChannel extends DiscordBase_1.DiscordBase {
|
|
|
26
26
|
get url() {
|
|
27
27
|
return __1.Formatter.channelLink(this.id);
|
|
28
28
|
}
|
|
29
|
-
fetch(
|
|
30
|
-
|
|
29
|
+
fetch(mode = 'flow') {
|
|
30
|
+
switch (mode) {
|
|
31
|
+
case 'cache':
|
|
32
|
+
return (this.client.cache.channels?.get(this.id) ||
|
|
33
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
34
|
+
default:
|
|
35
|
+
return this.client.channels.fetch(this.id, mode === 'rest');
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
delete(reason) {
|
|
33
39
|
return this.client.channels.delete(this.id, { reason });
|
|
@@ -122,8 +128,14 @@ class BaseGuildChannel extends BaseChannel {
|
|
|
122
128
|
overwritesFor(member) {
|
|
123
129
|
return this.client.channels.overwritesFor(this.id, member);
|
|
124
130
|
}
|
|
125
|
-
guild(
|
|
126
|
-
|
|
131
|
+
guild(mode = 'flow') {
|
|
132
|
+
switch (mode) {
|
|
133
|
+
case 'cache':
|
|
134
|
+
return (this.client.cache.guilds?.get(this.guildId) ||
|
|
135
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
136
|
+
default:
|
|
137
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
138
|
+
}
|
|
127
139
|
}
|
|
128
140
|
get url() {
|
|
129
141
|
return __1.Formatter.channelLink(this.id, this.guildId);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ReturnCache } from '../../../src';
|
|
2
|
+
import type { GuildStructure } from '../../client';
|
|
1
3
|
import { type ObjectToLower } from '../../common';
|
|
2
4
|
import type { ImageOptions } from '../../common/types/options';
|
|
3
5
|
import { type APIPartialGuild } from '../../types';
|
|
@@ -17,7 +19,8 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
|
|
|
17
19
|
/**
|
|
18
20
|
* Fetch guild on API
|
|
19
21
|
*/
|
|
20
|
-
fetch(): Promise<
|
|
22
|
+
fetch(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>;
|
|
23
|
+
fetch(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
21
24
|
/**
|
|
22
25
|
* iconURL gets the current guild icon.
|
|
23
26
|
* @link https://discord.com/developers/docs/reference#image-formatting
|
|
@@ -24,12 +24,14 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
24
24
|
}
|
|
25
25
|
return this.features.includes(types_1.GuildFeature.Verified);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
fetch(mode = 'flow') {
|
|
28
|
+
switch (mode) {
|
|
29
|
+
case 'cache':
|
|
30
|
+
return (this.client.cache.guilds?.get(this.id) ||
|
|
31
|
+
(this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
|
|
32
|
+
default:
|
|
33
|
+
return this.client.guilds.fetch(this.id, mode === 'rest');
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* iconURL gets the current guild icon.
|