seyfert 2.1.1-dev-11679252017.0 → 2.1.1-dev-11697693162.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.
@@ -41,7 +41,7 @@ export declare const Transformers: {
41
41
  BaseChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): BaseChannelStructure;
42
42
  BaseGuildChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): BaseGuildChannelStructure;
43
43
  TextGuildChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): TextGuildChannelStructure;
44
- DMChannel(...args: ConstructorParameters<typeof DMChannel>): DMChannelStructure;
44
+ DMChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): DMChannelStructure;
45
45
  VoiceChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): VoiceChannelStructure;
46
46
  StageChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): StageChannelStructure;
47
47
  MediaChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): MediaChannelStructure;
@@ -1,11 +1,11 @@
1
- import type { PermissionStrings, SeyfertBaseChoiceableOption, SeyfertBasicOption, SeyfertChoice, SeyfertNumberOption, SeyfertStringOption } from '../..';
1
+ import type { PermissionStrings, SeyfertBaseChoiceableOption, SeyfertBasicOption, SeyfertChoice } from '../..';
2
2
  import type { Attachment } from '../../builders';
3
3
  import type { GuildRoleStructure, InteractionGuildMemberStructure, UserStructure } from '../../client/transformers';
4
4
  import type { AllChannels, AutocompleteInteraction } from '../../structures';
5
5
  import { type APIApplicationCommandBasicOption, type APIApplicationCommandOption, ApplicationCommandOptionType, ApplicationCommandType, type ApplicationIntegrationType, type InteractionContextType, type LocaleString } from '../../types';
6
6
  import type { Groups, RegisteredMiddlewares } from '../decorators';
7
7
  import type { CommandContext } from './chatcontext';
8
- import type { ExtraProps, IgnoreCommand, OnOptionsReturnObject, UsingClient } from './shared';
8
+ import type { ExtraProps, IgnoreCommand, OnOptionsReturnObject, SeyfertChannelMap, UsingClient } from './shared';
9
9
  export interface ReturnOptionsTypes {
10
10
  1: never;
11
11
  2: never;
@@ -41,7 +41,11 @@ type KeysWithoutRequired<T extends OptionsRecord> = {
41
41
  }[keyof T];
42
42
  type ContextOptionsAuxInternal<T extends CommandBaseOption & {
43
43
  type: ApplicationCommandOptionType;
44
- }> = T['value'] extends (...args: any) => any ? Parameters<Parameters<T['value']>[1]>[0] : NonNullable<T['value']> extends (...args: any) => any ? Parameters<Parameters<NonNullable<T['value']>>[1]>[0] extends never ? T extends SeyfertStringOption | SeyfertNumberOption ? NonNullable<T['choices']> extends SeyfertChoice<string | number>[] ? NonNullable<T['choices']>[number]['value'] : ReturnOptionsTypes[T['type']] : ReturnOptionsTypes[T['type']] : Parameters<Parameters<NonNullable<T['value']>>[1]>[0] : T extends SeyfertStringOption | SeyfertNumberOption ? NonNullable<T['choices']> extends SeyfertChoice<string | number>[] ? NonNullable<T['choices']>[number]['value'] : ReturnOptionsTypes[T['type']] : ReturnOptionsTypes[T['type']];
44
+ }> = T['value'] extends (...args: any) => any ? Parameters<Parameters<T['value']>[1]>[0] : NonNullable<T['value']> extends (...args: any) => any ? Parameters<Parameters<NonNullable<T['value']>>[1]>[0] extends never ? T extends {
45
+ channel_types?: infer C;
46
+ } ? C extends any[] ? C[number] extends keyof SeyfertChannelMap ? SeyfertChannelMap[C[number]] : never : never : T extends {
47
+ choices?: infer C;
48
+ } ? C extends SeyfertChoice<string>[] ? C[number]['value'] : never : never : Parameters<Parameters<NonNullable<T['value']>>[1]>[0] : ReturnOptionsTypes[T['type']];
45
49
  type ContextOptionsAux<T extends OptionsRecord> = {
46
50
  [K in Exclude<keyof T, KeysWithoutRequired<T>>]: ContextOptionsAuxInternal<T[K]>;
47
51
  } & {
@@ -3,10 +3,10 @@ import type { Awaitable, FlatObjectKeys } from '../../common';
3
3
  import type { ModalContext } from '../../components';
4
4
  import type { ComponentContext } from '../../components/componentcontext';
5
5
  import type { MessageCommandInteraction, UserCommandInteraction } from '../../structures';
6
- import { type APIApplicationCommandBasicOption, type APIApplicationCommandOptionChoice, ApplicationCommandOptionType, type ChannelType } from '../../types';
6
+ import { type APIApplicationCommandBasicOption, type APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from '../../types';
7
7
  import type { LocalizationMap } from '../../types/payloads';
8
8
  import type { CommandContext } from './chatcontext';
9
- import type { DefaultLocale, MiddlewareContext, OKFunction, StopFunction } from './shared';
9
+ import type { DefaultLocale, MiddlewareContext, OKFunction, SeyfertChannelMap, StopFunction } from './shared';
10
10
  export interface SeyfertBasicOption<T extends keyof ReturnOptionsTypes, R = true | false> {
11
11
  required?: R;
12
12
  value?(data: {
@@ -47,9 +47,9 @@ export interface ChoiceableValues {
47
47
  [ApplicationCommandOptionType.Number]: number;
48
48
  [ApplicationCommandOptionType.Integer]: number;
49
49
  }
50
- export type ValueCallback<T extends keyof ReturnOptionsTypes, C = T extends ChoiceableTypes ? SeyfertChoice<ChoiceableValues[T]>[] : never, I = any> = (data: {
50
+ export type ValueCallback<T extends keyof ReturnOptionsTypes, C = T extends ChoiceableTypes ? SeyfertChoice<ChoiceableValues[T]>[] : keyof SeyfertChannelMap, I = any> = (data: {
51
51
  context: CommandContext;
52
- value: T extends ChoiceableTypes ? C extends SeyfertChoice<ChoiceableValues[T]>[] ? C[number]['value'] extends ReturnOptionsTypes[T] ? C[number]['value'] : ReturnOptionsTypes[T] : ReturnOptionsTypes[T] : ReturnOptionsTypes[T];
52
+ value: T extends ChoiceableTypes ? C extends SeyfertChoice<ChoiceableValues[T]>[] ? C[number]['value'] extends ReturnOptionsTypes[T] ? C[number]['value'] : never : never : C extends keyof SeyfertChannelMap ? SeyfertChannelMap[C] : never;
53
53
  }, ok: OKFunction<I>, fail: StopFunction) => Awaitable<void>;
54
54
  export type SeyfertStringOption<T = SeyfertChoice<string>[], R = boolean, VC = never> = SeyfertBaseChoiceableOption<ApplicationCommandOptionType.String, T, R, VC> & {
55
55
  autocomplete?: AutocompleteCallback;
@@ -71,8 +71,17 @@ export type SeyfertNumberOption<T = SeyfertChoice<number>[], R = boolean, VC = n
71
71
  };
72
72
  export type SeyfertBooleanOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Boolean, R>;
73
73
  export type SeyfertUserOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.User, R>;
74
- export type SeyfertChannelOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Channel, R> & {
75
- channel_types?: ChannelType[];
74
+ export type SeyfertChannelOption<C = keyof SeyfertChannelMap, R = true | false, VC = never> = {
75
+ required?: R;
76
+ value?: ValueCallback<ApplicationCommandOptionType.Channel, C, VC>;
77
+ description: string;
78
+ description_localizations?: APIApplicationCommandBasicOption['description_localizations'];
79
+ name_localizations?: APIApplicationCommandBasicOption['name_localizations'];
80
+ locales?: {
81
+ name?: FlatObjectKeys<DefaultLocale>;
82
+ description?: FlatObjectKeys<DefaultLocale>;
83
+ };
84
+ channel_types?: C[];
76
85
  };
77
86
  export type SeyfertRoleOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Role, R>;
78
87
  export type SeyfertMentionableOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Mentionable, R>;
@@ -128,15 +137,25 @@ export declare function createNumberOption<R extends boolean, C extends SeyfertC
128
137
  readonly min_value?: number;
129
138
  readonly max_value?: number;
130
139
  };
140
+ export declare function createChannelOption<R extends boolean, C extends keyof SeyfertChannelMap = keyof SeyfertChannelMap, VC = never>(data: SeyfertChannelOption<C, R, VC>): {
141
+ readonly type: ApplicationCommandOptionType.Channel;
142
+ readonly required?: R | undefined;
143
+ readonly value?: ValueCallback<ApplicationCommandOptionType.Channel, C, VC> | undefined;
144
+ readonly description: string;
145
+ readonly description_localizations?: APIApplicationCommandBasicOption["description_localizations"];
146
+ readonly name_localizations?: APIApplicationCommandBasicOption["name_localizations"];
147
+ readonly locales?: {
148
+ name?: FlatObjectKeys<DefaultLocale>;
149
+ description?: FlatObjectKeys<DefaultLocale>;
150
+ };
151
+ readonly channel_types?: C[] | undefined;
152
+ };
131
153
  export declare function createBooleanOption<R extends boolean, T extends SeyfertBooleanOption<R> = SeyfertBooleanOption<R>>(data: T): T & {
132
154
  readonly type: ApplicationCommandOptionType.Boolean;
133
155
  };
134
156
  export declare function createUserOption<R extends boolean, T extends SeyfertUserOption<R> = SeyfertUserOption<R>>(data: T): T & {
135
157
  readonly type: ApplicationCommandOptionType.User;
136
158
  };
137
- export declare function createChannelOption<R extends boolean, T extends SeyfertChannelOption<R> = SeyfertChannelOption<R>>(data: T): T & {
138
- readonly type: ApplicationCommandOptionType.Channel;
139
- };
140
159
  export declare function createRoleOption<R extends boolean, T extends SeyfertRoleOption<R> = SeyfertRoleOption<R>>(data: T): T & {
141
160
  readonly type: ApplicationCommandOptionType.Role;
142
161
  };
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStringOption = createStringOption;
4
4
  exports.createIntegerOption = createIntegerOption;
5
5
  exports.createNumberOption = createNumberOption;
6
+ exports.createChannelOption = createChannelOption;
6
7
  exports.createBooleanOption = createBooleanOption;
7
8
  exports.createUserOption = createUserOption;
8
- exports.createChannelOption = createChannelOption;
9
9
  exports.createRoleOption = createRoleOption;
10
10
  exports.createMentionableOption = createMentionableOption;
11
11
  exports.createAttachmentOption = createAttachmentOption;
@@ -20,15 +20,15 @@ function createIntegerOption(data) {
20
20
  function createNumberOption(data) {
21
21
  return { ...data, type: types_1.ApplicationCommandOptionType.Number };
22
22
  }
23
+ function createChannelOption(data) {
24
+ return { ...data, type: types_1.ApplicationCommandOptionType.Channel };
25
+ }
23
26
  function createBooleanOption(data) {
24
27
  return { ...data, type: types_1.ApplicationCommandOptionType.Boolean };
25
28
  }
26
29
  function createUserOption(data) {
27
30
  return { ...data, type: types_1.ApplicationCommandOptionType.User };
28
31
  }
29
- function createChannelOption(data) {
30
- return { ...data, type: types_1.ApplicationCommandOptionType.Channel };
31
- }
32
32
  function createRoleOption(data) {
33
33
  return { ...data, type: types_1.ApplicationCommandOptionType.Role };
34
34
  }
@@ -1,6 +1,7 @@
1
+ import type { CategoryChannelStructure, DMChannelStructure, DirectoryChannelStructure, ForumChannelStructure, MediaChannelStructure, NewsChannelStructure, StageChannelStructure, TextGuildChannelStructure, ThreadChannelStructure, VoiceChannelStructure } from '../../client';
1
2
  import type { BaseClient } from '../../client/base';
2
3
  import type { IsStrictlyUndefined } from '../../common';
3
- import type { ChannelType } from '../../types';
4
+ import { ChannelType } from '../../types';
4
5
  import type { RegisteredMiddlewares } from '../decorators';
5
6
  export type OKFunction<T> = (value: T) => void;
6
7
  export type StopFunction = (error: string) => void;
@@ -64,3 +65,18 @@ export declare enum IgnoreCommand {
64
65
  Slash = 0,
65
66
  Message = 1
66
67
  }
68
+ export interface SeyfertChannelMap {
69
+ [ChannelType.GuildText]: TextGuildChannelStructure;
70
+ [ChannelType.DM]: DMChannelStructure;
71
+ [ChannelType.GuildVoice]: VoiceChannelStructure;
72
+ [ChannelType.GroupDM]: DMChannelStructure;
73
+ [ChannelType.GuildCategory]: CategoryChannelStructure;
74
+ [ChannelType.GuildAnnouncement]: NewsChannelStructure;
75
+ [ChannelType.AnnouncementThread]: ThreadChannelStructure;
76
+ [ChannelType.PublicThread]: ThreadChannelStructure;
77
+ [ChannelType.PrivateThread]: ThreadChannelStructure;
78
+ [ChannelType.GuildStageVoice]: StageChannelStructure;
79
+ [ChannelType.GuildDirectory]: DirectoryChannelStructure;
80
+ [ChannelType.GuildForum]: ForumChannelStructure;
81
+ [ChannelType.GuildMedia]: MediaChannelStructure;
82
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IgnoreCommand = void 0;
4
+ const types_1 = require("../../types");
4
5
  var IgnoreCommand;
5
6
  (function (IgnoreCommand) {
6
7
  IgnoreCommand[IgnoreCommand["Slash"] = 0] = "Slash";
@@ -6,7 +6,7 @@ import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, t
6
6
  import type { GuildMember } from './GuildMember';
7
7
  import type { GuildRole } from './GuildRole';
8
8
  import { DiscordBase } from './extra/DiscordBase';
9
- export declare class BaseChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
9
+ export declare class BaseNoEditableChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
10
10
  type: T;
11
11
  constructor(client: UsingClient, data: APIChannelBase<ChannelType>);
12
12
  static __intent__(id: '@me'): 'DirectMessages';
@@ -15,7 +15,6 @@ export declare class BaseChannel<T extends ChannelType> extends DiscordBase<APIC
15
15
  get url(): string;
16
16
  fetch(force?: boolean): Promise<AllChannels>;
17
17
  delete(reason?: string): Promise<AllChannels>;
18
- edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<AllChannels>;
19
18
  toString(): `<#${string}>`;
20
19
  isStage(): this is StageChannel;
21
20
  isMedia(): this is MediaChannel;
@@ -42,6 +41,9 @@ export declare class BaseChannel<T extends ChannelType> extends DiscordBase<APIC
42
41
  editPositions: (body: RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<never>;
43
42
  };
44
43
  }
44
+ export declare class BaseChannel<T extends ChannelType> extends BaseNoEditableChannel<T> {
45
+ edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<AllChannels>;
46
+ }
45
47
  interface IChannelTypes {
46
48
  GuildStageVoice: StageChannel;
47
49
  GuildMedia: MediaChannel;
@@ -107,7 +109,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
107
109
  setName(name: string, reason?: string): Promise<AllChannels>;
108
110
  setParent(parent_id: string | null, reason?: string): Promise<AllChannels>;
109
111
  }
110
- export interface MessagesMethods extends BaseChannel<ChannelType> {
112
+ export interface MessagesMethods extends BaseNoEditableChannel<ChannelType> {
111
113
  }
112
114
  export declare class MessagesMethods extends DiscordBase {
113
115
  typing(): Promise<void>;
@@ -218,10 +220,9 @@ export declare class TextGuildChannel extends BaseGuildChannel {
218
220
  setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<AllChannels>;
219
221
  setNsfw(nsfw?: boolean, reason?: string): Promise<AllChannels>;
220
222
  }
221
- export interface DMChannel extends ObjectToLower<APIDMChannel>, Omit<MessagesMethods, 'edit'> {
223
+ export interface DMChannel extends ObjectToLower<APIDMChannel>, MessagesMethods {
222
224
  }
223
- declare const DMChannel_base: ToClass<Omit<BaseChannel<ChannelType.DM>, "edit">, DMChannel>;
224
- export declare class DMChannel extends DMChannel_base {
225
+ export declare class DMChannel extends BaseNoEditableChannel<ChannelType.DM> {
225
226
  type: ChannelType.DM;
226
227
  }
227
228
  export interface VoiceChannel extends ObjectToLower<Omit<APIGuildVoiceChannel, 'permission_overwrites'>>, Omit<TextGuildChannel, 'type'>, VoiceChannelMethods, WebhookChannelMethods {
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DirectoryChannel = exports.NewsChannel = exports.CategoryChannel = exports.ThreadChannel = exports.ForumChannel = exports.MediaChannel = exports.StageChannel = exports.VoiceChannel = exports.DMChannel = exports.TextGuildChannel = exports.WebhookChannelMethods = exports.WebhookGuildMethods = exports.VoiceChannelMethods = exports.ThreadOnlyMethods = exports.TopicableGuildChannel = exports.TextBaseGuildChannel = exports.MessagesMethods = exports.BaseGuildChannel = exports.BaseChannel = void 0;
9
+ exports.DirectoryChannel = exports.NewsChannel = exports.CategoryChannel = exports.ThreadChannel = exports.ForumChannel = exports.MediaChannel = exports.StageChannel = exports.VoiceChannel = exports.DMChannel = exports.TextGuildChannel = exports.WebhookChannelMethods = exports.WebhookGuildMethods = exports.VoiceChannelMethods = exports.ThreadOnlyMethods = exports.TopicableGuildChannel = exports.TextBaseGuildChannel = exports.MessagesMethods = exports.BaseGuildChannel = exports.BaseChannel = exports.BaseNoEditableChannel = void 0;
10
10
  exports.channelFrom = channelFrom;
11
11
  const __1 = require("..");
12
12
  const builders_1 = require("../builders");
@@ -14,7 +14,7 @@ const transformers_1 = require("../client/transformers");
14
14
  const mixer_1 = require("../deps/mixer");
15
15
  const types_1 = require("../types");
16
16
  const DiscordBase_1 = require("./extra/DiscordBase");
17
- class BaseChannel extends DiscordBase_1.DiscordBase {
17
+ class BaseNoEditableChannel extends DiscordBase_1.DiscordBase {
18
18
  constructor(client, data) {
19
19
  super(client, data);
20
20
  }
@@ -31,12 +31,6 @@ class BaseChannel extends DiscordBase_1.DiscordBase {
31
31
  delete(reason) {
32
32
  return this.client.channels.delete(this.id, { reason });
33
33
  }
34
- edit(body, reason) {
35
- return this.client.channels.edit(this.id, body, {
36
- reason,
37
- guildId: 'guildId' in this ? this.guildId : '@me',
38
- });
39
- }
40
34
  toString() {
41
35
  return __1.Formatter.channelMention(this.id);
42
36
  }
@@ -93,6 +87,15 @@ class BaseChannel extends DiscordBase_1.DiscordBase {
93
87
  };
94
88
  }
95
89
  }
90
+ exports.BaseNoEditableChannel = BaseNoEditableChannel;
91
+ class BaseChannel extends BaseNoEditableChannel {
92
+ edit(body, reason) {
93
+ return this.client.channels.edit(this.id, body, {
94
+ reason,
95
+ guildId: 'guildId' in this ? this.guildId : '@me',
96
+ });
97
+ }
98
+ }
96
99
  exports.BaseChannel = BaseChannel;
97
100
  class BaseGuildChannel extends BaseChannel {
98
101
  constructor(client, data) {
@@ -335,7 +338,7 @@ exports.TextGuildChannel = TextGuildChannel;
335
338
  exports.TextGuildChannel = TextGuildChannel = __decorate([
336
339
  (0, mixer_1.mix)(TextBaseGuildChannel, WebhookChannelMethods)
337
340
  ], TextGuildChannel);
338
- let DMChannel = class DMChannel extends BaseChannel {
341
+ let DMChannel = class DMChannel extends BaseNoEditableChannel {
339
342
  };
340
343
  exports.DMChannel = DMChannel;
341
344
  exports.DMChannel = DMChannel = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.1.1-dev-11679252017.0",
3
+ "version": "2.1.1-dev-11697693162.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -24,7 +24,7 @@
24
24
  "@biomejs/biome": "1.9.4",
25
25
  "@commitlint/cli": "^19.5.0",
26
26
  "@commitlint/config-conventional": "^19.5.0",
27
- "@types/node": "^22.8.6",
27
+ "@types/node": "^22.9.0",
28
28
  "husky": "^9.1.6",
29
29
  "lint-staged": "^15.2.10",
30
30
  "typescript": "^5.6.3",