seyfert 2.2.1-dev-13755013058.0 → 2.2.1-dev-13823891089.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.
@@ -3,6 +3,7 @@ import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStruct
3
3
  import type { If, MakeRequired, UnionToTuple, When } from '../../common';
4
4
  import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MessageWebhookCreateBodyRequest } from '../../common/types/write';
5
5
  import { type AllChannels, ChatInputCommandInteraction } from '../../structures';
6
+ import { type RESTGetAPIGuildQuery } from '../../types';
6
7
  import { BaseContext } from '../basecontext';
7
8
  import type { RegisteredMiddlewares } from '../decorators';
8
9
  import type { Command, ContextOptions, OptionsRecord, SubCommand } from './chat';
@@ -36,8 +37,8 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
36
37
  channel(mode: 'cache'): ReturnCache<If<InferWithPrefix, AllChannels | undefined, AllChannels>>;
37
38
  me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
38
39
  me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
39
- guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
40
- guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
40
+ guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise<GuildStructure<'cached' | 'api'> | undefined>;
41
+ guild(mode: 'cache', query?: RESTGetAPIGuildQuery): ReturnCache<GuildStructure<'cached'> | undefined>;
41
42
  get guildId(): string | undefined;
42
43
  get channelId(): string;
43
44
  get author(): UserStructure;
@@ -104,7 +104,7 @@ class CommandContext extends basecontext_1.BaseContext {
104
104
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
105
105
  }
106
106
  }
107
- guild(mode = 'flow') {
107
+ guild(mode = 'flow', query) {
108
108
  if (!this.guildId)
109
109
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
110
110
  switch (mode) {
@@ -112,7 +112,7 @@ class CommandContext extends basecontext_1.BaseContext {
112
112
  return (this.client.cache.guilds?.get(this.guildId) ||
113
113
  (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
114
114
  default:
115
- return this.client.guilds.fetch(this.guildId, mode === 'rest');
115
+ return this.client.guilds.fetch(this.guildId, { force: mode === 'rest', query });
116
116
  }
117
117
  }
118
118
  get guildId() {
@@ -2,6 +2,7 @@ import type { ReturnCache } from '../../cache';
2
2
  import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStructure, UserStructure, WebhookMessageStructure } from '../../client/transformers';
3
3
  import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, UnionToTuple, When } from '../../common';
4
4
  import type { AllChannels, EntryPointInteraction } from '../../structures';
5
+ import { type RESTGetAPIGuildQuery } from '../../types';
5
6
  import { BaseContext } from '../basecontext';
6
7
  import type { RegisteredMiddlewares } from '../decorators';
7
8
  import type { EntryPointCommand } from './entryPoint';
@@ -32,8 +33,8 @@ export declare class EntryPointContext<M extends keyof RegisteredMiddlewares = n
32
33
  channel(mode: 'cache'): ReturnCache<AllChannels>;
33
34
  me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
34
35
  me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
35
- guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
36
- guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
36
+ guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise<GuildStructure<'cached' | 'api'> | undefined>;
37
+ guild(mode: 'cache', query?: RESTGetAPIGuildQuery): ReturnCache<GuildStructure<'cached'> | undefined>;
37
38
  get guildId(): string | undefined;
38
39
  get channelId(): string;
39
40
  get author(): UserStructure;
@@ -63,14 +63,15 @@ class EntryPointContext extends basecontext_1.BaseContext {
63
63
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
64
64
  }
65
65
  }
66
- guild(mode = 'flow') {
66
+ guild(mode = 'flow', query) {
67
67
  if (!this.guildId)
68
- return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
68
+ return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
69
69
  switch (mode) {
70
70
  case 'cache':
71
- return this.client.cache.guilds?.get(this.guildId);
71
+ return (this.client.cache.guilds?.get(this.guildId) ||
72
+ (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
72
73
  default:
73
- return this.client.guilds.fetch(this.guildId, mode === 'rest');
74
+ return this.client.guilds.fetch(this.guildId, { force: mode === 'rest', query });
74
75
  }
75
76
  }
76
77
  get guildId() {
@@ -2,6 +2,7 @@ import type { ContextMenuCommand, InteractionGuildMemberStructure, ReturnCache }
2
2
  import { type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type WebhookMessageStructure } from '../../client/transformers';
3
3
  import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type MakeRequired, type MessageWebhookCreateBodyRequest, type ModalCreateBodyRequest, type UnionToTuple, type When } from '../../common';
4
4
  import type { AllChannels, MessageCommandInteraction, UserCommandInteraction } from '../../structures';
5
+ import { type RESTGetAPIGuildQuery } from '../../types';
5
6
  import { BaseContext } from '../basecontext';
6
7
  import type { RegisteredMiddlewares } from '../decorators';
7
8
  import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
@@ -33,8 +34,8 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
33
34
  channel(mode: 'cache'): ReturnCache<AllChannels>;
34
35
  me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;
35
36
  me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
36
- guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
37
- guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
37
+ guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise<GuildStructure<'cached' | 'api'> | undefined>;
38
+ guild(mode: 'cache', query?: RESTGetAPIGuildQuery): ReturnCache<GuildStructure<'cached'> | undefined>;
38
39
  get guildId(): string | undefined;
39
40
  get channelId(): string;
40
41
  get author(): UserStructure;
@@ -77,14 +77,15 @@ class MenuCommandContext extends basecontext_1.BaseContext {
77
77
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
78
78
  }
79
79
  }
80
- guild(mode = 'flow') {
80
+ guild(mode = 'flow', query) {
81
81
  if (!this.guildId)
82
- return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
82
+ return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
83
83
  switch (mode) {
84
84
  case 'cache':
85
- return this.client.cache.guilds?.get(this.guildId);
85
+ return (this.client.cache.guilds?.get(this.guildId) ||
86
+ (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
86
87
  default:
87
- return this.client.guilds.fetch(this.guildId, mode === 'rest');
88
+ return this.client.guilds.fetch(this.guildId, { force: mode === 'rest', query });
88
89
  }
89
90
  }
90
91
  get guildId() {
@@ -1,7 +1,7 @@
1
1
  import { type AnonymousGuildStructure, type AutoModerationRuleStructure, type GuildMemberStructure, type GuildStructure, type StickerStructure } from '../../client/transformers';
2
2
  import type { SeyfertChannelMap } from '../../commands';
3
3
  import { type AllChannels, type CreateStickerBodyRequest, Guild, type GuildChannelTypes } from '../../structures';
4
- import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildsJSONBody } from '../../types';
4
+ import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTGetAPIGuildQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildsJSONBody } from '../../types';
5
5
  import { BaseShorter } from './base';
6
6
  export declare class GuildShorter extends BaseShorter {
7
7
  /**
@@ -13,11 +13,21 @@ export declare class GuildShorter extends BaseShorter {
13
13
  /**
14
14
  * Fetches a guild by its ID.
15
15
  * @param id The ID of the guild to fetch.
16
- * @param force Whether to force fetching the guild from the API even if it exists in the cache.
16
+ * @param options The options for fetching the guild.
17
+ * @param options.query The query parameters for fetching the guild.
18
+ * @param options.force Whether to force fetching the guild from the API even if it exists in the cache.
17
19
  * @returns A Promise that resolves to the fetched guild.
18
20
  */
19
- fetch(id: string, force?: boolean): Promise<GuildStructure<'api'>>;
20
- raw(id: string, force?: boolean): Promise<import("../../types").APIGuild>;
21
+ fetch(id: string, options?: GuildFetchOptions | boolean): Promise<Guild<"api">>;
22
+ /**
23
+ * Fetches a guild by its ID.
24
+ * @param id The ID of the guild to fetch.
25
+ * @param options The options for fetching the guild.
26
+ * @param options.query The query parameters for fetching the guild.
27
+ * @param options.force Whether to force fetching the guild from the API even if it exists in the cache.
28
+ * @returns A Promise that resolves to the fetched guild.
29
+ */
30
+ raw(id: string, options?: GuildFetchOptions | boolean): Promise<import("../../types").APIGuild>;
21
31
  /**
22
32
  * Generates the widget URL for the guild.
23
33
  * @param id The ID of the guild.
@@ -169,3 +179,7 @@ export declare class GuildShorter extends BaseShorter {
169
179
  delete: (guildId: string, stickerId: string, reason?: string) => Promise<void>;
170
180
  };
171
181
  }
182
+ export interface GuildFetchOptions {
183
+ query?: RESTGetAPIGuildQuery;
184
+ force?: boolean;
185
+ }
@@ -20,19 +20,29 @@ class GuildShorter extends base_1.BaseShorter {
20
20
  /**
21
21
  * Fetches a guild by its ID.
22
22
  * @param id The ID of the guild to fetch.
23
- * @param force Whether to force fetching the guild from the API even if it exists in the cache.
23
+ * @param options The options for fetching the guild.
24
+ * @param options.query The query parameters for fetching the guild.
25
+ * @param options.force Whether to force fetching the guild from the API even if it exists in the cache.
24
26
  * @returns A Promise that resolves to the fetched guild.
25
27
  */
26
- async fetch(id, force = false) {
27
- return transformers_1.Transformers.Guild(this.client, await this.raw(id, force));
28
+ async fetch(id, options = false) {
29
+ return transformers_1.Transformers.Guild(this.client, await this.raw(id, options));
28
30
  }
29
- async raw(id, force = false) {
30
- if (!force) {
31
+ /**
32
+ * Fetches a guild by its ID.
33
+ * @param id The ID of the guild to fetch.
34
+ * @param options The options for fetching the guild.
35
+ * @param options.query The query parameters for fetching the guild.
36
+ * @param options.force Whether to force fetching the guild from the API even if it exists in the cache.
37
+ * @returns A Promise that resolves to the fetched guild.
38
+ */
39
+ async raw(id, options = false) {
40
+ if (!(typeof options === 'boolean' ? options : options.force)) {
31
41
  const guild = await this.client.cache.guilds?.raw(id);
32
42
  if (guild)
33
43
  return guild;
34
44
  }
35
- const data = await this.client.proxy.guilds(id).get();
45
+ const data = await this.client.proxy.guilds(id).get({ query: options.query });
36
46
  await this.client.cache.guilds?.patch(cache_1.CacheFrom.Rest, id, data);
37
47
  return (await this.client.cache.guilds?.raw(id)) ?? data;
38
48
  }
@@ -3,6 +3,7 @@ import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStruct
3
3
  import type { CommandMetadata, ExtendContext, GlobalMetadata, RegisteredMiddlewares, UsingClient } from '../commands';
4
4
  import { BaseContext } from '../commands/basecontext';
5
5
  import type { ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, UnionToTuple, When } from '../common';
6
+ import { type RESTGetAPIGuildQuery } from '../types';
6
7
  export interface ComponentContext<Type extends keyof ContextComponentCommandInteractionMap = keyof ContextComponentCommandInteractionMap> extends BaseContext, ExtendContext {
7
8
  }
8
9
  /**
@@ -92,8 +93,8 @@ export declare class ComponentContext<Type extends keyof ContextComponentCommand
92
93
  * @param mode - The mode to fetch the guild.
93
94
  * @returns A promise that resolves to the guild.
94
95
  */
95
- guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
96
- guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
96
+ guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise<GuildStructure<'cached' | 'api'> | undefined>;
97
+ guild(mode: 'cache', query?: RESTGetAPIGuildQuery): ReturnCache<GuildStructure<'cached'> | undefined>;
97
98
  /**
98
99
  * Gets the ID of the guild of the interaction.
99
100
  */
@@ -112,14 +112,15 @@ class ComponentContext extends basecontext_1.BaseContext {
112
112
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
113
113
  }
114
114
  }
115
- guild(mode = 'flow') {
115
+ guild(mode = 'flow', query) {
116
116
  if (!this.guildId)
117
- return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
117
+ return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
118
118
  switch (mode) {
119
119
  case 'cache':
120
- return this.client.cache.guilds?.get(this.guildId);
120
+ return (this.client.cache.guilds?.get(this.guildId) ||
121
+ (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined));
121
122
  default:
122
- return this.client.guilds.fetch(this.guildId, mode === 'rest');
123
+ return this.client.guilds.fetch(this.guildId, { force: mode === 'rest', query });
123
124
  }
124
125
  }
125
126
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.2.1-dev-13755013058.0",
3
+ "version": "2.2.1-dev-13823891089.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",