@impulsedev/chameleon 2.0.0 → 3.1.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 {
@@ -1718,438 +1814,78 @@ 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;
1831
- 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;
1937
- emoji?: Partial<Emoji>;
1938
- } | {
1939
- type: 'GUILD_AUDIT_LOG_ENTRY_CREATE';
1940
- guildId: string;
1941
- entry: AuditLogEntry;
1942
- } | {
1943
- type: 'THREAD_MEMBERS_UPDATE';
1944
- 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';
2028
- 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;
2044
- };
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;
2071
- } | {
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>;
2080
-
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<OptionType, boolean>> = O['required'] extends true ? ResolveOptionType<O['type']> : ResolveOptionType<O['type']> | undefined;
2095
- type ResolveOptions<O extends Record<string, OptionDef<OptionType, boolean>>> = {
2096
- [K in keyof O]: ResolveOption<O[K]>;
2097
- };
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>;
2138
- };
2139
-
2140
- type InteractionReplyOptions = string | {
2141
- content?: string;
2142
- embeds?: (Embed | {
2143
- toJSON(): Record<string, unknown>;
2144
- } | Record<string, unknown>)[];
2145
- components?: (MessageComponent | {
2146
- build?(): MessageComponent;
2147
- } | {
2148
- toJSON(): Record<string, unknown>;
2149
- } | Record<string, unknown>)[];
2150
- ephemeral?: boolean;
2151
- };
2152
- declare class BaseInteractionContext {
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 {
2153
1889
  user: User;
2154
1890
  guild?: Guild | {
2155
1891
  id: string;
@@ -2245,6 +1981,7 @@ declare class CommandManager {
2245
1981
  private _client;
2246
1982
  constructor(client: Client);
2247
1983
  register(...commands: AnyCommandDef[]): void;
1984
+ registerGuild(guildId: string, ...commands: AnyCommandDef[]): void;
2248
1985
  registerComponent(handler: ComponentHandler): void;
2249
1986
  registerModal(handler: ModalHandler): void;
2250
1987
  load(directory: string): Promise<void>;
@@ -2566,6 +2303,8 @@ declare function buildStickerItem(raw: Record<string, unknown>): StickerItem;
2566
2303
  declare function buildVoiceState(raw: Record<string, unknown>, cache?: TongueStore): Voice;
2567
2304
  declare function buildEntitlement(raw: Record<string, unknown>): Entitlement;
2568
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;
2569
2308
 
2570
2309
  declare function buildUser(raw: Record<string, unknown>): User;
2571
2310
  declare function buildChannel(raw: Record<string, unknown>, guildId?: string): Channel;
@@ -2579,104 +2318,614 @@ declare function resolveChannel(channelId: string, client: Client): Channel | {
2579
2318
  };
2580
2319
  declare function resolveGuild(guildId: string, client: Client): Guild | {
2581
2320
  id: string;
2582
- fetch: () => Promise<ChameleonAPIResult<Guild>>;
2583
- };
2584
- declare function resolveUser(userId: string, client: Client): User | {
2321
+ fetch: () => Promise<ChameleonAPIResult<Guild>>;
2322
+ };
2323
+ declare function resolveUser(userId: string, client: Client): User | {
2324
+ id: string;
2325
+ fetch: () => Promise<ChameleonAPIResult<User>>;
2326
+ };
2327
+ declare function resolveRole(roleId: string, client: Client, guildId?: string): Role | {
2328
+ id: string;
2329
+ fetch?: () => Promise<ChameleonAPIResult<Role>>;
2330
+ };
2331
+
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>>;
2341
+ }
2342
+
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>>;
2353
+ }
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>>;
2370
+ }
2371
+
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>>;
2435
+ }
2436
+
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>>;
2514
+ }
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[]>>;
2548
+ }
2549
+
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;
2767
+ emoji?: Partial<Emoji>;
2768
+ } | {
2769
+ type: 'GUILD_AUDIT_LOG_ENTRY_CREATE';
2770
+ guildId: string;
2771
+ entry: AuditLogEntry;
2772
+ } | {
2773
+ type: 'THREAD_MEMBERS_UPDATE';
2585
2774
  id: string;
2586
- fetch: () => Promise<ChameleonAPIResult<User>>;
2587
- };
2588
- declare function resolveRole(roleId: string, client: Client, guildId?: string): Role | {
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';
2589
2858
  id: string;
2590
- fetch?: () => Promise<ChameleonAPIResult<Role>>;
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;
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;
2591
2908
  };
2909
+ type ChameleonEventHandler = (event: ChameleonEvent) => void | Promise<void>;
2592
2910
 
2593
- declare class UserManager extends BaseManager<User> {
2594
- protected storeKey: "users";
2595
- protected endpoint(id: string): string;
2596
- protected build: typeof buildUser;
2597
- createDM(userId: string): Promise<ChameleonAPIResult<Channel>>;
2598
- }
2599
-
2600
- declare class RoleManager {
2601
- protected rest: ChameleonREST;
2602
- protected store: TongueStore;
2603
- protected guildId: string;
2604
- constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
2605
- fetch(roleId: string, force?: boolean): Promise<ChameleonAPIResult<Role>>;
2606
- list(): Promise<ChameleonAPIResult<Role[]>>;
2607
- create(payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
2608
- edit(roleId: string, payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
2609
- delete(roleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2610
- }
2611
-
2612
- declare class MemberManager {
2613
- protected rest: ChameleonREST;
2614
- protected store: TongueStore;
2615
- private guildId;
2616
- constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
2617
- fetch(userId: string, force?: boolean): Promise<ChameleonAPIResult<Member>>;
2618
- edit(userId: string, payload: Partial<Member>, reason?: string): Promise<ChameleonAPIResult<Member>>;
2619
- }
2620
-
2621
- declare class GuildManager extends BaseManager<Guild> {
2622
- protected storeKey: "guilds";
2623
- protected endpoint(id: string): string;
2624
- protected build: typeof buildGuild;
2625
- roles(guildId: string): RoleManager;
2626
- members(guildId: string): MemberManager;
2627
- fetchChannels(guildId: string): Promise<ChameleonAPIResult<Channel[]>>;
2628
- ban(guildId: string, userId: string, options?: {
2629
- deleteMessageSeconds?: number;
2630
- reason?: string;
2631
- }): Promise<ChameleonAPIResult<void>>;
2632
- unban(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2633
- kick(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2634
- edit(guildId: string, payload: Partial<Guild>, reason?: string): Promise<ChameleonAPIResult<Guild>>;
2635
- delete(guildId: string): Promise<ChameleonAPIResult<void>>;
2636
- }
2637
-
2638
- declare class ChannelManager extends BaseManager<Channel> {
2639
- protected storeKey: "channels";
2640
- protected endpoint(id: string): string;
2641
- protected build: typeof buildChannel;
2642
- create(guildId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2643
- edit(channelId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
2644
- delete(channelId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2645
- updatePermissions(channelId: string, overwriteId: string, payload: Partial<Overwrite>, reason?: string): Promise<ChameleonAPIResult<void>>;
2646
- deletePermission(channelId: string, overwriteId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
2647
- }
2648
-
2649
- type MessageCreateOptions = string | {
2650
- content?: string;
2651
- embeds?: (Embed | {
2652
- toJSON(): Record<string, unknown>;
2653
- } | Record<string, unknown>)[];
2654
- components?: (MessageComponent | {
2655
- build?(): MessageComponent;
2656
- } | {
2657
- toJSON(): Record<string, unknown>;
2658
- } | Record<string, unknown>)[];
2659
- reply?: {
2660
- messageId: string;
2661
- failIfNotExists?: boolean;
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;
2662
2918
  };
2663
- };
2664
- declare class MessageManager {
2665
- protected rest: ChameleonREST;
2666
- protected store: TongueStore;
2667
- constructor(rest: ChameleonREST, store: TongueStore);
2668
- fetch(channelId: string, messageId: string, force?: boolean): Promise<ChameleonAPIResult<Message>>;
2669
- send(channelId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
2670
- edit(channelId: string, messageId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
2671
- delete(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
2672
- list(channelId: string, options?: {
2673
- limit?: number;
2674
- before?: string;
2675
- after?: string;
2676
- around?: string;
2677
- }): Promise<ChameleonAPIResult<Message[]>>;
2919
+ cluster?: boolean;
2920
+ cache?: StoreOptions;
2921
+ debug?: boolean;
2678
2922
  }
2679
-
2923
+ type EventMap = {
2924
+ [K in ChameleonEvent['type']]: Extract<ChameleonEvent, {
2925
+ type: K;
2926
+ }>;
2927
+ };
2928
+ type MiddlewareFn = (event: ChameleonEvent, next: () => void) => void | Promise<void>;
2680
2929
  interface AwaitMessagesOptions {
2681
2930
  filter?: (message: Message) => boolean;
2682
2931
  max?: number;
@@ -2686,6 +2935,7 @@ interface AwaitComponentOptions {
2686
2935
  filter?: (ctx: ComponentContext) => boolean;
2687
2936
  time?: number;
2688
2937
  }
2938
+
2689
2939
  declare class CollectorManager {
2690
2940
  private client;
2691
2941
  constructor(client: Client);
@@ -2701,24 +2951,141 @@ declare class CollectorManager {
2701
2951
  awaitComponent(messageId: string, options?: AwaitComponentOptions): Promise<ComponentContext | null>;
2702
2952
  }
2703
2953
 
2704
- interface ClientOptions<TIntents extends readonly IntentResolvable[]> {
2705
- token: string;
2706
- intents: TIntents;
2707
- largeThreshold?: number;
2708
- sharding?: 'auto' | {
2709
- shards: number[];
2710
- total: number;
2711
- };
2712
- cluster?: boolean;
2713
- cache?: StoreOptions;
2714
- debug?: boolean;
2954
+ declare class WebhookManager {
2955
+ protected rest: ChameleonREST;
2956
+ protected store: TongueStore;
2957
+ constructor(rest: ChameleonREST, store: TongueStore);
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>>;
2715
2975
  }
2716
- type EventMap = {
2717
- [K in ChameleonEvent['type']]: Extract<ChameleonEvent, {
2718
- type: K;
2719
- }>;
2720
- };
2721
- type MiddlewareFn = (event: ChameleonEvent, next: () => void) => void | Promise<void>;
2976
+
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>>;
2986
+ }
2987
+
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>>;
2997
+ }
2998
+
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[]>>;
3014
+ }
3015
+
3016
+ declare class EntitlementManager {
3017
+ protected rest: ChameleonREST;
3018
+ protected store: TongueStore;
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>>;
3036
+ }
3037
+
3038
+ declare class StageInstanceManager {
3039
+ protected rest: ChameleonREST;
3040
+ protected store: TongueStore;
3041
+ constructor(rest: ChameleonREST, store: TongueStore);
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>>;
3046
+ }
3047
+
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>>;
3067
+ }
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[]>>;
3076
+ }
3077
+
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>>;
3087
+ }
3088
+
2722
3089
  declare class Client<TIntents extends readonly IntentResolvable[] = readonly IntentResolvable[]> {
2723
3090
  token: string | undefined;
2724
3091
  intents: number;
@@ -2739,6 +3106,15 @@ declare class Client<TIntents extends readonly IntentResolvable[] = readonly Int
2739
3106
  channels: ChannelManager;
2740
3107
  messages: MessageManager;
2741
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;
2742
3118
  private listeners;
2743
3119
  private middlewares;
2744
3120
  constructor(options: ClientOptions<TIntents>);
@@ -2747,6 +3123,10 @@ declare class Client<TIntents extends readonly IntentResolvable[] = readonly Int
2747
3123
  * register an event listener with full type-safety via discriminated unions
2748
3124
  */
2749
3125
  on<K extends keyof EventMap>(event: K, listener: (data: EventMap[K]) => void): this;
3126
+ /**
3127
+ * register a one-time event listener that automatically removes itself after the first call
3128
+ */
3129
+ once<K extends keyof EventMap>(event: K, listener: (data: EventMap[K]) => void): this;
2750
3130
  /**
2751
3131
  * remove an event listener
2752
3132
  */
@@ -2831,4 +3211,80 @@ declare class Chameleon {
2831
3211
  };
2832
3212
  }
2833
3213
 
2834
- 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, 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, BaseInteractionContext, 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, RoleManager, 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, buildAutoModRule, buildChannel, buildEmoji, buildEntitlement, buildGuild, buildIntegration, buildInteraction, buildMember, buildMessage, buildRole, buildScheduledEvent, buildStageInstance, buildSticker, buildStickerItem, buildUser, buildVoiceState, combinePermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser, serializeComponent };
3214
+ type BitFieldResolvable = string | number | bigint | BitField | BitFieldResolvable[];
3215
+ declare class BitField {
3216
+ static FLAGS: Record<string, bigint>;
3217
+ bitfield: bigint;
3218
+ constructor(bits?: BitFieldResolvable);
3219
+ has(bit: BitFieldResolvable): boolean;
3220
+ any(bit: BitFieldResolvable): boolean;
3221
+ add(...bits: BitFieldResolvable[]): this;
3222
+ remove(...bits: BitFieldResolvable[]): this;
3223
+ toArray(): string[];
3224
+ serialize(): Record<string, boolean>;
3225
+ equals(other: BitFieldResolvable): boolean;
3226
+ freeze(): Readonly<this>;
3227
+ toString(): string;
3228
+ toJSON(): string;
3229
+ static resolve(bit: BitFieldResolvable): bigint;
3230
+ }
3231
+
3232
+ declare class PermissionsBitField extends BitField {
3233
+ static FLAGS: Record<string, bigint>;
3234
+ static ALL: bigint;
3235
+ get isAdmin(): boolean;
3236
+ static from(bits: BitFieldResolvable): PermissionsBitField;
3237
+ }
3238
+ /**
3239
+ * Handles Discord user flag bitfields.
3240
+ */
3241
+ declare class UserFlagsBitField extends BitField {
3242
+ static FLAGS: Record<string, bigint>;
3243
+ }
3244
+ /**
3245
+ * Handles Discord gateway intent bitfields.
3246
+ */
3247
+ declare class IntentsBitField extends BitField {
3248
+ static FLAGS: Record<string, bigint>;
3249
+ }
3250
+ /**
3251
+ * Calculate the base permissions for a member in a guild.
3252
+ */
3253
+ declare function computeBasePermissions(member: {
3254
+ roles: string[];
3255
+ }, guild: {
3256
+ id: string;
3257
+ ownerId: string;
3258
+ roles: Role[];
3259
+ }): bigint;
3260
+ declare function computeChannelPermissions(basePermissions: bigint, overwrites: Overwrite[], memberRoles: string[], memberId?: string): bigint;
3261
+
3262
+ interface ShardOptions {
3263
+ token: string;
3264
+ totalShards?: number | 'auto';
3265
+ respawn?: boolean;
3266
+ }
3267
+
3268
+ declare class Shard extends EventEmitter {
3269
+ id: number;
3270
+ manager: CShard;
3271
+ process: ChildProcess | null;
3272
+ ready: boolean;
3273
+ constructor(manager: CShard, id: number);
3274
+ spawn(): Promise<ChildProcess>;
3275
+ send(message: unknown): Promise<void>;
3276
+ kill(): void;
3277
+ }
3278
+ declare class CShard extends EventEmitter {
3279
+ file: string;
3280
+ totalShards: number;
3281
+ token: string;
3282
+ shards: Map<number, Shard>;
3283
+ respawn: boolean;
3284
+ constructor(file: string, options: ShardOptions);
3285
+ fetchRecommendedShards(): Promise<number>;
3286
+ spawn(): Promise<Map<number, Shard>>;
3287
+ broadcast(message: unknown): Promise<void[]>;
3288
+ }
3289
+
3290
+ 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 };