@impulsedev/chameleon 1.7.0 → 3.0.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/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { EventEmitter } from 'events';
2
+ import { ChildProcess } from 'child_process';
3
+
1
4
  interface Emoji {
2
5
  id: string | null;
3
6
  name: string | null;
@@ -109,6 +112,19 @@ interface Guild {
109
112
  incidentsData?: IncidentsData | null;
110
113
  large?: boolean;
111
114
  }
115
+ interface GuildTemplate {
116
+ code: string;
117
+ name: string;
118
+ description: string | null;
119
+ usageCount: number;
120
+ creatorId: string;
121
+ creator: User;
122
+ createdAt: string;
123
+ updatedAt: string;
124
+ sourceGuildId: string;
125
+ serializedSourceGuild: Partial<Guild>;
126
+ isDirty: boolean | null;
127
+ }
112
128
  interface Member {
113
129
  user?: User;
114
130
  nick?: string | null;
@@ -712,6 +728,21 @@ interface MessageInteraction {
712
728
  member?: Partial<Member>;
713
729
  }
714
730
 
731
+ declare class AttachmentBuilder {
732
+ name: string;
733
+ data: Buffer | Uint8Array;
734
+ description?: string;
735
+ contentType?: string;
736
+ constructor(data: Buffer | Uint8Array | string, options?: {
737
+ name?: string;
738
+ description?: string;
739
+ contentType?: string;
740
+ });
741
+ setName(name: string): this;
742
+ setDescription(description: string): this;
743
+ toAttachmentJSON(index: number): Record<string, unknown>;
744
+ }
745
+
715
746
  interface ChannelMention {
716
747
  id: string;
717
748
  guildId: string;
@@ -852,7 +883,7 @@ interface PollMedia {
852
883
  emoji?: Partial<Emoji>;
853
884
  }
854
885
  interface PollAnswer {
855
- answerId: number;
886
+ answerId?: number;
856
887
  pollMedia: PollMedia;
857
888
  }
858
889
  interface PollAnswerCount {
@@ -875,6 +906,7 @@ interface Poll {
875
906
  interface PollCreateRequest {
876
907
  question: PollMedia;
877
908
  answers: PollAnswer[];
909
+ /** In hours */
878
910
  duration?: number;
879
911
  allowMultiselect?: boolean;
880
912
  layoutType?: number;
@@ -924,6 +956,45 @@ interface Message {
924
956
  call?: MessageCall;
925
957
  sharedClientTheme?: SharedClientTheme;
926
958
  }
959
+ type MessageCreateOptions = string | {
960
+ content?: string;
961
+ embeds?: (Embed | {
962
+ toJSON(): Record<string, unknown>;
963
+ } | Record<string, unknown>)[];
964
+ components?: (MessageComponent | {
965
+ build?(): MessageComponent;
966
+ } | {
967
+ toJSON(): Record<string, unknown>;
968
+ } | Record<string, unknown>)[];
969
+ reply?: {
970
+ messageId: string;
971
+ failIfNotExists?: boolean;
972
+ };
973
+ files?: AttachmentBuilder[];
974
+ poll?: PollCreateRequest;
975
+ tts?: boolean;
976
+ flags?: number;
977
+ stickerIds?: string[];
978
+ nonce?: string | number;
979
+ enforceNonce?: boolean;
980
+ };
981
+ type WebhookMessageCreateOptions = string | {
982
+ content?: string;
983
+ username?: string;
984
+ avatarUrl?: string;
985
+ tts?: boolean;
986
+ embeds?: (Embed | {
987
+ toJSON(): Record<string, unknown>;
988
+ } | Record<string, unknown>)[];
989
+ components?: (MessageComponent | {
990
+ build?(): MessageComponent;
991
+ } | {
992
+ toJSON(): Record<string, unknown>;
993
+ } | Record<string, unknown>)[];
994
+ threadName?: string;
995
+ files?: AttachmentBuilder[];
996
+ poll?: PollCreateRequest;
997
+ };
927
998
  declare const MessageType: {
928
999
  readonly DEFAULT: 0;
929
1000
  readonly RECIPIENT_ADD: 1;
@@ -1004,6 +1075,18 @@ declare const AttachmentFlag: {
1004
1075
  readonly IS_SPOILER: number;
1005
1076
  readonly IS_ANIMATED: number;
1006
1077
  };
1078
+ interface AttachmentData {
1079
+ name: string;
1080
+ data: Buffer | Uint8Array;
1081
+ description?: string;
1082
+ contentType?: string;
1083
+ }
1084
+ interface AttachmentData {
1085
+ name: string;
1086
+ data: Buffer | Uint8Array;
1087
+ description?: string;
1088
+ contentType?: string;
1089
+ }
1007
1090
 
1008
1091
  declare const GuildScheduledEventPrivacyLevel: {
1009
1092
  readonly GUILD_ONLY: 2;
@@ -1040,6 +1123,11 @@ interface GuildScheduledEvent {
1040
1123
  userCount?: number;
1041
1124
  image?: string | null;
1042
1125
  }
1126
+ interface GuildScheduledEventUser {
1127
+ guildScheduledEventId: string;
1128
+ user: User;
1129
+ member?: unknown;
1130
+ }
1043
1131
 
1044
1132
  declare const WebhookType: {
1045
1133
  readonly INCOMING: 1;
@@ -1447,6 +1535,19 @@ interface SoundboardSound {
1447
1535
  available: boolean;
1448
1536
  user?: User;
1449
1537
  }
1538
+ interface SoundboardCreateOptions {
1539
+ name: string;
1540
+ sound: AttachmentBuilder | string;
1541
+ volume?: number;
1542
+ emojiId?: string;
1543
+ emojiName?: string;
1544
+ }
1545
+ interface SoundboardEditOptions {
1546
+ name?: string;
1547
+ volume?: number;
1548
+ emojiId?: string | null;
1549
+ emojiName?: string | null;
1550
+ }
1450
1551
 
1451
1552
  declare const StagePrivacyLevel: {
1452
1553
  readonly PUBLIC: 1;
@@ -1480,20 +1581,6 @@ interface Subscription {
1480
1581
  country?: string;
1481
1582
  }
1482
1583
 
1483
- interface GuildTemplate {
1484
- code: string;
1485
- name: string;
1486
- description: string | null;
1487
- usageCount: number;
1488
- creatorId: string;
1489
- creator: User;
1490
- createdAt: number;
1491
- updatedAt: number;
1492
- sourceGuildId: string;
1493
- serializedSourceGuild: Partial<Guild>;
1494
- isDirty: boolean | null;
1495
- }
1496
-
1497
1584
  interface Voice {
1498
1585
  guildId?: string;
1499
1586
  channelId: string;
@@ -1517,23 +1604,29 @@ declare const CHAMELEON_SELF_MAP: {
1517
1604
  };
1518
1605
  type ChameleonSelfKey = typeof CHAMELEON_SELF_MAP[keyof typeof CHAMELEON_SELF_MAP];
1519
1606
 
1607
+ declare class Collection<K, V> extends Map<K, V> {
1608
+ first(): V | undefined;
1609
+ last(): V | undefined;
1610
+ random(): V | undefined;
1611
+ find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
1612
+ filter(fn: (value: V, key: K, collection: this) => boolean): Collection<K, V>;
1613
+ map<T>(fn: (value: V, key: K, collection: this) => T): T[];
1614
+ some(fn: (value: V, key: K, collection: this) => boolean): boolean;
1615
+ every(fn: (value: V, key: K, collection: this) => boolean): boolean;
1616
+ reduce<T>(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T;
1617
+ toArray(): V[];
1618
+ }
1619
+
1520
1620
  /**
1521
1621
  * Chameleon's internal store structure,
1522
1622
  * acts as an least recently used cache to optimize memory usage
1523
1623
  * it's named Tongue because a chameleon catches things with its tongue, you get it right? Right??? RIGHT?!?!?
1524
1624
  */
1525
- declare class Tongue<K, V> {
1526
- private map;
1625
+ declare class Tongue<K, V> extends Collection<K, V> {
1527
1626
  private max;
1528
1627
  constructor(maxSize?: number);
1529
1628
  get(key: K): V | undefined;
1530
1629
  set(key: K, val: V): this;
1531
- has(key: K): boolean;
1532
- delete(key: K): boolean;
1533
- clear(): void;
1534
- get size(): number;
1535
- values(): IterableIterator<V>;
1536
- keys(): IterableIterator<K>;
1537
1630
  }
1538
1631
 
1539
1632
  interface StoreOptions {
@@ -1549,6 +1642,7 @@ interface StoreOptions {
1549
1642
  scheduledEvents?: number;
1550
1643
  autoModRules?: number;
1551
1644
  integrations?: number;
1645
+ voiceStates?: number;
1552
1646
  }
1553
1647
  declare class TongueStore {
1554
1648
  guilds: Tongue<string, Guild>;
@@ -1563,6 +1657,7 @@ declare class TongueStore {
1563
1657
  scheduledEvents: Tongue<string, GuildScheduledEvent>;
1564
1658
  autoModRules: Tongue<string, AutoModerationRule>;
1565
1659
  integrations: Tongue<string, Integration>;
1660
+ voiceStates: Tongue<string, Voice>;
1566
1661
  constructor(options?: StoreOptions);
1567
1662
  static memberKey(guildId: string, userId: string): string;
1568
1663
  }
@@ -1598,6 +1693,7 @@ declare class ChameleonREST {
1598
1693
  put<T = unknown>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<ChameleonAPIResult<T>>;
1599
1694
  patch<T = unknown>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<ChameleonAPIResult<T>>;
1600
1695
  delete<T = unknown>(endpoint: string, headers?: Record<string, string>): Promise<ChameleonAPIResult<T>>;
1696
+ requestWithFiles<T = unknown>(method: HttpMethod, endpoint: string, body: unknown, files: AttachmentBuilder[], headers?: Record<string, string>): Promise<ChameleonAPIResult<T>>;
1601
1697
  }
1602
1698
 
1603
1699
  interface ChameleonGatewayOptions {
@@ -1652,7 +1748,7 @@ declare class ChameleonGateway {
1652
1748
  * Send a payload to the Gateway.
1653
1749
  */
1654
1750
  send(op: number, d: unknown): void;
1655
- pendingPresence: Record<string, any> | null;
1751
+ pendingPresence: Record<string, unknown> | null;
1656
1752
  /**
1657
1753
  * Update the presence/status for this shard
1658
1754
  */
@@ -1718,978 +1814,1278 @@ declare class ChameleonGateway {
1718
1814
  private clearReconnectTimer;
1719
1815
  }
1720
1816
 
1721
- type PartialChannel = Partial<Channel> & {
1722
- id: string;
1817
+ type OptionType = 'string' | 'integer' | 'boolean' | 'user' | 'channel' | 'role' | 'number';
1818
+ interface OptionDef<T extends OptionType, R extends boolean> {
1819
+ type: T;
1820
+ description: string;
1821
+ required: R;
1822
+ min?: number;
1823
+ max?: number;
1824
+ choices?: {
1825
+ name: string;
1826
+ value: string | number;
1827
+ }[];
1828
+ }
1829
+ type ResolveOptionType<T extends OptionType> = T extends 'string' ? string : T extends 'integer' | 'number' ? number : T extends 'boolean' ? boolean : T extends 'user' ? User : T extends 'channel' ? Channel : T extends 'role' ? Role : never;
1830
+ type ResolveOption<O extends OptionDef<OptionType, boolean>> = O['required'] extends true ? ResolveOptionType<O['type']> : ResolveOptionType<O['type']> | undefined;
1831
+ type ResolveOptions<O extends Record<string, OptionDef<OptionType, boolean>>> = {
1832
+ [K in keyof O]: ResolveOption<O[K]>;
1723
1833
  };
1724
- type PartialGuild = Partial<Guild> & {
1725
- id: string;
1834
+ declare const opt: {
1835
+ string: <R extends boolean = false>(description: string, options?: {
1836
+ required?: R;
1837
+ choices?: {
1838
+ name: string;
1839
+ value: string;
1840
+ }[];
1841
+ minLength?: number;
1842
+ maxLength?: number;
1843
+ }) => OptionDef<"string", R>;
1844
+ integer: <R extends boolean = false>(description: string, options?: {
1845
+ required?: R;
1846
+ choices?: {
1847
+ name: string;
1848
+ value: number;
1849
+ }[];
1850
+ min?: number;
1851
+ max?: number;
1852
+ }) => OptionDef<"integer", R>;
1853
+ number: <R extends boolean = false>(description: string, options?: {
1854
+ required?: R;
1855
+ choices?: {
1856
+ name: string;
1857
+ value: number;
1858
+ }[];
1859
+ min?: number;
1860
+ max?: number;
1861
+ }) => OptionDef<"number", R>;
1862
+ boolean: <R extends boolean = false>(description: string, options?: {
1863
+ required?: R;
1864
+ }) => OptionDef<"boolean", R>;
1865
+ user: <R extends boolean = false>(description: string, options?: {
1866
+ required?: R;
1867
+ }) => OptionDef<"user", R>;
1868
+ channel: <R extends boolean = false>(description: string, options?: {
1869
+ required?: R;
1870
+ }) => OptionDef<"channel", R>;
1871
+ role: <R extends boolean = false>(description: string, options?: {
1872
+ required?: R;
1873
+ }) => OptionDef<"role", R>;
1726
1874
  };
1727
- type ChameleonEvent = {
1728
- type: 'READY';
1729
- } | {
1730
- type: 'RESUMED';
1731
- } | {
1732
- type: 'GUILD_CREATE';
1733
- guild: Guild;
1734
- partial?: boolean;
1735
- } | {
1736
- type: 'GUILD_AVAILABLE';
1737
- guild: Guild;
1738
- reason: 'hydration' | 'outage';
1739
- partial?: boolean;
1740
- } | {
1741
- type: 'GUILD_UNAVAILABLE';
1742
- guildId: string;
1743
- } | {
1744
- type: 'GUILD_UPDATE';
1745
- oldGuild?: Guild;
1746
- guild: Guild;
1747
- } | {
1748
- type: 'GUILD_DELETE';
1749
- guildId: string;
1750
- } | {
1751
- type: 'CHANNEL_CREATE';
1752
- channel: Channel;
1753
- guild?: PartialGuild;
1754
- } | {
1755
- type: 'CHANNEL_UPDATE';
1756
- oldChannel?: Channel;
1757
- channel: Channel;
1758
- guild?: PartialGuild;
1759
- } | {
1760
- type: 'CHANNEL_DELETE';
1761
- channelId: string;
1762
- guild?: PartialGuild;
1763
- } | {
1764
- type: 'CHANNEL_PINS_UPDATE';
1765
- channelId: string;
1766
- guildId?: string;
1767
- lastPinTimestamp?: number | null;
1768
- } | {
1769
- type: 'THREAD_CREATE';
1770
- channel: Channel;
1771
- } | {
1772
- type: 'THREAD_UPDATE';
1773
- oldChannel?: Channel;
1774
- channel: Channel;
1775
- } | {
1776
- type: 'THREAD_DELETE';
1777
- id: string;
1778
- guildId: string;
1779
- parentId: string;
1780
- channelType: number;
1781
- } | {
1782
- type: 'THREAD_LIST_SYNC';
1783
- guildId: string;
1784
- channelIds?: string[];
1785
- threads: Channel[];
1786
- members: unknown[];
1787
- } | {
1788
- type: 'GUILD_MEMBER_ADD';
1789
- member: Member;
1790
- guildId: string;
1791
- } | {
1792
- type: 'GUILD_MEMBER_UPDATE';
1793
- oldMember?: Member;
1794
- guildId: string;
1795
- user: User;
1796
- roles: string[];
1797
- nick?: string | null;
1798
- joinedAt?: number | null;
1799
- } | {
1800
- type: 'GUILD_MEMBER_REMOVE';
1801
- user: User;
1802
- guildId: string;
1803
- } | {
1804
- type: 'GUILD_MEMBERS_CHUNK';
1805
- guildId: string;
1806
- members: Member[];
1807
- chunkIndex: number;
1808
- chunkCount: number;
1809
- notFound?: string[];
1810
- nonce?: string;
1811
- } | {
1812
- type: 'GUILD_ROLE_CREATE';
1813
- guildId: string;
1814
- role: Role;
1815
- } | {
1816
- type: 'GUILD_ROLE_UPDATE';
1817
- oldRole?: Role;
1818
- guildId: string;
1819
- role: Role;
1820
- } | {
1821
- type: 'GUILD_ROLE_DELETE';
1822
- guildId: string;
1823
- roleId: string;
1824
- } | {
1825
- type: 'GUILD_BAN_ADD';
1826
- guildId: string;
1827
- user: User;
1828
- } | {
1829
- type: 'GUILD_BAN_REMOVE';
1830
- guildId: string;
1875
+
1876
+ type InteractionReplyOptions = string | {
1877
+ content?: string;
1878
+ embeds?: (Embed | {
1879
+ toJSON(): Record<string, unknown>;
1880
+ } | Record<string, unknown>)[];
1881
+ components?: (MessageComponent | {
1882
+ build?(): MessageComponent;
1883
+ } | {
1884
+ toJSON(): Record<string, unknown>;
1885
+ } | Record<string, unknown>)[];
1886
+ ephemeral?: boolean;
1887
+ };
1888
+ declare class BaseInteractionContext {
1831
1889
  user: User;
1832
- } | {
1833
- type: 'GUILD_EMOJIS_UPDATE';
1834
- guildId: string;
1835
- emojis: Emoji[];
1836
- } | {
1837
- type: 'GUILD_STICKERS_UPDATE';
1838
- guildId: string;
1839
- stickers: Sticker[];
1840
- } | {
1841
- type: 'MESSAGE_CREATE';
1842
- message: Message;
1843
- channel: PartialChannel;
1844
- } | {
1845
- type: 'MESSAGE_UPDATE';
1846
- oldMessage?: Message;
1847
- message: Message;
1848
- channel: PartialChannel;
1849
- } | {
1850
- type: 'MESSAGE_DELETE';
1851
- messageId: string;
1852
- channelId: string;
1853
- guildId?: string;
1854
- message?: Message;
1855
- } | {
1856
- type: 'MESSAGE_DELETE_BULK';
1857
- messageIds: string[];
1858
- channelId: string;
1859
- guildId?: string;
1860
- messages?: Message[];
1861
- } | {
1862
- type: 'MESSAGE_REACTION_ADD';
1863
- userId: string;
1864
- channelId: string;
1865
- messageId: string;
1866
- guildId?: string;
1867
- emoji: Partial<Emoji>;
1868
- member?: Member;
1869
- } | {
1870
- type: 'MESSAGE_REACTION_REMOVE';
1871
- userId: string;
1872
- channelId: string;
1873
- messageId: string;
1874
- guildId?: string;
1875
- emoji: Partial<Emoji>;
1876
- } | {
1877
- type: 'MESSAGE_REACTION_REMOVE_ALL';
1878
- channelId: string;
1879
- messageId: string;
1880
- guildId?: string;
1881
- } | {
1882
- type: 'MESSAGE_REACTION_REMOVE_EMOJI';
1883
- channelId: string;
1884
- messageId: string;
1885
- guildId?: string;
1886
- emoji: Partial<Emoji>;
1887
- } | {
1888
- type: 'INTERACTION_CREATE';
1889
- interaction: Interaction;
1890
- } | {
1891
- type: 'VOICE_STATE_UPDATE';
1892
- voiceState: Voice;
1893
- } | {
1894
- type: 'VOICE_SERVER_UPDATE';
1895
- token: string;
1896
- guildId: string;
1897
- endpoint: string | null;
1898
- } | {
1899
- type: 'STAGE_INSTANCE_CREATE';
1900
- stageInstance: StageInstance;
1901
- } | {
1902
- type: 'STAGE_INSTANCE_UPDATE';
1903
- stageInstance: StageInstance;
1904
- } | {
1905
- type: 'STAGE_INSTANCE_DELETE';
1906
- stageInstance: StageInstance;
1907
- } | {
1908
- type: 'GUILD_SOUNDBOARD_SOUND_CREATE';
1909
- guildId: string;
1910
- sound: SoundboardSound;
1911
- } | {
1912
- type: 'GUILD_SOUNDBOARD_SOUND_UPDATE';
1913
- guildId: string;
1914
- sound: SoundboardSound;
1915
- } | {
1916
- type: 'GUILD_SOUNDBOARD_SOUND_DELETE';
1917
- guildId: string;
1918
- soundId: string;
1919
- } | {
1920
- type: 'GUILD_SOUNDBOARD_SOUNDS_UPDATE';
1921
- guildId: string;
1922
- sounds: SoundboardSound[];
1923
- } | {
1924
- type: 'SUBSCRIPTION_CREATE';
1925
- subscription: Subscription;
1926
- } | {
1927
- type: 'SUBSCRIPTION_UPDATE';
1928
- subscription: Subscription;
1929
- } | {
1930
- type: 'SUBSCRIPTION_DELETE';
1931
- subscription: Subscription;
1932
- } | {
1933
- type: 'VOICE_CHANNEL_EFFECT_SEND';
1934
- channelId: string;
1935
- guildId: string;
1936
- userId: string;
1890
+ guild?: Guild | {
1891
+ id: string;
1892
+ } | undefined;
1893
+ channel?: Channel | {
1894
+ id: string;
1895
+ } | undefined;
1896
+ interactionId: string;
1897
+ interactionToken: string;
1898
+ protected _client: Client;
1899
+ protected _deferred: boolean;
1900
+ protected _replied: boolean;
1901
+ constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
1902
+ id: string;
1903
+ }, channel?: Channel | {
1904
+ id: string;
1905
+ });
1906
+ get replied(): boolean;
1907
+ get deferred(): boolean;
1908
+ protected _resolvePayload(payload: InteractionReplyOptions): Record<string, unknown>;
1909
+ reply(payload: InteractionReplyOptions): Promise<void>;
1910
+ defer(options?: {
1911
+ ephemeral?: boolean;
1912
+ }): Promise<void>;
1913
+ followUp(payload: InteractionReplyOptions): Promise<void>;
1914
+ showModal(modal: Record<string, unknown>): Promise<void>;
1915
+ }
1916
+ declare class CommandContext<Options = Record<string, unknown>> extends BaseInteractionContext {
1917
+ options: Options;
1918
+ constructor(client: Client, rawInteraction: Record<string, unknown>, parsedOptions: Options, user: User, guild?: Guild | {
1919
+ id: string;
1920
+ }, channel?: Channel | {
1921
+ id: string;
1922
+ });
1923
+ }
1924
+
1925
+ type ExecuteFunction<O extends Record<string, OptionDef<OptionType, boolean>>> = (ctx: CommandContext<ResolveOptions<O>>) => void | Promise<void>;
1926
+ interface Subcommand<O extends Record<string, OptionDef<OptionType, boolean>> = Record<string, never>> {
1927
+ description: string;
1928
+ options?: O;
1929
+ execute: ExecuteFunction<O>;
1930
+ }
1931
+ declare function defineSubcommand<O extends Record<string, OptionDef<OptionType, boolean>>>(def: Subcommand<O>): Subcommand<O>;
1932
+ type CommandDef<O extends Record<string, OptionDef<OptionType, boolean>> = Record<string, never>, S extends Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>> = Record<string, never>> = {
1933
+ name: string;
1934
+ description: string;
1935
+ options?: O;
1936
+ subcommands?: S;
1937
+ execute?: ExecuteFunction<O>;
1938
+ };
1939
+ type AnyCommandDef = CommandDef<Record<string, OptionDef<OptionType, boolean>>, Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>>>;
1940
+ declare function defineCommand<O extends Record<string, OptionDef<OptionType, boolean>>, S extends Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>>>(def: CommandDef<O, S>): CommandDef<O, S>;
1941
+
1942
+ declare class ModalContext extends BaseInteractionContext {
1943
+ customId: string;
1944
+ private _fields;
1945
+ constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
1946
+ id: string;
1947
+ }, channel?: Channel | {
1948
+ id: string;
1949
+ });
1950
+ get values(): string[];
1951
+ get fields(): Record<string, string>;
1952
+ }
1953
+
1954
+ declare class ComponentContext<Values = unknown, Fields = unknown> extends BaseInteractionContext {
1955
+ customId: string;
1956
+ message?: Record<string, unknown>;
1957
+ values: Values;
1958
+ fields: Fields;
1959
+ constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
1960
+ id: string;
1961
+ }, channel?: Channel | {
1962
+ id: string;
1963
+ });
1964
+ deferUpdate(): Promise<void>;
1965
+ update(payload: InteractionReplyOptions): Promise<void>;
1966
+ }
1967
+
1968
+ interface ComponentHandler {
1969
+ type?: string;
1970
+ customId?: string | RegExp;
1971
+ execute?: (ctx: ComponentContext) => unknown | Promise<unknown>;
1972
+ }
1973
+ interface ModalHandler {
1974
+ customId: string | RegExp;
1975
+ execute: (ctx: ModalContext) => unknown | Promise<unknown>;
1976
+ }
1977
+ declare class CommandManager {
1978
+ private _commands;
1979
+ private _components;
1980
+ private _modals;
1981
+ private _client;
1982
+ constructor(client: Client);
1983
+ register(...commands: AnyCommandDef[]): void;
1984
+ registerGuild(guildId: string, ...commands: AnyCommandDef[]): void;
1985
+ registerComponent(handler: ComponentHandler): void;
1986
+ registerModal(handler: ModalHandler): void;
1987
+ load(directory: string): Promise<void>;
1988
+ private _deployCommands;
1989
+ private _transformCommand;
1990
+ handleInteraction(raw: Record<string, unknown>): Promise<void>;
1991
+ private _handleComponentInteraction;
1992
+ private _handleModalInteraction;
1993
+ }
1994
+
1995
+ declare enum COMPONENT_TYPES {
1996
+ ACTION_ROW = 1,
1997
+ BUTTON = 2,
1998
+ STRING_SELECT = 3,
1999
+ TEXT_INPUT = 4,
2000
+ USER_SELECT = 5,
2001
+ ROLE_SELECT = 6,
2002
+ MENTIONABLE_SELECT = 7,
2003
+ CHANNEL_SELECT = 8
2004
+ }
2005
+ declare enum TEXT_INPUT_STYLES {
2006
+ SHORT = 1,
2007
+ PARAGRAPH = 2
2008
+ }
2009
+
2010
+ type ButtonStyleString = 'primary' | 'secondary' | 'success' | 'danger' | 'link' | 'premium';
2011
+ interface ButtonDef {
2012
+ customId?: string;
2013
+ url?: string;
2014
+ label?: string;
2015
+ style: ButtonStyleString | number;
2016
+ disabled?: boolean;
1937
2017
  emoji?: Partial<Emoji>;
1938
- } | {
1939
- type: 'GUILD_AUDIT_LOG_ENTRY_CREATE';
1940
- guildId: string;
1941
- entry: AuditLogEntry;
1942
- } | {
1943
- type: 'THREAD_MEMBERS_UPDATE';
2018
+ skuId?: string;
2019
+ execute?: (ctx: ComponentContext) => void | Promise<void>;
2020
+ }
2021
+ declare function resolveButtonStyle(style: string | number): number;
2022
+ declare function defineButton(def: ButtonDef): ButtonDef & {
2023
+ type: 'button';
2024
+ };
2025
+ interface StringSelectDef {
2026
+ customId: string;
2027
+ options: SelectOption[];
2028
+ placeholder?: string;
2029
+ minValues?: number;
2030
+ maxValues?: number;
2031
+ disabled?: boolean;
2032
+ execute: (ctx: ComponentContext<string[]>) => void | Promise<void>;
2033
+ }
2034
+ declare function defineStringSelect(def: StringSelectDef): StringSelectDef & {
2035
+ type: 'string_select';
2036
+ };
2037
+ interface UserSelectDef {
2038
+ customId: string;
2039
+ placeholder?: string;
2040
+ minValues?: number;
2041
+ maxValues?: number;
2042
+ disabled?: boolean;
2043
+ execute: (ctx: ComponentContext<User[]>) => void | Promise<void>;
2044
+ }
2045
+ declare function defineUserSelect(def: UserSelectDef): UserSelectDef & {
2046
+ type: 'user_select';
2047
+ };
2048
+ interface RoleSelectDef {
2049
+ customId: string;
2050
+ placeholder?: string;
2051
+ minValues?: number;
2052
+ maxValues?: number;
2053
+ disabled?: boolean;
2054
+ execute: (ctx: ComponentContext<Role[]>) => void | Promise<void>;
2055
+ }
2056
+ declare function defineRoleSelect(def: RoleSelectDef): RoleSelectDef & {
2057
+ type: 'role_select';
2058
+ };
2059
+ interface ChannelSelectDef {
2060
+ customId: string;
2061
+ channelTypes?: number[];
2062
+ placeholder?: string;
2063
+ minValues?: number;
2064
+ maxValues?: number;
2065
+ disabled?: boolean;
2066
+ execute: (ctx: ComponentContext<Partial<Channel>[]>) => void | Promise<void>;
2067
+ }
2068
+ declare function defineChannelSelect(def: ChannelSelectDef): ChannelSelectDef & {
2069
+ type: 'channel_select';
2070
+ };
2071
+ interface MentionableSelectDef {
2072
+ customId: string;
2073
+ placeholder?: string;
2074
+ minValues?: number;
2075
+ maxValues?: number;
2076
+ disabled?: boolean;
2077
+ execute: (ctx: ComponentContext<(User | Role)[]>) => void | Promise<void>;
2078
+ }
2079
+ declare function defineMentionableSelect(def: MentionableSelectDef): MentionableSelectDef & {
2080
+ type: 'mentionable_select';
2081
+ };
2082
+ interface ModalFieldDef<Required extends boolean = true> {
1944
2083
  id: string;
1945
- guildId: string;
1946
- memberCount: number;
1947
- addedMembers?: Partial<Member>[];
1948
- removedMemberIds?: string[];
1949
- } | {
1950
- type: 'THREAD_MEMBER_UPDATE';
1951
- member: Partial<Member>;
1952
- guildId: string;
1953
- } | {
1954
- type: 'APPLICATION_COMMAND_PERMISSIONS_UPDATE';
1955
- permissions: {
1956
- applicationId: string;
1957
- guildId: string;
1958
- id: string;
1959
- permissions: string[];
1960
- }[];
1961
- } | {
1962
- type: 'GUILD_SCHEDULED_EVENT_CREATE';
1963
- scheduledEvent: GuildScheduledEvent;
1964
- } | {
1965
- type: 'GUILD_SCHEDULED_EVENT_UPDATE';
1966
- scheduledEvent: GuildScheduledEvent;
1967
- } | {
1968
- type: 'GUILD_SCHEDULED_EVENT_DELETE';
1969
- scheduledEvent: GuildScheduledEvent;
1970
- } | {
1971
- type: 'GUILD_SCHEDULED_EVENT_USER_ADD';
1972
- guildScheduledEventId: string;
1973
- userId: string;
1974
- guildId: string;
1975
- } | {
1976
- type: 'GUILD_SCHEDULED_EVENT_USER_REMOVE';
1977
- guildScheduledEventId: string;
1978
- userId: string;
1979
- guildId: string;
1980
- } | {
1981
- type: 'AUTO_MODERATION_RULE_CREATE';
1982
- rule: AutoModerationRule;
1983
- } | {
1984
- type: 'AUTO_MODERATION_RULE_UPDATE';
1985
- rule: AutoModerationRule;
1986
- } | {
1987
- type: 'AUTO_MODERATION_RULE_DELETE';
1988
- rule: AutoModerationRule;
1989
- } | {
1990
- type: 'AUTO_MODERATION_ACTION_EXECUTION';
1991
- guildId: string;
1992
- action: AutoModerationAction;
1993
- ruleId: string;
1994
- ruleTriggerType: number;
1995
- userId: string;
1996
- channelId?: string;
1997
- messageId?: string;
1998
- content?: string;
1999
- matchedKeyword?: string | null;
2000
- matchedContent?: string | null;
2001
- } | {
2002
- type: 'INVITE_CREATE';
2003
- channelId: string;
2004
- code: string;
2005
- guildId?: string;
2006
- inviter?: User;
2007
- maxAge: number;
2008
- maxUses: number;
2009
- temporary: boolean;
2010
- } | {
2011
- type: 'INVITE_DELETE';
2012
- channelId: string;
2013
- code: string;
2014
- guildId?: string;
2015
- } | {
2016
- type: 'GUILD_INTEGRATIONS_UPDATE';
2017
- guildId: string;
2018
- } | {
2019
- type: 'INTEGRATION_CREATE';
2020
- guildId: string;
2021
- integration: Integration;
2022
- } | {
2023
- type: 'INTEGRATION_UPDATE';
2024
- guildId: string;
2025
- integration: Integration;
2026
- } | {
2027
- type: 'INTEGRATION_DELETE';
2084
+ type: TEXT_INPUT_STYLES;
2085
+ label: string;
2086
+ required?: Required;
2087
+ minLength?: number;
2088
+ maxLength?: number;
2089
+ placeholder?: string;
2090
+ value?: string;
2091
+ }
2092
+ declare const field: {
2093
+ short: <ID extends string, Req extends boolean = true>(id: ID, label: string, options?: {
2094
+ required?: Req;
2095
+ minLength?: number;
2096
+ maxLength?: number;
2097
+ placeholder?: string;
2098
+ value?: string;
2099
+ }) => ModalFieldDef<Req> & {
2100
+ id: ID;
2101
+ };
2102
+ paragraph: <ID extends string, Req extends boolean = true>(id: ID, label: string, options?: {
2103
+ required?: Req;
2104
+ minLength?: number;
2105
+ maxLength?: number;
2106
+ placeholder?: string;
2107
+ value?: string;
2108
+ }) => ModalFieldDef<Req> & {
2109
+ id: ID;
2110
+ };
2111
+ };
2112
+ type ResolveModalFields<F extends ReadonlyArray<ModalFieldDef<boolean>>> = {
2113
+ [K in F[number] as K['id']]: K['required'] extends false ? string | undefined : string;
2114
+ };
2115
+ interface ModalDef<F extends ReadonlyArray<ModalFieldDef<boolean>>> {
2116
+ customId: string;
2117
+ title: string;
2118
+ fields: F;
2119
+ execute: (ctx: ComponentContext<never, ResolveModalFields<F>>) => void | Promise<void>;
2120
+ }
2121
+ declare function defineModal<F extends ReadonlyArray<ModalFieldDef<boolean>>>(def: ModalDef<F>): ModalDef<F> & {
2122
+ type: 'modal';
2123
+ };
2124
+
2125
+ type ComponentInput = (ButtonDef & {
2126
+ type: 'button';
2127
+ }) | (StringSelectDef & {
2128
+ type: 'string_select';
2129
+ }) | (UserSelectDef & {
2130
+ type: 'user_select';
2131
+ }) | (RoleSelectDef & {
2132
+ type: 'role_select';
2133
+ }) | (MentionableSelectDef & {
2134
+ type: 'mentionable_select';
2135
+ }) | (ChannelSelectDef & {
2136
+ type: 'channel_select';
2137
+ }) | (ModalFieldDef & {
2028
2138
  id: string;
2029
- guildId: string;
2030
- applicationId?: string;
2031
- } | {
2032
- type: 'ENTITLEMENT_CREATE';
2033
- entitlement: Entitlement;
2034
- } | {
2035
- type: 'ENTITLEMENT_UPDATE';
2036
- entitlement: Entitlement;
2037
- } | {
2038
- type: 'ENTITLEMENT_DELETE';
2039
- entitlement: Entitlement;
2040
- } | {
2041
- type: 'PRESENCE_UPDATE';
2042
- user: Partial<User> & {
2043
- id: string;
2139
+ }) | Record<string, unknown>;
2140
+ declare const ActionRow: {
2141
+ of: (...components: ComponentInput[]) => {
2142
+ type: COMPONENT_TYPES;
2143
+ components: Record<string, unknown>[];
2144
+ };
2145
+ };
2146
+
2147
+ declare class ComponentManager {
2148
+ private client;
2149
+ private handlers;
2150
+ constructor(client: Client);
2151
+ register(...components: ComponentHandler[]): void;
2152
+ handleInteraction(raw: Record<string, unknown>): Promise<void>;
2153
+ }
2154
+
2155
+ declare abstract class BaseManager<T extends {
2156
+ id: string;
2157
+ }> {
2158
+ protected rest: ChameleonREST;
2159
+ protected store: TongueStore;
2160
+ constructor(rest: ChameleonREST, store: TongueStore);
2161
+ protected abstract endpoint(id: string): string;
2162
+ protected abstract build(raw: unknown): T;
2163
+ protected abstract storeKey: keyof TongueStore;
2164
+ fetch(id: string, force?: boolean): Promise<ChameleonAPIResult<T>>;
2165
+ }
2166
+
2167
+ declare const Colors: {
2168
+ readonly Blue: 2003199;
2169
+ readonly Purple: 10181046;
2170
+ readonly Orange: 16744272;
2171
+ readonly Pink: 16739201;
2172
+ readonly White: 16777215;
2173
+ readonly Blurple: 5793266;
2174
+ readonly Green: 5763719;
2175
+ readonly Yellow: 16705372;
2176
+ readonly Fuchsia: 15418782;
2177
+ readonly Red: 15548997;
2178
+ readonly Black: 2303786;
2179
+ readonly Transparent: 3092790;
2180
+ };
2181
+ declare class EmbedBuilder {
2182
+ private data;
2183
+ constructor(data?: Partial<Embed>);
2184
+ setTitle(title: string): this;
2185
+ setDescription(description: string): this;
2186
+ setColor(color: number): this;
2187
+ setURL(url: string): this;
2188
+ setTimestamp(ts?: Date | number): this;
2189
+ setFooter(text: string, iconUrl?: string): this;
2190
+ setAuthor(name: string, iconUrl?: string, url?: string): this;
2191
+ setImage(url: string): this;
2192
+ setThumbnail(url: string): this;
2193
+ addField(name: string, value: string, inline?: boolean): this;
2194
+ addFields(...fields: EmbedField[]): this;
2195
+ build(): Embed;
2196
+ toJSON(): Record<string, unknown>;
2197
+ }
2198
+
2199
+ declare class ButtonBuilder {
2200
+ private data;
2201
+ setCustomId(id: string): this;
2202
+ setLabel(label: string): this;
2203
+ setStyle(style: number): this;
2204
+ setEmoji(emoji: Partial<Emoji>): this;
2205
+ setDisabled(disabled?: boolean): this;
2206
+ setURL(url: string): this;
2207
+ build(): MessageComponent;
2208
+ toJSON(): Record<string, unknown>;
2209
+ }
2210
+ declare class SelectMenuBuilder {
2211
+ private data;
2212
+ setCustomId(id: string): this;
2213
+ setPlaceholder(placeholder: string): this;
2214
+ setMinValues(min: number): this;
2215
+ setMaxValues(max: number): this;
2216
+ setDisabled(disabled?: boolean): this;
2217
+ setType(type: number): this;
2218
+ addOption(option: SelectOption): this;
2219
+ addOptions(...options: SelectOption[]): this;
2220
+ build(): MessageComponent;
2221
+ toJSON(): Record<string, unknown>;
2222
+ }
2223
+ declare class TextInputBuilder {
2224
+ private data;
2225
+ private _minLength?;
2226
+ private _maxLength?;
2227
+ private _required?;
2228
+ private _value?;
2229
+ setCustomId(id: string): this;
2230
+ setLabel(label: string): this;
2231
+ setStyle(style: number): this;
2232
+ setPlaceholder(placeholder: string): this;
2233
+ setMinLength(length: number): this;
2234
+ setMaxLength(length: number): this;
2235
+ setRequired(required?: boolean): this;
2236
+ setValue(value: string): this;
2237
+ build(): MessageComponent;
2238
+ toJSON(): Record<string, unknown>;
2239
+ }
2240
+ declare class ActionRowBuilder {
2241
+ private data;
2242
+ addComponent(component: MessageComponent | {
2243
+ build(): MessageComponent;
2244
+ } | {
2245
+ toJSON(): Record<string, unknown>;
2246
+ }): this;
2247
+ addComponents(...components: (MessageComponent | {
2248
+ build(): MessageComponent;
2249
+ } | {
2250
+ toJSON(): Record<string, unknown>;
2251
+ })[]): this;
2252
+ build(): MessageComponent;
2253
+ toJSON(): Record<string, unknown>;
2254
+ }
2255
+ declare class ModalBuilder {
2256
+ private _title;
2257
+ private _customId;
2258
+ private _components;
2259
+ setTitle(title: string): this;
2260
+ setCustomId(id: string): this;
2261
+ addComponent(component: MessageComponent | {
2262
+ build(): MessageComponent;
2263
+ } | {
2264
+ toJSON(): Record<string, unknown>;
2265
+ }): this;
2266
+ addComponents(...components: (MessageComponent | {
2267
+ build(): MessageComponent;
2268
+ } | {
2269
+ toJSON(): Record<string, unknown>;
2270
+ })[]): this;
2271
+ build(): {
2272
+ title: string;
2273
+ custom_id: string;
2274
+ components: (MessageComponent | {
2275
+ build(): MessageComponent;
2276
+ } | {
2277
+ toJSON(): Record<string, unknown>;
2278
+ })[];
2044
2279
  };
2045
- guildId: string;
2046
- status: string;
2047
- activities: unknown[];
2048
- clientStatus: unknown;
2049
- } | {
2050
- type: 'TYPING_START';
2051
- channelId: string;
2052
- guildId?: string;
2053
- userId: string;
2054
- timestamp: number;
2055
- member?: Member;
2056
- } | {
2057
- type: 'USER_UPDATE';
2058
- oldUser?: User;
2059
- user: User;
2060
- } | {
2061
- type: 'WEBHOOKS_UPDATE';
2062
- guildId: string;
2063
- channelId: string;
2064
- } | {
2065
- type: 'MESSAGE_POLL_VOTE_ADD';
2066
- userId: string;
2067
- channelId: string;
2068
- messageId: string;
2069
- guildId?: string;
2070
- answerId: number;
2280
+ toJSON(): {
2281
+ title: string;
2282
+ custom_id: string;
2283
+ components: (MessageComponent | Record<string, unknown> | {
2284
+ build(): MessageComponent;
2285
+ } | {
2286
+ toJSON(): Record<string, unknown>;
2287
+ })[];
2288
+ };
2289
+ }
2290
+ declare function serializeComponent(component: MessageComponent | {
2291
+ build?(): MessageComponent;
2071
2292
  } | {
2072
- type: 'MESSAGE_POLL_VOTE_REMOVE';
2073
- userId: string;
2074
- channelId: string;
2075
- messageId: string;
2076
- guildId?: string;
2077
- answerId: number;
2078
- };
2079
- type ChameleonEventHandler = (event: ChameleonEvent) => void | Promise<void>;
2293
+ toJSON?(): Record<string, unknown>;
2294
+ } | Record<string, unknown>): Record<string, unknown>;
2080
2295
 
2081
- type OptionType = 'string' | 'integer' | 'boolean' | 'user' | 'channel' | 'role' | 'number';
2082
- interface OptionDef<T extends OptionType, R extends boolean> {
2083
- type: T;
2084
- description: string;
2085
- required: R;
2086
- min?: number;
2087
- max?: number;
2088
- choices?: {
2089
- name: string;
2090
- value: string | number;
2091
- }[];
2092
- }
2093
- type ResolveOptionType<T extends OptionType> = T extends 'string' ? string : T extends 'integer' | 'number' ? number : T extends 'boolean' ? boolean : T extends 'user' ? User : T extends 'channel' ? Channel : T extends 'role' ? Role : never;
2094
- type ResolveOption<O extends OptionDef<any, boolean>> = O['required'] extends true ? ResolveOptionType<O['type']> : ResolveOptionType<O['type']> | undefined;
2095
- type ResolveOptions<O extends Record<string, OptionDef<any, boolean>>> = {
2096
- [K in keyof O]: ResolveOption<O[K]>;
2296
+ declare function buildStageInstance(raw: Record<string, unknown>): StageInstance;
2297
+ declare function buildScheduledEvent(raw: Record<string, unknown>): GuildScheduledEvent;
2298
+ declare function buildAutoModRule(raw: Record<string, unknown>): AutoModerationRule;
2299
+ declare function buildIntegration(raw: Record<string, unknown>): Integration;
2300
+ declare function buildEmoji(raw: Record<string, unknown>): Emoji;
2301
+ declare function buildSticker(raw: Record<string, unknown>): Sticker;
2302
+ declare function buildStickerItem(raw: Record<string, unknown>): StickerItem;
2303
+ declare function buildVoiceState(raw: Record<string, unknown>, cache?: TongueStore): Voice;
2304
+ declare function buildEntitlement(raw: Record<string, unknown>): Entitlement;
2305
+ declare function buildInteraction(raw: Record<string, unknown>, cache?: TongueStore): Interaction;
2306
+ declare function buildInvite(raw: Record<string, unknown>): Invite;
2307
+ declare function buildWebhook(raw: Record<string, unknown>): Webhook;
2308
+
2309
+ declare function buildUser(raw: Record<string, unknown>): User;
2310
+ declare function buildChannel(raw: Record<string, unknown>, guildId?: string): Channel;
2311
+ declare function buildGuild(raw: Record<string, unknown>): Guild;
2312
+ declare function buildRole(raw: Record<string, unknown>): Role;
2313
+ declare function buildMember(raw: Record<string, unknown>, guildId: string, cache: TongueStore): Member;
2314
+ declare function buildMessage(raw: Record<string, unknown>, cache: TongueStore, oldMessage?: Message): Message;
2315
+ declare function resolveChannel(channelId: string, client: Client): Channel | {
2316
+ id: string;
2317
+ fetch: () => Promise<ChameleonAPIResult<Channel>>;
2097
2318
  };
2098
- declare const opt: {
2099
- string: <R extends boolean = false>(description: string, options?: {
2100
- required?: R;
2101
- choices?: {
2102
- name: string;
2103
- value: string;
2104
- }[];
2105
- minLength?: number;
2106
- maxLength?: number;
2107
- }) => OptionDef<"string", R>;
2108
- integer: <R extends boolean = false>(description: string, options?: {
2109
- required?: R;
2110
- choices?: {
2111
- name: string;
2112
- value: number;
2113
- }[];
2114
- min?: number;
2115
- max?: number;
2116
- }) => OptionDef<"integer", R>;
2117
- number: <R extends boolean = false>(description: string, options?: {
2118
- required?: R;
2119
- choices?: {
2120
- name: string;
2121
- value: number;
2122
- }[];
2123
- min?: number;
2124
- max?: number;
2125
- }) => OptionDef<"number", R>;
2126
- boolean: <R extends boolean = false>(description: string, options?: {
2127
- required?: R;
2128
- }) => OptionDef<"boolean", R>;
2129
- user: <R extends boolean = false>(description: string, options?: {
2130
- required?: R;
2131
- }) => OptionDef<"user", R>;
2132
- channel: <R extends boolean = false>(description: string, options?: {
2133
- required?: R;
2134
- }) => OptionDef<"channel", R>;
2135
- role: <R extends boolean = false>(description: string, options?: {
2136
- required?: R;
2137
- }) => OptionDef<"role", R>;
2319
+ declare function resolveGuild(guildId: string, client: Client): Guild | {
2320
+ id: string;
2321
+ fetch: () => Promise<ChameleonAPIResult<Guild>>;
2138
2322
  };
2139
-
2140
- type InteractionReplyOptions = string | {
2141
- content?: string;
2142
- embeds?: any[];
2143
- components?: any[];
2144
- ephemeral?: boolean;
2323
+ declare function resolveUser(userId: string, client: Client): User | {
2324
+ id: string;
2325
+ fetch: () => Promise<ChameleonAPIResult<User>>;
2145
2326
  };
2146
- declare class CommandContext<Options = Record<string, any>> {
2147
- options: Options;
2148
- user: User;
2149
- guild?: Guild | {
2150
- id: string;
2151
- } | undefined;
2152
- channel?: Channel | {
2153
- id: string;
2154
- } | undefined;
2155
- interactionId: string;
2156
- interactionToken: string;
2157
- private _client;
2158
- private _deferred;
2159
- private _replied;
2160
- constructor(client: Client, rawInteraction: Record<string, any>, parsedOptions: Options, user: User, guild?: Guild | {
2161
- id: string;
2162
- }, channel?: Channel | {
2163
- id: string;
2164
- });
2165
- get replied(): boolean;
2166
- get deferred(): boolean;
2167
- reply(payload: InteractionReplyOptions): Promise<void>;
2168
- defer(options?: {
2169
- ephemeral?: boolean;
2170
- }): Promise<void>;
2171
- followUp(payload: InteractionReplyOptions): Promise<void>;
2172
- showModal(modal: any): Promise<void>;
2173
- }
2174
-
2175
- type ExecuteFunction<O extends Record<string, OptionDef<any, boolean>>> = (ctx: CommandContext<ResolveOptions<O>>) => void | Promise<void>;
2176
- interface Subcommand<O extends Record<string, OptionDef<any, boolean>> = Record<string, never>> {
2177
- description: string;
2178
- options?: O;
2179
- execute: ExecuteFunction<O>;
2180
- }
2181
- declare function defineSubcommand<O extends Record<string, OptionDef<any, boolean>>>(def: Subcommand<O>): Subcommand<O>;
2182
- type CommandDef<O extends Record<string, OptionDef<any, boolean>> = Record<string, never>, S extends Record<string, Subcommand<any>> = Record<string, never>> = {
2183
- name: string;
2184
- description: string;
2185
- options?: O;
2186
- subcommands?: S;
2187
- execute?: ExecuteFunction<O>;
2327
+ declare function resolveRole(roleId: string, client: Client, guildId?: string): Role | {
2328
+ id: string;
2329
+ fetch?: () => Promise<ChameleonAPIResult<Role>>;
2188
2330
  };
2189
- declare function defineCommand<O extends Record<string, OptionDef<any, boolean>>, S extends Record<string, Subcommand<any>>>(def: CommandDef<O, S>): CommandDef<O, S>;
2190
2331
 
2191
- declare class ComponentContext$1 {
2192
- customId: string;
2193
- user: User;
2194
- guild?: Guild | {
2195
- id: string;
2196
- } | undefined;
2197
- channel?: Channel | {
2198
- id: string;
2199
- } | undefined;
2200
- message?: Record<string, unknown>;
2201
- interactionId: string;
2202
- interactionToken: string;
2203
- private _client;
2204
- private _deferred;
2205
- private _replied;
2206
- constructor(client: Client, raw: Record<string, any>, user: User, guild?: Guild | {
2207
- id: string;
2208
- }, channel?: Channel | {
2209
- id: string;
2210
- });
2211
- get replied(): boolean;
2212
- get deferred(): boolean;
2213
- /** Values from a select menu interaction */
2214
- get values(): string[];
2215
- reply(payload: InteractionReplyOptions): Promise<void>;
2216
- deferUpdate(): Promise<void>;
2217
- update(payload: InteractionReplyOptions): Promise<void>;
2218
- followUp(payload: InteractionReplyOptions): Promise<void>;
2219
- }
2220
- declare class ModalContext {
2221
- customId: string;
2222
- user: User;
2223
- guild?: Guild | {
2224
- id: string;
2225
- } | undefined;
2226
- channel?: Channel | {
2227
- id: string;
2228
- } | undefined;
2229
- interactionId: string;
2230
- interactionToken: string;
2231
- private _fields;
2232
- private _client;
2233
- private _replied;
2234
- private _deferred;
2235
- constructor(client: Client, raw: Record<string, any>, user: User, guild?: Guild | {
2236
- id: string;
2237
- }, channel?: Channel | {
2238
- id: string;
2239
- });
2240
- get replied(): boolean;
2241
- get deferred(): boolean;
2242
- /** Get a text input value by its customId */
2243
- getField(customId: string): string | undefined;
2244
- /** Get all field values as a plain object */
2245
- get fields(): Record<string, string>;
2246
- reply(payload: InteractionReplyOptions): Promise<void>;
2247
- defer(options?: {
2248
- ephemeral?: boolean;
2249
- }): Promise<void>;
2250
- followUp(payload: InteractionReplyOptions): Promise<void>;
2332
+ declare class UserManager extends BaseManager<User> {
2333
+ protected storeKey: "users";
2334
+ protected endpoint(id: string): string;
2335
+ protected build: typeof buildUser;
2336
+ createDM(userId: string): Promise<ChameleonAPIResult<Channel>>;
2337
+ editCurrent(payload: {
2338
+ username?: string;
2339
+ avatar?: string | null;
2340
+ }): Promise<ChameleonAPIResult<User>>;
2251
2341
  }
2252
2342
 
2253
- interface ComponentHandler {
2254
- customId: string | RegExp;
2255
- execute: (ctx: ComponentContext$1) => any | Promise<any>;
2256
- }
2257
- interface ModalHandler {
2258
- customId: string | RegExp;
2259
- execute: (ctx: ModalContext) => any | Promise<any>;
2343
+ declare class RoleManager {
2344
+ protected rest: ChameleonREST;
2345
+ protected store: TongueStore;
2346
+ protected guildId: string;
2347
+ constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
2348
+ fetch(roleId: string, force?: boolean): Promise<ChameleonAPIResult<Role>>;
2349
+ list(): Promise<ChameleonAPIResult<Role[]>>;
2350
+ create(payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
2351
+ edit(roleId: string, payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
2352
+ delete(roleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2260
2353
  }
2261
- declare class CommandManager {
2262
- private _commands;
2263
- private _components;
2264
- private _modals;
2265
- private _client;
2266
- constructor(client: Client);
2267
- register(...commands: CommandDef<any, any>[]): void;
2268
- registerComponent(handler: ComponentHandler): void;
2269
- registerModal(handler: ModalHandler): void;
2270
- load(directory: string): Promise<void>;
2271
- private _deployCommands;
2272
- private _transformCommand;
2273
- handleInteraction(raw: any): Promise<void>;
2274
- private _handleComponentInteraction;
2275
- private _handleModalInteraction;
2354
+
2355
+ declare class MemberManager {
2356
+ protected rest: ChameleonREST;
2357
+ protected store: TongueStore;
2358
+ private guildId;
2359
+ constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
2360
+ fetch(userId: string, force?: boolean): Promise<ChameleonAPIResult<Member>>;
2361
+ edit(userId: string, payload: Partial<Member>, reason?: string): Promise<ChameleonAPIResult<Member>>;
2362
+ list(options?: {
2363
+ limit?: number;
2364
+ after?: string;
2365
+ }): Promise<ChameleonAPIResult<Member[]>>;
2366
+ search(query: string, limit?: number): Promise<ChameleonAPIResult<Member[]>>;
2367
+ addRole(userId: string, roleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2368
+ removeRole(userId: string, roleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2369
+ timeout(userId: string, until: number | Date | null, reason?: string): Promise<ChameleonAPIResult<Member>>;
2276
2370
  }
2277
2371
 
2278
- declare class ComponentContext<Values = any, Fields = any> {
2279
- user: User;
2280
- guild?: Guild | {
2281
- id: string;
2282
- } | undefined;
2283
- channel?: Channel | {
2284
- id: string;
2285
- } | undefined;
2286
- interactionId: string;
2287
- interactionToken: string;
2288
- customId: string;
2289
- values: Values;
2290
- fields: Fields;
2291
- private _client;
2292
- private _deferred;
2293
- private _replied;
2294
- constructor(client: Client, rawInteraction: Record<string, any>, user: User, guild?: Guild | {
2295
- id: string;
2296
- }, channel?: Channel | {
2297
- id: string;
2298
- });
2299
- get replied(): boolean;
2300
- get deferred(): boolean;
2301
- reply(payload: InteractionReplyOptions): Promise<void>;
2302
- defer(options?: {
2303
- ephemeral?: boolean;
2304
- }): Promise<void>;
2305
- update(payload: InteractionReplyOptions): Promise<void>;
2306
- deferUpdate(): Promise<void>;
2307
- followUp(payload: InteractionReplyOptions): Promise<void>;
2308
- showModal(modal: any): Promise<void>;
2372
+ declare class GuildManager extends BaseManager<Guild> {
2373
+ protected storeKey: "guilds";
2374
+ protected endpoint(id: string): string;
2375
+ protected build: typeof buildGuild;
2376
+ roles(guildId: string): RoleManager;
2377
+ members(guildId: string): MemberManager;
2378
+ fetchChannels(guildId: string): Promise<ChameleonAPIResult<Channel[]>>;
2379
+ ban(guildId: string, userId: string, options?: {
2380
+ deleteMessageSeconds?: number;
2381
+ reason?: string;
2382
+ }): Promise<ChameleonAPIResult<void>>;
2383
+ unban(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2384
+ kick(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2385
+ edit(guildId: string, payload: Partial<Guild>, reason?: string): Promise<ChameleonAPIResult<Guild>>;
2386
+ delete(guildId: string): Promise<ChameleonAPIResult<void>>;
2387
+ listEmojis(guildId: string): Promise<ChameleonAPIResult<Emoji[]>>;
2388
+ fetchEmoji(guildId: string, emojiId: string): Promise<ChameleonAPIResult<Emoji>>;
2389
+ createEmoji(guildId: string, payload: {
2390
+ name: string;
2391
+ image: string;
2392
+ roles?: string[];
2393
+ }, reason?: string): Promise<ChameleonAPIResult<Emoji>>;
2394
+ editEmoji(guildId: string, emojiId: string, payload: {
2395
+ name?: string;
2396
+ roles?: string[];
2397
+ }, reason?: string): Promise<ChameleonAPIResult<Emoji>>;
2398
+ deleteEmoji(guildId: string, emojiId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2399
+ listStickers(guildId: string): Promise<ChameleonAPIResult<Sticker[]>>;
2400
+ fetchSticker(guildId: string, stickerId: string): Promise<ChameleonAPIResult<Sticker>>;
2401
+ listBans(guildId: string, options?: {
2402
+ limit?: number;
2403
+ before?: string;
2404
+ after?: string;
2405
+ }): Promise<ChameleonAPIResult<{
2406
+ reason: string | null;
2407
+ user: User;
2408
+ }[]>>;
2409
+ fetchBan(guildId: string, userId: string): Promise<ChameleonAPIResult<{
2410
+ reason: string | null;
2411
+ user: User;
2412
+ }>>;
2413
+ getInvites(guildId: string): Promise<ChameleonAPIResult<Invite[]>>;
2414
+ getVanityURL(guildId: string): Promise<ChameleonAPIResult<{
2415
+ code: string | null;
2416
+ uses: number;
2417
+ }>>;
2418
+ getPruneCount(guildId: string, options?: {
2419
+ days?: number;
2420
+ includeRoles?: string[];
2421
+ }): Promise<ChameleonAPIResult<number>>;
2422
+ beginPrune(guildId: string, options?: {
2423
+ days?: number;
2424
+ computePruneCount?: boolean;
2425
+ includeRoles?: string[];
2426
+ }, reason?: string): Promise<ChameleonAPIResult<number | null>>;
2427
+ fetchAuditLog(guildId: string, options?: {
2428
+ userId?: string;
2429
+ actionType?: number;
2430
+ before?: string;
2431
+ after?: string;
2432
+ limit?: number;
2433
+ }): Promise<ChameleonAPIResult<AuditLog>>;
2434
+ leave(guildId: string): Promise<ChameleonAPIResult<void>>;
2309
2435
  }
2310
- declare function buildModalPayload(def: any): {
2311
- custom_id: any;
2312
- title: any;
2313
- components: any;
2314
- };
2315
2436
 
2316
- declare enum COMPONENT_TYPES {
2317
- ACTION_ROW = 1,
2318
- BUTTON = 2,
2319
- STRING_SELECT = 3,
2320
- TEXT_INPUT = 4,
2321
- USER_SELECT = 5,
2322
- ROLE_SELECT = 6,
2323
- MENTIONABLE_SELECT = 7,
2324
- CHANNEL_SELECT = 8
2437
+ declare class ChannelManager extends BaseManager<Channel> {
2438
+ protected storeKey: "channels";
2439
+ protected endpoint(id: string): string;
2440
+ protected build: typeof buildChannel;
2441
+ create(guildId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2442
+ edit(channelId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2443
+ delete(channelId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2444
+ clone(channelId: string, options?: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2445
+ setPositions(guildId: string, positions: {
2446
+ id: string;
2447
+ position?: number;
2448
+ lockPermissions?: boolean;
2449
+ parentId?: string;
2450
+ }[], reason?: string): Promise<ChameleonAPIResult<void>>;
2451
+ updatePermissions(channelId: string, overwriteId: string, payload: Partial<Overwrite>, reason?: string): Promise<ChameleonAPIResult<void>>;
2452
+ deletePermission(channelId: string, overwriteId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2453
+ sendTyping(channelId: string): Promise<ChameleonAPIResult<void>>;
2454
+ getInvites(channelId: string): Promise<ChameleonAPIResult<Invite[]>>;
2455
+ createInvite(channelId: string, options?: {
2456
+ maxAge?: number;
2457
+ maxUses?: number;
2458
+ temporary?: boolean;
2459
+ unique?: boolean;
2460
+ targetType?: number;
2461
+ targetUserId?: string;
2462
+ targetApplicationId?: string;
2463
+ }, reason?: string): Promise<ChameleonAPIResult<Invite>>;
2464
+ followAnnouncementChannel(channelId: string, webhookChannelId: string): Promise<ChameleonAPIResult<{
2465
+ channelId: string;
2466
+ webhookId: string;
2467
+ }>>;
2468
+ createThread(channelId: string, options: {
2469
+ name: string;
2470
+ autoArchiveDuration?: number;
2471
+ type?: number;
2472
+ invitable?: boolean;
2473
+ rateLimitPerUser?: number;
2474
+ }, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2475
+ createThreadFromMessage(channelId: string, messageId: string, options: {
2476
+ name: string;
2477
+ autoArchiveDuration?: number;
2478
+ rateLimitPerUser?: number;
2479
+ }, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2480
+ joinThread(channelId: string): Promise<ChameleonAPIResult<void>>;
2481
+ leaveThread(channelId: string): Promise<ChameleonAPIResult<void>>;
2482
+ listActiveThreads(guildId: string): Promise<ChameleonAPIResult<{
2483
+ threads: Channel[];
2484
+ members: unknown[];
2485
+ }>>;
2486
+ listArchivedThreads(channelId: string, type: 'public' | 'private', options?: {
2487
+ before?: string;
2488
+ limit?: number;
2489
+ }): Promise<ChameleonAPIResult<{
2490
+ threads: Channel[];
2491
+ members: unknown[];
2492
+ hasMore: boolean;
2493
+ }>>;
2494
+ addThreadMember(channelId: string, userId: string): Promise<ChameleonAPIResult<void>>;
2495
+ removeThreadMember(channelId: string, userId: string): Promise<ChameleonAPIResult<void>>;
2496
+ createForumThread(channelId: string, options: {
2497
+ name: string;
2498
+ autoArchiveDuration?: number;
2499
+ rateLimitPerUser?: number;
2500
+ appliedTags?: string[];
2501
+ message: {
2502
+ content?: string;
2503
+ embeds?: (Embed | {
2504
+ toJSON(): Record<string, unknown>;
2505
+ } | Record<string, unknown>)[];
2506
+ components?: (MessageComponent | {
2507
+ build?(): MessageComponent;
2508
+ } | {
2509
+ toJSON(): Record<string, unknown>;
2510
+ } | Record<string, unknown>)[];
2511
+ files?: AttachmentBuilder[];
2512
+ };
2513
+ }, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2325
2514
  }
2326
- declare enum TEXT_INPUT_STYLES {
2327
- SHORT = 1,
2328
- PARAGRAPH = 2
2515
+
2516
+ declare class MessageManager {
2517
+ protected rest: ChameleonREST;
2518
+ protected store: TongueStore;
2519
+ constructor(rest: ChameleonREST, store: TongueStore);
2520
+ fetch(channelId: string, messageId: string, force?: boolean): Promise<ChameleonAPIResult<Message>>;
2521
+ send(channelId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
2522
+ edit(channelId: string, messageId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
2523
+ delete(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
2524
+ list(channelId: string, options?: {
2525
+ limit?: number;
2526
+ before?: string;
2527
+ after?: string;
2528
+ around?: string;
2529
+ }): Promise<ChameleonAPIResult<Message[]>>;
2530
+ react(channelId: string, messageId: string, emoji: string): Promise<ChameleonAPIResult<void>>;
2531
+ removeReaction(channelId: string, messageId: string, emoji: string, userId?: string): Promise<ChameleonAPIResult<void>>;
2532
+ removeAllReactions(channelId: string, messageId: string, emoji?: string): Promise<ChameleonAPIResult<void>>;
2533
+ getReactions(channelId: string, messageId: string, emoji: string, options?: {
2534
+ after?: string;
2535
+ limit?: number;
2536
+ type?: number;
2537
+ }): Promise<ChameleonAPIResult<User[]>>;
2538
+ pin(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
2539
+ unpin(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
2540
+ getPins(channelId: string): Promise<ChameleonAPIResult<Message[]>>;
2541
+ bulkDelete(channelId: string, messageIds: string[]): Promise<ChameleonAPIResult<void>>;
2542
+ forward(channelId: string, messageId: string): Promise<ChameleonAPIResult<Message>>;
2543
+ endPoll(channelId: string, messageId: string): Promise<ChameleonAPIResult<Message>>;
2544
+ getPollAnswerVoters(channelId: string, messageId: string, answerId: number, options?: {
2545
+ after?: string;
2546
+ limit?: number;
2547
+ }): Promise<ChameleonAPIResult<User[]>>;
2329
2548
  }
2330
2549
 
2331
- type ButtonStyleString = 'primary' | 'secondary' | 'success' | 'danger' | 'link' | 'premium';
2332
- interface ButtonDef {
2333
- customId?: string;
2334
- url?: string;
2335
- label?: string;
2336
- style: ButtonStyleString | number;
2337
- disabled?: boolean;
2550
+ type PartialChannel = Partial<Channel> & {
2551
+ id: string;
2552
+ };
2553
+ type PartialGuild = Partial<Guild> & {
2554
+ id: string;
2555
+ };
2556
+ type ChameleonEvent = {
2557
+ type: 'READY';
2558
+ } | {
2559
+ type: 'RESUMED';
2560
+ } | {
2561
+ type: 'GUILD_CREATE';
2562
+ guild: Guild;
2563
+ partial?: boolean;
2564
+ } | {
2565
+ type: 'GUILD_AVAILABLE';
2566
+ guild: Guild;
2567
+ reason: 'hydration' | 'outage';
2568
+ partial?: boolean;
2569
+ } | {
2570
+ type: 'GUILD_UNAVAILABLE';
2571
+ guildId: string;
2572
+ } | {
2573
+ type: 'GUILD_UPDATE';
2574
+ oldGuild?: Guild;
2575
+ guild: Guild;
2576
+ } | {
2577
+ type: 'GUILD_DELETE';
2578
+ guildId: string;
2579
+ } | {
2580
+ type: 'CHANNEL_CREATE';
2581
+ channel: Channel;
2582
+ guild?: PartialGuild;
2583
+ } | {
2584
+ type: 'CHANNEL_UPDATE';
2585
+ oldChannel?: Channel;
2586
+ channel: Channel;
2587
+ guild?: PartialGuild;
2588
+ } | {
2589
+ type: 'CHANNEL_DELETE';
2590
+ channelId: string;
2591
+ guild?: PartialGuild;
2592
+ } | {
2593
+ type: 'CHANNEL_PINS_UPDATE';
2594
+ channelId: string;
2595
+ guildId?: string;
2596
+ lastPinTimestamp?: number | null;
2597
+ } | {
2598
+ type: 'THREAD_CREATE';
2599
+ channel: Channel;
2600
+ } | {
2601
+ type: 'THREAD_UPDATE';
2602
+ oldChannel?: Channel;
2603
+ channel: Channel;
2604
+ } | {
2605
+ type: 'THREAD_DELETE';
2606
+ id: string;
2607
+ guildId: string;
2608
+ parentId: string;
2609
+ channelType: number;
2610
+ } | {
2611
+ type: 'THREAD_LIST_SYNC';
2612
+ guildId: string;
2613
+ channelIds?: string[];
2614
+ threads: Channel[];
2615
+ members: unknown[];
2616
+ } | {
2617
+ type: 'GUILD_MEMBER_ADD';
2618
+ member: Member;
2619
+ guildId: string;
2620
+ } | {
2621
+ type: 'GUILD_MEMBER_UPDATE';
2622
+ oldMember?: Member;
2623
+ guildId: string;
2624
+ user: User;
2625
+ roles: string[];
2626
+ nick?: string | null;
2627
+ joinedAt?: number | null;
2628
+ } | {
2629
+ type: 'GUILD_MEMBER_REMOVE';
2630
+ user: User;
2631
+ guildId: string;
2632
+ } | {
2633
+ type: 'GUILD_MEMBERS_CHUNK';
2634
+ guildId: string;
2635
+ members: Member[];
2636
+ chunkIndex: number;
2637
+ chunkCount: number;
2638
+ notFound?: string[];
2639
+ nonce?: string;
2640
+ } | {
2641
+ type: 'GUILD_ROLE_CREATE';
2642
+ guildId: string;
2643
+ role: Role;
2644
+ } | {
2645
+ type: 'GUILD_ROLE_UPDATE';
2646
+ oldRole?: Role;
2647
+ guildId: string;
2648
+ role: Role;
2649
+ } | {
2650
+ type: 'GUILD_ROLE_DELETE';
2651
+ guildId: string;
2652
+ roleId: string;
2653
+ } | {
2654
+ type: 'GUILD_BAN_ADD';
2655
+ guildId: string;
2656
+ user: User;
2657
+ } | {
2658
+ type: 'GUILD_BAN_REMOVE';
2659
+ guildId: string;
2660
+ user: User;
2661
+ } | {
2662
+ type: 'GUILD_EMOJIS_UPDATE';
2663
+ guildId: string;
2664
+ emojis: Emoji[];
2665
+ } | {
2666
+ type: 'GUILD_STICKERS_UPDATE';
2667
+ guildId: string;
2668
+ stickers: Sticker[];
2669
+ } | {
2670
+ type: 'MESSAGE_CREATE';
2671
+ message: Message;
2672
+ channel: PartialChannel;
2673
+ } | {
2674
+ type: 'MESSAGE_UPDATE';
2675
+ oldMessage?: Message;
2676
+ message: Message;
2677
+ channel: PartialChannel;
2678
+ } | {
2679
+ type: 'MESSAGE_DELETE';
2680
+ messageId: string;
2681
+ channelId: string;
2682
+ guildId?: string;
2683
+ message?: Message;
2684
+ } | {
2685
+ type: 'MESSAGE_DELETE_BULK';
2686
+ messageIds: string[];
2687
+ channelId: string;
2688
+ guildId?: string;
2689
+ messages?: Message[];
2690
+ } | {
2691
+ type: 'MESSAGE_REACTION_ADD';
2692
+ userId: string;
2693
+ channelId: string;
2694
+ messageId: string;
2695
+ guildId?: string;
2696
+ emoji: Partial<Emoji>;
2697
+ member?: Member;
2698
+ } | {
2699
+ type: 'MESSAGE_REACTION_REMOVE';
2700
+ userId: string;
2701
+ channelId: string;
2702
+ messageId: string;
2703
+ guildId?: string;
2704
+ emoji: Partial<Emoji>;
2705
+ } | {
2706
+ type: 'MESSAGE_REACTION_REMOVE_ALL';
2707
+ channelId: string;
2708
+ messageId: string;
2709
+ guildId?: string;
2710
+ } | {
2711
+ type: 'MESSAGE_REACTION_REMOVE_EMOJI';
2712
+ channelId: string;
2713
+ messageId: string;
2714
+ guildId?: string;
2715
+ emoji: Partial<Emoji>;
2716
+ } | {
2717
+ type: 'INTERACTION_CREATE';
2718
+ interaction: Interaction;
2719
+ } | {
2720
+ type: 'VOICE_STATE_UPDATE';
2721
+ oldVoiceState?: Voice;
2722
+ voiceState: Voice;
2723
+ } | {
2724
+ type: 'VOICE_SERVER_UPDATE';
2725
+ token: string;
2726
+ guildId: string;
2727
+ endpoint: string | null;
2728
+ } | {
2729
+ type: 'STAGE_INSTANCE_CREATE';
2730
+ stageInstance: StageInstance;
2731
+ } | {
2732
+ type: 'STAGE_INSTANCE_UPDATE';
2733
+ stageInstance: StageInstance;
2734
+ } | {
2735
+ type: 'STAGE_INSTANCE_DELETE';
2736
+ stageInstance: StageInstance;
2737
+ } | {
2738
+ type: 'GUILD_SOUNDBOARD_SOUND_CREATE';
2739
+ guildId: string;
2740
+ sound: SoundboardSound;
2741
+ } | {
2742
+ type: 'GUILD_SOUNDBOARD_SOUND_UPDATE';
2743
+ guildId: string;
2744
+ sound: SoundboardSound;
2745
+ } | {
2746
+ type: 'GUILD_SOUNDBOARD_SOUND_DELETE';
2747
+ guildId: string;
2748
+ soundId: string;
2749
+ } | {
2750
+ type: 'GUILD_SOUNDBOARD_SOUNDS_UPDATE';
2751
+ guildId: string;
2752
+ sounds: SoundboardSound[];
2753
+ } | {
2754
+ type: 'SUBSCRIPTION_CREATE';
2755
+ subscription: Subscription;
2756
+ } | {
2757
+ type: 'SUBSCRIPTION_UPDATE';
2758
+ subscription: Subscription;
2759
+ } | {
2760
+ type: 'SUBSCRIPTION_DELETE';
2761
+ subscription: Subscription;
2762
+ } | {
2763
+ type: 'VOICE_CHANNEL_EFFECT_SEND';
2764
+ channelId: string;
2765
+ guildId: string;
2766
+ userId: string;
2338
2767
  emoji?: Partial<Emoji>;
2339
- skuId?: string;
2340
- execute?: (ctx: ComponentContext) => void | Promise<void>;
2341
- }
2342
- declare function resolveButtonStyle(style: string | number): number;
2343
- declare function defineButton(def: ButtonDef): ButtonDef & {
2344
- type: 'button';
2345
- };
2346
- interface StringSelectDef {
2347
- customId: string;
2348
- options: SelectOption[];
2349
- placeholder?: string;
2350
- minValues?: number;
2351
- maxValues?: number;
2352
- disabled?: boolean;
2353
- execute: (ctx: ComponentContext<string[]>) => void | Promise<void>;
2354
- }
2355
- declare function defineStringSelect(def: StringSelectDef): StringSelectDef & {
2356
- type: 'string_select';
2357
- };
2358
- interface UserSelectDef {
2359
- customId: string;
2360
- placeholder?: string;
2361
- minValues?: number;
2362
- maxValues?: number;
2363
- disabled?: boolean;
2364
- execute: (ctx: ComponentContext<User[]>) => void | Promise<void>;
2365
- }
2366
- declare function defineUserSelect(def: UserSelectDef): UserSelectDef & {
2367
- type: 'user_select';
2368
- };
2369
- interface RoleSelectDef {
2370
- customId: string;
2371
- placeholder?: string;
2372
- minValues?: number;
2373
- maxValues?: number;
2374
- disabled?: boolean;
2375
- execute: (ctx: ComponentContext<Role[]>) => void | Promise<void>;
2376
- }
2377
- declare function defineRoleSelect(def: RoleSelectDef): RoleSelectDef & {
2378
- type: 'role_select';
2379
- };
2380
- interface ChannelSelectDef {
2381
- customId: string;
2382
- channelTypes?: number[];
2383
- placeholder?: string;
2384
- minValues?: number;
2385
- maxValues?: number;
2386
- disabled?: boolean;
2387
- execute: (ctx: ComponentContext<Partial<Channel>[]>) => void | Promise<void>;
2388
- }
2389
- declare function defineChannelSelect(def: ChannelSelectDef): ChannelSelectDef & {
2390
- type: 'channel_select';
2391
- };
2392
- interface MentionableSelectDef {
2393
- customId: string;
2394
- placeholder?: string;
2395
- minValues?: number;
2396
- maxValues?: number;
2397
- disabled?: boolean;
2398
- execute: (ctx: ComponentContext<(User | Role)[]>) => void | Promise<void>;
2399
- }
2400
- declare function defineMentionableSelect(def: MentionableSelectDef): MentionableSelectDef & {
2401
- type: 'mentionable_select';
2402
- };
2403
- interface ModalFieldDef<Required extends boolean = true> {
2768
+ } | {
2769
+ type: 'GUILD_AUDIT_LOG_ENTRY_CREATE';
2770
+ guildId: string;
2771
+ entry: AuditLogEntry;
2772
+ } | {
2773
+ type: 'THREAD_MEMBERS_UPDATE';
2404
2774
  id: string;
2405
- type: TEXT_INPUT_STYLES;
2406
- label: string;
2407
- required?: Required;
2408
- minLength?: number;
2409
- maxLength?: number;
2410
- placeholder?: string;
2411
- value?: string;
2412
- }
2413
- declare const field: {
2414
- short: <ID extends string, Req extends boolean = true>(id: ID, label: string, options?: {
2415
- required?: Req;
2416
- minLength?: number;
2417
- maxLength?: number;
2418
- placeholder?: string;
2419
- value?: string;
2420
- }) => ModalFieldDef<Req> & {
2421
- id: ID;
2422
- };
2423
- paragraph: <ID extends string, Req extends boolean = true>(id: ID, label: string, options?: {
2424
- required?: Req;
2425
- minLength?: number;
2426
- maxLength?: number;
2427
- placeholder?: string;
2428
- value?: string;
2429
- }) => ModalFieldDef<Req> & {
2430
- id: ID;
2775
+ guildId: string;
2776
+ memberCount: number;
2777
+ addedMembers?: Partial<Member>[];
2778
+ removedMemberIds?: string[];
2779
+ } | {
2780
+ type: 'THREAD_MEMBER_UPDATE';
2781
+ member: Partial<Member>;
2782
+ guildId: string;
2783
+ } | {
2784
+ type: 'APPLICATION_COMMAND_PERMISSIONS_UPDATE';
2785
+ permissions: {
2786
+ applicationId: string;
2787
+ guildId: string;
2788
+ id: string;
2789
+ permissions: string[];
2790
+ }[];
2791
+ } | {
2792
+ type: 'GUILD_SCHEDULED_EVENT_CREATE';
2793
+ scheduledEvent: GuildScheduledEvent;
2794
+ } | {
2795
+ type: 'GUILD_SCHEDULED_EVENT_UPDATE';
2796
+ scheduledEvent: GuildScheduledEvent;
2797
+ } | {
2798
+ type: 'GUILD_SCHEDULED_EVENT_DELETE';
2799
+ scheduledEvent: GuildScheduledEvent;
2800
+ } | {
2801
+ type: 'GUILD_SCHEDULED_EVENT_USER_ADD';
2802
+ guildScheduledEventId: string;
2803
+ userId: string;
2804
+ guildId: string;
2805
+ } | {
2806
+ type: 'GUILD_SCHEDULED_EVENT_USER_REMOVE';
2807
+ guildScheduledEventId: string;
2808
+ userId: string;
2809
+ guildId: string;
2810
+ } | {
2811
+ type: 'AUTO_MODERATION_RULE_CREATE';
2812
+ rule: AutoModerationRule;
2813
+ } | {
2814
+ type: 'AUTO_MODERATION_RULE_UPDATE';
2815
+ rule: AutoModerationRule;
2816
+ } | {
2817
+ type: 'AUTO_MODERATION_RULE_DELETE';
2818
+ rule: AutoModerationRule;
2819
+ } | {
2820
+ type: 'AUTO_MODERATION_ACTION_EXECUTION';
2821
+ guildId: string;
2822
+ action: AutoModerationAction;
2823
+ ruleId: string;
2824
+ ruleTriggerType: number;
2825
+ userId: string;
2826
+ channelId?: string;
2827
+ messageId?: string;
2828
+ content?: string;
2829
+ matchedKeyword?: string | null;
2830
+ matchedContent?: string | null;
2831
+ } | {
2832
+ type: 'INVITE_CREATE';
2833
+ channelId: string;
2834
+ code: string;
2835
+ guildId?: string;
2836
+ inviter?: User;
2837
+ maxAge: number;
2838
+ maxUses: number;
2839
+ temporary: boolean;
2840
+ } | {
2841
+ type: 'INVITE_DELETE';
2842
+ channelId: string;
2843
+ code: string;
2844
+ guildId?: string;
2845
+ } | {
2846
+ type: 'GUILD_INTEGRATIONS_UPDATE';
2847
+ guildId: string;
2848
+ } | {
2849
+ type: 'INTEGRATION_CREATE';
2850
+ guildId: string;
2851
+ integration: Integration;
2852
+ } | {
2853
+ type: 'INTEGRATION_UPDATE';
2854
+ guildId: string;
2855
+ integration: Integration;
2856
+ } | {
2857
+ type: 'INTEGRATION_DELETE';
2858
+ id: string;
2859
+ guildId: string;
2860
+ applicationId?: string;
2861
+ } | {
2862
+ type: 'ENTITLEMENT_CREATE';
2863
+ entitlement: Entitlement;
2864
+ } | {
2865
+ type: 'ENTITLEMENT_UPDATE';
2866
+ entitlement: Entitlement;
2867
+ } | {
2868
+ type: 'ENTITLEMENT_DELETE';
2869
+ entitlement: Entitlement;
2870
+ } | {
2871
+ type: 'PRESENCE_UPDATE';
2872
+ user: Partial<User> & {
2873
+ id: string;
2431
2874
  };
2875
+ guildId: string;
2876
+ status: string;
2877
+ activities: unknown[];
2878
+ clientStatus: unknown;
2879
+ } | {
2880
+ type: 'TYPING_START';
2881
+ channelId: string;
2882
+ guildId?: string;
2883
+ userId: string;
2884
+ timestamp: number;
2885
+ member?: Member;
2886
+ } | {
2887
+ type: 'USER_UPDATE';
2888
+ oldUser?: User;
2889
+ user: User;
2890
+ } | {
2891
+ type: 'WEBHOOKS_UPDATE';
2892
+ guildId: string;
2893
+ channelId: string;
2894
+ } | {
2895
+ type: 'MESSAGE_POLL_VOTE_ADD';
2896
+ userId: string;
2897
+ channelId: string;
2898
+ messageId: string;
2899
+ guildId?: string;
2900
+ answerId: number;
2901
+ } | {
2902
+ type: 'MESSAGE_POLL_VOTE_REMOVE';
2903
+ userId: string;
2904
+ channelId: string;
2905
+ messageId: string;
2906
+ guildId?: string;
2907
+ answerId: number;
2432
2908
  };
2433
- type ResolveModalFields<F extends ReadonlyArray<ModalFieldDef<any>>> = {
2434
- [K in F[number] as K['id']]: K['required'] extends false ? string | undefined : string;
2435
- };
2436
- interface ModalDef<F extends ReadonlyArray<ModalFieldDef<any>>> {
2437
- customId: string;
2438
- title: string;
2439
- fields: F;
2440
- execute: (ctx: ComponentContext<never, ResolveModalFields<F>>) => void | Promise<void>;
2441
- }
2442
- declare function defineModal<F extends ReadonlyArray<ModalFieldDef<any>>>(def: ModalDef<F>): ModalDef<F> & {
2443
- type: 'modal';
2444
- };
2909
+ type ChameleonEventHandler = (event: ChameleonEvent) => void | Promise<void>;
2445
2910
 
2446
- declare const ActionRow: {
2447
- of: (...components: any[]) => {
2448
- type: COMPONENT_TYPES;
2449
- components: any[];
2911
+ interface ClientOptions<TIntents extends readonly IntentResolvable[]> {
2912
+ token: string;
2913
+ intents: TIntents;
2914
+ largeThreshold?: number;
2915
+ sharding?: 'auto' | {
2916
+ shards: number[];
2917
+ total: number;
2450
2918
  };
2919
+ cluster?: boolean;
2920
+ cache?: StoreOptions;
2921
+ debug?: boolean;
2922
+ }
2923
+ type EventMap = {
2924
+ [K in ChameleonEvent['type']]: Extract<ChameleonEvent, {
2925
+ type: K;
2926
+ }>;
2451
2927
  };
2928
+ type MiddlewareFn = (event: ChameleonEvent, next: () => void) => void | Promise<void>;
2929
+ interface AwaitMessagesOptions {
2930
+ filter?: (message: Message) => boolean;
2931
+ max?: number;
2932
+ time?: number;
2933
+ }
2934
+ interface AwaitComponentOptions {
2935
+ filter?: (ctx: ComponentContext) => boolean;
2936
+ time?: number;
2937
+ }
2452
2938
 
2453
- declare class ComponentManager {
2939
+ declare class CollectorManager {
2454
2940
  private client;
2455
- private handlers;
2456
2941
  constructor(client: Client);
2457
- register(...components: any[]): void;
2458
- handleInteraction(raw: Record<string, any>): Promise<void>;
2942
+ /**
2943
+ * Waits for a specified number of messages in a given channel that pass the filter, if the time limit
2944
+ * is reached, resolves with the messages collected so far
2945
+ */
2946
+ awaitMessages(channelId: string, options?: AwaitMessagesOptions): Promise<Message[]>;
2947
+ /**
2948
+ * waits for a single component interaction on a specific message,
2949
+ * resolves with the ComponentContext if successful, or null if it timed out
2950
+ */
2951
+ awaitComponent(messageId: string, options?: AwaitComponentOptions): Promise<ComponentContext | null>;
2459
2952
  }
2460
2953
 
2461
- declare abstract class BaseManager<T extends {
2462
- id: string;
2463
- }> {
2954
+ declare class WebhookManager {
2464
2955
  protected rest: ChameleonREST;
2465
2956
  protected store: TongueStore;
2466
2957
  constructor(rest: ChameleonREST, store: TongueStore);
2467
- protected abstract endpoint(id: string): string;
2468
- protected abstract build(raw: unknown): T;
2469
- protected abstract storeKey: keyof TongueStore;
2470
- fetch(id: string, force?: boolean): Promise<ChameleonAPIResult<T>>;
2471
- }
2472
-
2473
- declare const Colors: {
2474
- readonly Blue: 2003199;
2475
- readonly Purple: 10181046;
2476
- readonly Orange: 16744272;
2477
- readonly Pink: 16739201;
2478
- readonly White: 16777215;
2479
- readonly Blurple: 5793266;
2480
- readonly Green: 5763719;
2481
- readonly Yellow: 16705372;
2482
- readonly Fuchsia: 15418782;
2483
- readonly Red: 15548997;
2484
- readonly Black: 2303786;
2485
- readonly Transparent: 3092790;
2486
- };
2487
- declare class EmbedBuilder {
2488
- private data;
2489
- constructor(data?: Partial<Embed>);
2490
- setTitle(title: string): this;
2491
- setDescription(description: string): this;
2492
- setColor(color: number): this;
2493
- setURL(url: string): this;
2494
- setTimestamp(ts?: Date | number): this;
2495
- setFooter(text: string, iconUrl?: string): this;
2496
- setAuthor(name: string, iconUrl?: string, url?: string): this;
2497
- setImage(url: string): this;
2498
- setThumbnail(url: string): this;
2499
- addField(name: string, value: string, inline?: boolean): this;
2500
- addFields(...fields: EmbedField[]): this;
2501
- build(): Embed;
2502
- toJSON(): Record<string, unknown>;
2503
- }
2504
-
2505
- declare class ButtonBuilder {
2506
- private data;
2507
- setCustomId(id: string): this;
2508
- setLabel(label: string): this;
2509
- setStyle(style: number): this;
2510
- setEmoji(emoji: Partial<Emoji>): this;
2511
- setDisabled(disabled?: boolean): this;
2512
- setURL(url: string): this;
2513
- build(): MessageComponent;
2514
- toJSON(): any;
2515
- }
2516
- declare class SelectMenuBuilder {
2517
- private data;
2518
- setCustomId(id: string): this;
2519
- setPlaceholder(placeholder: string): this;
2520
- setMinValues(min: number): this;
2521
- setMaxValues(max: number): this;
2522
- setDisabled(disabled?: boolean): this;
2523
- setType(type: number): this;
2524
- addOption(option: SelectOption): this;
2525
- addOptions(...options: SelectOption[]): this;
2526
- build(): MessageComponent;
2527
- toJSON(): any;
2528
- }
2529
- declare class TextInputBuilder {
2530
- private data;
2531
- private _minLength?;
2532
- private _maxLength?;
2533
- private _required?;
2534
- private _value?;
2535
- setCustomId(id: string): this;
2536
- setLabel(label: string): this;
2537
- setStyle(style: number): this;
2538
- setPlaceholder(placeholder: string): this;
2539
- setMinLength(length: number): this;
2540
- setMaxLength(length: number): this;
2541
- setRequired(required?: boolean): this;
2542
- setValue(value: string): this;
2543
- build(): MessageComponent;
2544
- toJSON(): any;
2545
- }
2546
- declare class ActionRowBuilder {
2547
- private data;
2548
- addComponent(component: MessageComponent | {
2549
- build(): MessageComponent;
2550
- } | {
2551
- toJSON(): any;
2552
- }): this;
2553
- addComponents(...components: (MessageComponent | {
2554
- build(): MessageComponent;
2555
- } | {
2556
- toJSON(): any;
2557
- })[]): this;
2558
- build(): MessageComponent;
2559
- toJSON(): any;
2560
- }
2561
- declare class ModalBuilder {
2562
- private _title;
2563
- private _customId;
2564
- private _components;
2565
- setTitle(title: string): this;
2566
- setCustomId(id: string): this;
2567
- addComponent(component: MessageComponent | {
2568
- build(): MessageComponent;
2569
- } | {
2570
- toJSON(): any;
2571
- }): this;
2572
- addComponents(...components: (MessageComponent | {
2573
- build(): MessageComponent;
2574
- } | {
2575
- toJSON(): any;
2576
- })[]): this;
2577
- build(): {
2578
- title: string;
2579
- custom_id: string;
2580
- components: any[];
2581
- };
2582
- toJSON(): {
2583
- title: string;
2584
- custom_id: string;
2585
- components: any[];
2586
- };
2958
+ fetch(webhookId: string, token?: string): Promise<ChameleonAPIResult<Webhook>>;
2959
+ fetchByChannel(channelId: string): Promise<ChameleonAPIResult<Webhook[]>>;
2960
+ fetchByGuild(guildId: string): Promise<ChameleonAPIResult<Webhook[]>>;
2961
+ create(channelId: string, payload: {
2962
+ name: string;
2963
+ avatar?: string | null;
2964
+ }, reason?: string): Promise<ChameleonAPIResult<Webhook>>;
2965
+ edit(webhookId: string, payload: {
2966
+ name?: string;
2967
+ avatar?: string | null;
2968
+ channelId?: string;
2969
+ }, token?: string, reason?: string): Promise<ChameleonAPIResult<Webhook>>;
2970
+ delete(webhookId: string, token?: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2971
+ execute(webhookId: string, token: string, payload: WebhookMessageCreateOptions, options?: {
2972
+ wait?: boolean;
2973
+ threadId?: string;
2974
+ }): Promise<ChameleonAPIResult<Message | void>>;
2587
2975
  }
2588
2976
 
2589
- declare function buildUser(raw: Record<string, unknown>): User;
2590
- declare function buildChannel(raw: Record<string, unknown>, guildId?: string): Channel;
2591
- declare function buildGuild(raw: Record<string, unknown>): Guild;
2592
- declare function buildRole(raw: Record<string, unknown>): Role;
2593
- declare function buildMember(raw: Record<string, unknown>, guildId: string, cache: TongueStore): Member;
2594
- declare function buildMessage(raw: Record<string, unknown>, cache: TongueStore, oldMessage?: Message): Message;
2595
- declare function resolveChannel(channelId: string, cache: TongueStore): Channel | {
2596
- id: string;
2597
- };
2598
- declare function resolveGuild(guildId: string, cache: TongueStore): Guild | {
2599
- id: string;
2600
- };
2601
- declare function resolveUser(userId: string, cache: TongueStore): User | {
2602
- id: string;
2603
- };
2604
- declare function resolveRole(roleId: string, cache: TongueStore): Role | {
2605
- id: string;
2606
- };
2607
-
2608
- declare class UserManager extends BaseManager<User> {
2609
- protected storeKey: "users";
2610
- protected endpoint(id: string): string;
2611
- protected build: typeof buildUser;
2977
+ declare class InviteManager {
2978
+ protected rest: ChameleonREST;
2979
+ constructor(rest: ChameleonREST);
2980
+ fetch(code: string, options?: {
2981
+ withCounts?: boolean;
2982
+ withExpiration?: boolean;
2983
+ guildScheduledEventId?: string;
2984
+ }): Promise<ChameleonAPIResult<Invite>>;
2985
+ delete(code: string, reason?: string): Promise<ChameleonAPIResult<Invite>>;
2612
2986
  }
2613
2987
 
2614
- declare class GuildManager extends BaseManager<Guild> {
2615
- protected storeKey: "guilds";
2616
- protected endpoint(id: string): string;
2617
- protected build: typeof buildGuild;
2618
- fetchChannels(guildId: string): Promise<ChameleonAPIResult<Channel[]>>;
2619
- ban(guildId: string, userId: string, options?: {
2620
- deleteMessageSeconds?: number;
2621
- reason?: string;
2622
- }): Promise<ChameleonAPIResult<void>>;
2623
- unban(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2624
- kick(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2988
+ declare class AutoModerationManager {
2989
+ protected rest: ChameleonREST;
2990
+ protected store: TongueStore;
2991
+ constructor(rest: ChameleonREST, store: TongueStore);
2992
+ list(guildId: string): Promise<ChameleonAPIResult<AutoModerationRule[]>>;
2993
+ fetch(guildId: string, ruleId: string): Promise<ChameleonAPIResult<AutoModerationRule>>;
2994
+ create(guildId: string, payload: Partial<AutoModerationRule>, reason?: string): Promise<ChameleonAPIResult<AutoModerationRule>>;
2995
+ edit(guildId: string, ruleId: string, payload: Partial<AutoModerationRule>, reason?: string): Promise<ChameleonAPIResult<AutoModerationRule>>;
2996
+ delete(guildId: string, ruleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2625
2997
  }
2626
2998
 
2627
- declare class ChannelManager extends BaseManager<Channel> {
2628
- protected storeKey: "channels";
2629
- protected endpoint(id: string): string;
2630
- protected build: typeof buildChannel;
2999
+ declare class ScheduledEventManager {
3000
+ protected rest: ChameleonREST;
3001
+ protected store: TongueStore;
3002
+ constructor(rest: ChameleonREST, store: TongueStore);
3003
+ list(guildId: string, withUserCount?: boolean): Promise<ChameleonAPIResult<GuildScheduledEvent[]>>;
3004
+ fetch(guildId: string, eventId: string, withUserCount?: boolean): Promise<ChameleonAPIResult<GuildScheduledEvent>>;
3005
+ create(guildId: string, payload: Partial<GuildScheduledEvent>, reason?: string): Promise<ChameleonAPIResult<GuildScheduledEvent>>;
3006
+ edit(guildId: string, eventId: string, payload: Partial<GuildScheduledEvent>, reason?: string): Promise<ChameleonAPIResult<GuildScheduledEvent>>;
3007
+ delete(guildId: string, eventId: string): Promise<ChameleonAPIResult<void>>;
3008
+ getUsers(guildId: string, eventId: string, options?: {
3009
+ limit?: number;
3010
+ withMember?: boolean;
3011
+ before?: string;
3012
+ after?: string;
3013
+ }): Promise<ChameleonAPIResult<GuildScheduledEventUser[]>>;
2631
3014
  }
2632
3015
 
2633
- declare class MemberManager {
3016
+ declare class EntitlementManager {
2634
3017
  protected rest: ChameleonREST;
2635
3018
  protected store: TongueStore;
2636
- private guildId;
2637
- constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
2638
- fetch(userId: string, force?: boolean): Promise<ChameleonAPIResult<Member>>;
3019
+ constructor(rest: ChameleonREST, store: TongueStore);
3020
+ list(applicationId: string, options?: {
3021
+ userId?: string;
3022
+ skuIds?: string[];
3023
+ before?: string;
3024
+ after?: string;
3025
+ limit?: number;
3026
+ guildId?: string;
3027
+ excludeEnded?: boolean;
3028
+ }): Promise<ChameleonAPIResult<Entitlement[]>>;
3029
+ fetch(applicationId: string, entitlementId: string): Promise<ChameleonAPIResult<Entitlement>>;
3030
+ createTest(applicationId: string, payload: {
3031
+ skuId: string;
3032
+ ownerId: string;
3033
+ ownerType: number;
3034
+ }): Promise<ChameleonAPIResult<Entitlement>>;
3035
+ deleteTest(applicationId: string, entitlementId: string): Promise<ChameleonAPIResult<void>>;
2639
3036
  }
2640
3037
 
2641
- declare class MessageManager {
3038
+ declare class StageInstanceManager {
2642
3039
  protected rest: ChameleonREST;
2643
3040
  protected store: TongueStore;
2644
3041
  constructor(rest: ChameleonREST, store: TongueStore);
2645
- fetch(channelId: string, messageId: string, force?: boolean): Promise<ChameleonAPIResult<Message>>;
2646
- send(channelId: string, payload: string | Record<string, any>): Promise<ChameleonAPIResult<Message>>;
2647
- edit(channelId: string, messageId: string, payload: string | Record<string, any>): Promise<ChameleonAPIResult<Message>>;
2648
- delete(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
3042
+ fetch(channelId: string): Promise<ChameleonAPIResult<StageInstance>>;
3043
+ create(payload: Partial<StageInstance>, reason?: string): Promise<ChameleonAPIResult<StageInstance>>;
3044
+ edit(channelId: string, payload: Partial<StageInstance>, reason?: string): Promise<ChameleonAPIResult<StageInstance>>;
3045
+ delete(channelId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2649
3046
  }
2650
3047
 
2651
- interface AwaitMessagesOptions {
2652
- filter?: (message: Message) => boolean;
2653
- max?: number;
2654
- time?: number;
2655
- }
2656
- interface AwaitComponentOptions {
2657
- filter?: (ctx: ComponentContext$1) => boolean;
2658
- time?: number;
3048
+ declare class TemplateManager {
3049
+ protected rest: ChameleonREST;
3050
+ constructor(rest: ChameleonREST);
3051
+ fetch(code: string): Promise<ChameleonAPIResult<GuildTemplate>>;
3052
+ createGuildFromTemplate(code: string, payload: {
3053
+ name: string;
3054
+ icon?: string;
3055
+ }): Promise<ChameleonAPIResult<unknown>>;
3056
+ list(guildId: string): Promise<ChameleonAPIResult<GuildTemplate[]>>;
3057
+ create(guildId: string, payload: {
3058
+ name: string;
3059
+ description?: string;
3060
+ }): Promise<ChameleonAPIResult<GuildTemplate>>;
3061
+ sync(guildId: string, code: string): Promise<ChameleonAPIResult<GuildTemplate>>;
3062
+ edit(guildId: string, code: string, payload: {
3063
+ name?: string;
3064
+ description?: string;
3065
+ }): Promise<ChameleonAPIResult<GuildTemplate>>;
3066
+ delete(guildId: string, code: string): Promise<ChameleonAPIResult<GuildTemplate>>;
2659
3067
  }
2660
- declare class CollectorManager {
2661
- private client;
2662
- constructor(client: Client);
2663
- /**
2664
- * Waits for a specified number of messages in a given channel that pass the filter, if the time limit
2665
- * is reached, resolves with the messages collected so far
2666
- */
2667
- awaitMessages(channelId: string, options?: AwaitMessagesOptions): Promise<Message[]>;
2668
- /**
2669
- * waits for a single component interaction on a specific message,
2670
- * resolves with the ComponentContext if successful, or null if it timed out
2671
- */
2672
- awaitComponent(messageId: string, options?: AwaitComponentOptions): Promise<ComponentContext$1 | null>;
3068
+
3069
+ declare class ApplicationManager {
3070
+ protected rest: ChameleonREST;
3071
+ protected _client: Client;
3072
+ constructor(rest: ChameleonREST, _client: Client);
3073
+ fetch(): Promise<ChameleonAPIResult<Application>>;
3074
+ fetchRoleConnectionMetadata(): Promise<ChameleonAPIResult<ApplicationRoleConnectionMetadata[]>>;
3075
+ editRoleConnectionMetadata(records: ApplicationRoleConnectionMetadata[]): Promise<ChameleonAPIResult<ApplicationRoleConnectionMetadata[]>>;
2673
3076
  }
2674
3077
 
2675
- interface ClientOptions<TIntents extends readonly IntentResolvable[]> {
2676
- token: string;
2677
- intents: TIntents;
2678
- largeThreshold?: number;
2679
- sharding?: 'auto' | {
2680
- shards: number[];
2681
- total: number;
2682
- };
2683
- cluster?: boolean;
2684
- cache?: StoreOptions;
2685
- debug?: boolean;
3078
+ declare class SoundboardManager {
3079
+ protected rest: ChameleonREST;
3080
+ constructor(rest: ChameleonREST);
3081
+ send(channelId: string, soundId: string, sourceGuildId?: string): Promise<ChameleonAPIResult<never>>;
3082
+ fetchDefault(): Promise<ChameleonAPIResult<SoundboardSound[]>>;
3083
+ fetch(guildId: string, soundId?: string): Promise<ChameleonAPIResult<SoundboardSound | SoundboardSound[]>>;
3084
+ create(guildId: string, options: SoundboardCreateOptions, reason?: string): Promise<ChameleonAPIResult<SoundboardSound>>;
3085
+ edit(guildId: string, soundId: string, options: SoundboardEditOptions, reason?: string): Promise<ChameleonAPIResult<SoundboardSound>>;
3086
+ delete(guildId: string, soundId: string, reason?: string): Promise<ChameleonAPIResult<never>>;
2686
3087
  }
2687
- type EventMap = {
2688
- [K in ChameleonEvent['type']]: Extract<ChameleonEvent, {
2689
- type: K;
2690
- }>;
2691
- };
2692
- type MiddlewareFn = (event: ChameleonEvent, next: () => void) => void | Promise<void>;
3088
+
2693
3089
  declare class Client<TIntents extends readonly IntentResolvable[] = readonly IntentResolvable[]> {
2694
3090
  token: string | undefined;
2695
3091
  intents: number;
@@ -2710,6 +3106,15 @@ declare class Client<TIntents extends readonly IntentResolvable[] = readonly Int
2710
3106
  channels: ChannelManager;
2711
3107
  messages: MessageManager;
2712
3108
  collectors: CollectorManager;
3109
+ webhooks: WebhookManager;
3110
+ invites: InviteManager;
3111
+ autoMod: AutoModerationManager;
3112
+ scheduledEvents: ScheduledEventManager;
3113
+ entitlements: EntitlementManager;
3114
+ stageInstances: StageInstanceManager;
3115
+ templates: TemplateManager;
3116
+ application: ApplicationManager;
3117
+ soundboard: SoundboardManager;
2713
3118
  private listeners;
2714
3119
  private middlewares;
2715
3120
  constructor(options: ClientOptions<TIntents>);
@@ -2802,4 +3207,80 @@ declare class Chameleon {
2802
3207
  };
2803
3208
  }
2804
3209
 
2805
- export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, BaseManager, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, Client, type ClientOptions, type Collectibles, CollectorManager, Colors, CommandContext, type CommandDef, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementType, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, type InteractionReplyOptions, type Invite, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessageReference, MessageReferenceType, type MessageSnapshot, MessageType, type MiddlewareFn, ModalBuilder, type ModalDef, type ModalFieldDef, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, SelectMenuBuilder, type SelectOption, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardSound, type StageInstance, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TextInputBuilder, type ThreadMember, type ThreadMetadata, Tongue, TongueStore, type User, UserFlag, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildChannel, buildGuild, buildMember, buildMessage, buildModalPayload, buildRole, buildUser, combinePermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser };
3210
+ type BitFieldResolvable = string | number | bigint | BitField | BitFieldResolvable[];
3211
+ declare class BitField {
3212
+ static FLAGS: Record<string, bigint>;
3213
+ bitfield: bigint;
3214
+ constructor(bits?: BitFieldResolvable);
3215
+ has(bit: BitFieldResolvable): boolean;
3216
+ any(bit: BitFieldResolvable): boolean;
3217
+ add(...bits: BitFieldResolvable[]): this;
3218
+ remove(...bits: BitFieldResolvable[]): this;
3219
+ toArray(): string[];
3220
+ serialize(): Record<string, boolean>;
3221
+ equals(other: BitFieldResolvable): boolean;
3222
+ freeze(): Readonly<this>;
3223
+ toString(): string;
3224
+ toJSON(): string;
3225
+ static resolve(bit: BitFieldResolvable): bigint;
3226
+ }
3227
+
3228
+ declare class PermissionsBitField extends BitField {
3229
+ static FLAGS: Record<string, bigint>;
3230
+ static ALL: bigint;
3231
+ get isAdmin(): boolean;
3232
+ static from(bits: BitFieldResolvable): PermissionsBitField;
3233
+ }
3234
+ /**
3235
+ * Handles Discord user flag bitfields.
3236
+ */
3237
+ declare class UserFlagsBitField extends BitField {
3238
+ static FLAGS: Record<string, bigint>;
3239
+ }
3240
+ /**
3241
+ * Handles Discord gateway intent bitfields.
3242
+ */
3243
+ declare class IntentsBitField extends BitField {
3244
+ static FLAGS: Record<string, bigint>;
3245
+ }
3246
+ /**
3247
+ * Calculate the base permissions for a member in a guild.
3248
+ */
3249
+ declare function computeBasePermissions(member: {
3250
+ roles: string[];
3251
+ }, guild: {
3252
+ id: string;
3253
+ ownerId: string;
3254
+ roles: Role[];
3255
+ }): bigint;
3256
+ declare function computeChannelPermissions(basePermissions: bigint, overwrites: Overwrite[], memberRoles: string[], memberId?: string): bigint;
3257
+
3258
+ interface ShardOptions {
3259
+ token: string;
3260
+ totalShards?: number | 'auto';
3261
+ respawn?: boolean;
3262
+ }
3263
+
3264
+ declare class Shard extends EventEmitter {
3265
+ id: number;
3266
+ manager: CShard;
3267
+ process: ChildProcess | null;
3268
+ ready: boolean;
3269
+ constructor(manager: CShard, id: number);
3270
+ spawn(): Promise<ChildProcess>;
3271
+ send(message: unknown): Promise<void>;
3272
+ kill(): void;
3273
+ }
3274
+ declare class CShard extends EventEmitter {
3275
+ file: string;
3276
+ totalShards: number;
3277
+ token: string;
3278
+ shards: Map<number, Shard>;
3279
+ respawn: boolean;
3280
+ constructor(file: string, options: ShardOptions);
3281
+ fetchRecommendedShards(): Promise<number>;
3282
+ spawn(): Promise<Map<number, Shard>>;
3283
+ broadcast(message: unknown): Promise<void[]>;
3284
+ }
3285
+
3286
+ export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type AnyCommandDef, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, ApplicationManager, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentBuilder, type AttachmentData, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, AutoModerationManager, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, type AwaitComponentOptions, type AwaitMessagesOptions, BaseInteractionContext, BaseManager, BitField, type BitFieldResolvable, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, CShard, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, Client, type ClientOptions, type Collectibles, Collection, CollectorManager, Colors, CommandContext, type CommandDef, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementManager, EntitlementType, type EventMap, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildScheduledEventUser, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, IntentsBitField, type InteractionReplyOptions, type Invite, InviteManager, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, type MessageCreateOptions, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessageReference, MessageReferenceType, type MessageSnapshot, MessageType, type MiddlewareFn, ModalBuilder, type ModalDef, type ModalFieldDef, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, PermissionsBitField, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, RoleManager, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, ScheduledEventManager, SelectMenuBuilder, type SelectOption, Shard, type ShardOptions, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardCreateOptions, type SoundboardEditOptions, SoundboardManager, type SoundboardSound, type StageInstance, StageInstanceManager, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TemplateManager, TextInputBuilder, type ThreadMember, type ThreadMetadata, Tongue, TongueStore, type User, UserFlag, UserFlagsBitField, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookManager, type WebhookMessageCreateOptions, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildAutoModRule, buildChannel, buildEmoji, buildEntitlement, buildGuild, buildIntegration, buildInteraction, buildInvite, buildMember, buildMessage, buildRole, buildScheduledEvent, buildStageInstance, buildSticker, buildStickerItem, buildUser, buildVoiceState, buildWebhook, combinePermissions, computeBasePermissions, computeChannelPermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser, serializeComponent };