lunibee 0.1.7 → 0.1.8
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/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/builders/commands.d.ts +6 -4
- package/dist/builders/components.d.ts +18 -0
- package/dist/builders/index.d.ts +2 -2
- package/dist/builders/index.js +49 -13
- package/dist/builders/index.js.map +9 -8
- package/dist/collection/index.js +2 -1
- package/dist/collection/index.js.map +4 -4
- package/dist/core/events.d.ts +86 -2
- package/dist/core/index.d.ts +10 -87
- package/dist/core/index.js +1752 -725
- package/dist/core/index.js.map +44 -24
- package/dist/formatters/index.js.map +1 -1
- package/dist/handlers/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2103 -800
- package/dist/index.js.map +63 -43
- package/dist/managers/guild-resources.d.ts +109 -0
- package/dist/managers/guild.d.ts +5 -0
- package/dist/managers/index.d.ts +7 -1
- package/dist/managers/index.js +330 -12
- package/dist/managers/index.js.map +25 -21
- package/dist/rest/decoder.d.ts +23 -0
- package/dist/rest/errors.d.ts +20 -0
- package/dist/rest/index.d.ts +21 -17
- package/dist/rest/index.js +479 -263
- package/dist/rest/index.js.map +14 -8
- package/dist/rest/limiter.d.ts +42 -0
- package/dist/rest/redis.d.ts +18 -1
- package/dist/rest/route.d.ts +31 -0
- package/dist/rest/routes.d.ts +2 -0
- package/dist/rest/scheduler.d.ts +42 -0
- package/dist/rest/store.d.ts +29 -0
- package/dist/rest/transport.d.ts +40 -0
- package/dist/sharding/bus.d.ts +31 -0
- package/dist/sharding/cluster.d.ts +10 -0
- package/dist/sharding/index.d.ts +10 -2
- package/dist/sharding/index.js +1011 -394
- package/dist/sharding/index.js.map +18 -8
- package/dist/structures/base.d.ts +8 -0
- package/dist/structures/channels.d.ts +56 -0
- package/dist/structures/index.d.ts +1 -0
- package/dist/structures/index.js +211 -271
- package/dist/structures/index.js.map +17 -14
- package/dist/structures/interactions.d.ts +12 -52
- package/dist/structures/options.d.ts +55 -0
- package/dist/structures/resources.d.ts +3 -3
- package/dist/types/gateway-events.d.ts +132 -0
- package/dist/types/gateway.d.ts +181 -0
- package/dist/types/index.d.ts +2 -263
- package/dist/types/index.js +44 -2
- package/dist/types/index.js.map +5 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/voice/index.d.ts +29 -1
- package/dist/voice/index.js +59 -7
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/close-codes.d.ts +23 -0
- package/dist/ws/decoder.d.ts +58 -0
- package/dist/ws/heartbeat.d.ts +87 -0
- package/dist/ws/index.d.ts +18 -65
- package/dist/ws/index.js +903 -385
- package/dist/ws/index.js.map +15 -5
- package/dist/ws/opcodes.d.ts +14 -0
- package/dist/ws/protocol.d.ts +110 -0
- package/dist/ws/reconnect.d.ts +108 -0
- package/dist/ws/send-budget.d.ts +17 -0
- package/dist/ws/session.d.ts +100 -0
- package/dist/ws/state.d.ts +27 -0
- package/dist/ws/transport.d.ts +80 -0
- package/package.json +21 -20
|
@@ -89,6 +89,14 @@ export declare class Channel extends BaseStructure {
|
|
|
89
89
|
delete(): Promise<void>;
|
|
90
90
|
/** Updates this channel using the same resource operation as edit. @param options Channel fields to change. @returns The updated channel. @throws {Error} If the channel is not attached to a client. */
|
|
91
91
|
update(options: Record<string, unknown>): Promise<Channel>;
|
|
92
|
+
/** Whether this is a thread (announcement, public or private). */
|
|
93
|
+
isThread(): boolean;
|
|
94
|
+
/** Whether messages can be sent in this channel (text, DM, announcement, voice, stage, threads). */
|
|
95
|
+
isTextBased(): boolean;
|
|
96
|
+
/** Whether this is a voice or stage channel. */
|
|
97
|
+
isVoiceBased(): boolean;
|
|
98
|
+
/** Whether this is a direct-message channel (DM or group DM). */
|
|
99
|
+
isDMBased(): boolean;
|
|
92
100
|
/** Returns the Discord channel mention string. Used automatically in template literals. */
|
|
93
101
|
toString(): string;
|
|
94
102
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Channel, User, type ResourceContext } from "./base.js";
|
|
2
|
+
import { TextChannel } from "./resources.js";
|
|
3
|
+
import type { APIChannel, APIForumTag, APIPartialEmoji, APIThreadMetadata } from "@lunibee/types";
|
|
4
|
+
/** A guild announcement (news) channel. */
|
|
5
|
+
export declare class NewsChannel extends TextChannel {
|
|
6
|
+
}
|
|
7
|
+
/** A direct-message or group DM channel. */
|
|
8
|
+
export declare class DMChannel extends Channel {
|
|
9
|
+
/** Users in the conversation. */ readonly recipients: User[];
|
|
10
|
+
/** Owner of a group DM. */ readonly ownerId: string | null;
|
|
11
|
+
constructor(data: APIChannel, context?: ResourceContext);
|
|
12
|
+
}
|
|
13
|
+
/** A guild voice channel. */
|
|
14
|
+
export declare class VoiceChannel extends Channel {
|
|
15
|
+
/** Bitrate in bits per second. */ bitrate: number;
|
|
16
|
+
/** User limit (0 = unlimited). */ userLimit: number;
|
|
17
|
+
/** Voice region override, or null for automatic. */ rtcRegion: string | null;
|
|
18
|
+
/** Camera video quality mode. */ videoQualityMode: number;
|
|
19
|
+
constructor(data: APIChannel, context?: ResourceContext);
|
|
20
|
+
}
|
|
21
|
+
/** A guild stage channel. */
|
|
22
|
+
export declare class StageChannel extends VoiceChannel {
|
|
23
|
+
}
|
|
24
|
+
/** A guild category. */
|
|
25
|
+
export declare class CategoryChannel extends Channel {
|
|
26
|
+
}
|
|
27
|
+
/** A thread (announcement, public or private). */
|
|
28
|
+
export declare class ThreadChannel extends Channel {
|
|
29
|
+
/** User who created the thread. */ readonly ownerId: string | null;
|
|
30
|
+
/** Approximate message count. */ messageCount: number;
|
|
31
|
+
/** Approximate member count (stops counting at 50). */ memberCount: number;
|
|
32
|
+
/** Thread metadata. */ metadata: APIThreadMetadata | null;
|
|
33
|
+
constructor(data: APIChannel, context?: ResourceContext);
|
|
34
|
+
/** Whether the thread is archived. */
|
|
35
|
+
get archived(): boolean;
|
|
36
|
+
/** Whether the thread is locked. */
|
|
37
|
+
get locked(): boolean;
|
|
38
|
+
/** Minutes of inactivity before the thread auto-archives. */
|
|
39
|
+
get autoArchiveDuration(): number | null;
|
|
40
|
+
}
|
|
41
|
+
/** A guild forum channel. */
|
|
42
|
+
export declare class ForumChannel extends Channel {
|
|
43
|
+
/** Tags that threads can apply. */ availableTags: APIForumTag[];
|
|
44
|
+
/** Default reaction for new threads. */ defaultReactionEmoji: APIPartialEmoji | null;
|
|
45
|
+
/** Default slowmode for new threads. */ defaultThreadRateLimitPerUser: number;
|
|
46
|
+
/** Default auto-archive duration for new threads. */ defaultAutoArchiveDuration: number | null;
|
|
47
|
+
constructor(data: APIChannel, context?: ResourceContext);
|
|
48
|
+
}
|
|
49
|
+
/** A guild media channel. */
|
|
50
|
+
export declare class MediaChannel extends ForumChannel {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Builds the most specific channel class for a payload's `type`, falling back
|
|
54
|
+
* to {@link Channel} for types without a dedicated class.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createChannel(data: APIChannel, context?: ResourceContext): Channel;
|
|
@@ -81,6 +81,7 @@ export declare class Message extends BaseStructure {
|
|
|
81
81
|
toJSON(): Record<string, unknown>;
|
|
82
82
|
}
|
|
83
83
|
export { GuildMember, Role, TextChannel, Invite, Webhook, WebhookType, Emoji, AutoModerationRule, WelcomeScreenChannel, GuildWelcomeScreen, OnboardingPromptOption, OnboardingPrompt, GuildOnboarding, } from "./resources.js";
|
|
84
|
+
export { NewsChannel, DMChannel, VoiceChannel, StageChannel, CategoryChannel, ThreadChannel, ForumChannel, MediaChannel, createChannel, } from "./channels.js";
|
|
84
85
|
export * from "./interactions.js";
|
|
85
86
|
export { Embed } from "./embed.js";
|
|
86
87
|
export { AuditLog, AuditLogEntry } from "./audit-log.js";
|
package/dist/structures/index.js
CHANGED
|
@@ -118,6 +118,18 @@ class Channel extends BaseStructure {
|
|
|
118
118
|
update(options) {
|
|
119
119
|
return this.edit(options);
|
|
120
120
|
}
|
|
121
|
+
isThread() {
|
|
122
|
+
return this.type === 10 || this.type === 11 || this.type === 12;
|
|
123
|
+
}
|
|
124
|
+
isTextBased() {
|
|
125
|
+
return [0, 1, 2, 3, 5, 10, 11, 12, 13].includes(this.type);
|
|
126
|
+
}
|
|
127
|
+
isVoiceBased() {
|
|
128
|
+
return this.type === 2 || this.type === 13;
|
|
129
|
+
}
|
|
130
|
+
isDMBased() {
|
|
131
|
+
return this.type === 1 || this.type === 3;
|
|
132
|
+
}
|
|
121
133
|
toString() {
|
|
122
134
|
return `<#${this.id}>`;
|
|
123
135
|
}
|
|
@@ -644,7 +656,7 @@ class PermissionsBitField extends PermissionSet {
|
|
|
644
656
|
super(value);
|
|
645
657
|
}
|
|
646
658
|
}
|
|
647
|
-
// packages/types/src/
|
|
659
|
+
// packages/types/src/gateway.ts
|
|
648
660
|
var GatewayIntentBits = {
|
|
649
661
|
Guilds: 1 << 0,
|
|
650
662
|
GuildMembers: 1 << 1,
|
|
@@ -696,6 +708,7 @@ var IntentBits = {
|
|
|
696
708
|
guildMessagePolls: 1 << 24,
|
|
697
709
|
directMessagePolls: 1 << 25
|
|
698
710
|
};
|
|
711
|
+
// packages/types/src/index.ts
|
|
699
712
|
var InteractionResponseType = {
|
|
700
713
|
Pong: 1,
|
|
701
714
|
ChannelMessage: 4,
|
|
@@ -705,262 +718,10 @@ var InteractionResponseType = {
|
|
|
705
718
|
Autocomplete: 8,
|
|
706
719
|
Modal: 9
|
|
707
720
|
};
|
|
708
|
-
// packages/collection/src/index.ts
|
|
709
|
-
class Collection extends Map {
|
|
710
|
-
first() {
|
|
711
|
-
for (const value of this.values())
|
|
712
|
-
return value;
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
firstKey() {
|
|
716
|
-
for (const key of this.keys())
|
|
717
|
-
return key;
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
last() {
|
|
721
|
-
let value;
|
|
722
|
-
for (const item of this.values())
|
|
723
|
-
value = item;
|
|
724
|
-
return value;
|
|
725
|
-
}
|
|
726
|
-
lastKey() {
|
|
727
|
-
let key;
|
|
728
|
-
for (const item of this.keys())
|
|
729
|
-
key = item;
|
|
730
|
-
return key;
|
|
731
|
-
}
|
|
732
|
-
find(predicate) {
|
|
733
|
-
for (const [key, value] of this) {
|
|
734
|
-
if (predicate(value, key, this))
|
|
735
|
-
return value;
|
|
736
|
-
}
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
filter(predicate) {
|
|
740
|
-
const result = new Collection;
|
|
741
|
-
for (const [key, value] of this) {
|
|
742
|
-
if (predicate(value, key, this))
|
|
743
|
-
result.set(key, value);
|
|
744
|
-
}
|
|
745
|
-
return result;
|
|
746
|
-
}
|
|
747
|
-
map(transform) {
|
|
748
|
-
const result = [];
|
|
749
|
-
for (const [key, value] of this) {
|
|
750
|
-
result.push(transform(value, key, this));
|
|
751
|
-
}
|
|
752
|
-
return result;
|
|
753
|
-
}
|
|
754
|
-
some(predicate) {
|
|
755
|
-
for (const [key, value] of this) {
|
|
756
|
-
if (predicate(value, key, this))
|
|
757
|
-
return true;
|
|
758
|
-
}
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
every(predicate) {
|
|
762
|
-
for (const [key, value] of this) {
|
|
763
|
-
if (!predicate(value, key, this))
|
|
764
|
-
return false;
|
|
765
|
-
}
|
|
766
|
-
return true;
|
|
767
|
-
}
|
|
768
|
-
each(callback) {
|
|
769
|
-
for (const [key, value] of this) {
|
|
770
|
-
callback(value, key, this);
|
|
771
|
-
}
|
|
772
|
-
return this;
|
|
773
|
-
}
|
|
774
|
-
array() {
|
|
775
|
-
return [...this.values()];
|
|
776
|
-
}
|
|
777
|
-
keyArray() {
|
|
778
|
-
return [...this.keys()];
|
|
779
|
-
}
|
|
780
|
-
entriesArray() {
|
|
781
|
-
return [...this.entries()];
|
|
782
|
-
}
|
|
783
|
-
clone() {
|
|
784
|
-
const copy = new Collection;
|
|
785
|
-
for (const [key, value] of this)
|
|
786
|
-
copy.set(key, value);
|
|
787
|
-
return copy;
|
|
788
|
-
}
|
|
789
|
-
hasAll(...keys) {
|
|
790
|
-
for (let i = 0;i < keys.length; i++) {
|
|
791
|
-
if (!this.has(keys[i]))
|
|
792
|
-
return false;
|
|
793
|
-
}
|
|
794
|
-
return true;
|
|
795
|
-
}
|
|
796
|
-
hasAny(...keys) {
|
|
797
|
-
for (let i = 0;i < keys.length; i++) {
|
|
798
|
-
if (this.has(keys[i]))
|
|
799
|
-
return true;
|
|
800
|
-
}
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
findKey(predicate) {
|
|
804
|
-
for (const [key, value] of this) {
|
|
805
|
-
if (predicate(value, key, this))
|
|
806
|
-
return key;
|
|
807
|
-
}
|
|
808
|
-
return;
|
|
809
|
-
}
|
|
810
|
-
someEntry(predicate) {
|
|
811
|
-
return this.some(predicate);
|
|
812
|
-
}
|
|
813
|
-
sweep(predicate) {
|
|
814
|
-
let removed = 0;
|
|
815
|
-
for (const [key, value] of this) {
|
|
816
|
-
if (predicate(value, key, this) && this.delete(key))
|
|
817
|
-
removed++;
|
|
818
|
-
}
|
|
819
|
-
return removed;
|
|
820
|
-
}
|
|
821
|
-
firstEntry() {
|
|
822
|
-
for (const [key, value] of this)
|
|
823
|
-
return [key, value];
|
|
824
|
-
return;
|
|
825
|
-
}
|
|
826
|
-
lastEntry() {
|
|
827
|
-
let entry;
|
|
828
|
-
for (const item of this)
|
|
829
|
-
entry = [item[0], item[1]];
|
|
830
|
-
return entry;
|
|
831
|
-
}
|
|
832
|
-
union(other) {
|
|
833
|
-
const result = this.clone();
|
|
834
|
-
for (const [key, value] of other)
|
|
835
|
-
result.set(key, value);
|
|
836
|
-
return result;
|
|
837
|
-
}
|
|
838
|
-
intersection(other) {
|
|
839
|
-
const result = new Collection;
|
|
840
|
-
for (const [key, value] of this) {
|
|
841
|
-
if (other.has(key))
|
|
842
|
-
result.set(key, value);
|
|
843
|
-
}
|
|
844
|
-
return result;
|
|
845
|
-
}
|
|
846
|
-
difference(other) {
|
|
847
|
-
const result = new Collection;
|
|
848
|
-
for (const [key, value] of this) {
|
|
849
|
-
if (!other.has(key))
|
|
850
|
-
result.set(key, value);
|
|
851
|
-
}
|
|
852
|
-
return result;
|
|
853
|
-
}
|
|
854
|
-
partition(predicate) {
|
|
855
|
-
const pass = new Collection;
|
|
856
|
-
const fail = new Collection;
|
|
857
|
-
for (const [key, value] of this) {
|
|
858
|
-
if (predicate(value, key, this))
|
|
859
|
-
pass.set(key, value);
|
|
860
|
-
else
|
|
861
|
-
fail.set(key, value);
|
|
862
|
-
}
|
|
863
|
-
return [pass, fail];
|
|
864
|
-
}
|
|
865
|
-
tap(fn) {
|
|
866
|
-
fn(this);
|
|
867
|
-
return this;
|
|
868
|
-
}
|
|
869
|
-
flatMap(transform) {
|
|
870
|
-
const result = [];
|
|
871
|
-
for (const [key, value] of this) {
|
|
872
|
-
for (const item of transform(value, key, this))
|
|
873
|
-
result.push(item);
|
|
874
|
-
}
|
|
875
|
-
return result;
|
|
876
|
-
}
|
|
877
|
-
reduce(fn, initialValue) {
|
|
878
|
-
let acc = initialValue;
|
|
879
|
-
for (const [key, value] of this)
|
|
880
|
-
acc = fn(acc, value, key, this);
|
|
881
|
-
return acc;
|
|
882
|
-
}
|
|
883
|
-
sorted(comparator) {
|
|
884
|
-
const decorated = [...this.entries()].map((entry, index) => ({
|
|
885
|
-
entry,
|
|
886
|
-
index
|
|
887
|
-
}));
|
|
888
|
-
if (comparator)
|
|
889
|
-
decorated.sort((x, y) => {
|
|
890
|
-
const comparison = comparator(x.entry[1], y.entry[1], x.entry[0], y.entry[0]);
|
|
891
|
-
return comparison !== 0 ? comparison : x.index - y.index;
|
|
892
|
-
});
|
|
893
|
-
const result = new Collection;
|
|
894
|
-
for (const { entry } of decorated)
|
|
895
|
-
result.set(entry[0], entry[1]);
|
|
896
|
-
return result;
|
|
897
|
-
}
|
|
898
|
-
random() {
|
|
899
|
-
const arr = [...this.values()];
|
|
900
|
-
if (!arr.length)
|
|
901
|
-
return;
|
|
902
|
-
return arr[Math.floor(Math.random() * arr.length)];
|
|
903
|
-
}
|
|
904
|
-
randomKey() {
|
|
905
|
-
const arr = [...this.keys()];
|
|
906
|
-
if (!arr.length)
|
|
907
|
-
return;
|
|
908
|
-
return arr[Math.floor(Math.random() * arr.length)];
|
|
909
|
-
}
|
|
910
|
-
at(index) {
|
|
911
|
-
const arr = [...this.values()];
|
|
912
|
-
const i = index < 0 ? arr.length + index : index;
|
|
913
|
-
return arr[i];
|
|
914
|
-
}
|
|
915
|
-
keyAt(index) {
|
|
916
|
-
const arr = [...this.keys()];
|
|
917
|
-
const i = index < 0 ? arr.length + index : index;
|
|
918
|
-
return arr[i];
|
|
919
|
-
}
|
|
920
|
-
toJSON() {
|
|
921
|
-
return [...this.entries()];
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
// packages/managers/src/base.ts
|
|
926
|
-
class Manager {
|
|
927
|
-
cache = new Collection;
|
|
928
|
-
get(id) {
|
|
929
|
-
return this.cache.get(id);
|
|
930
|
-
}
|
|
931
|
-
has(id) {
|
|
932
|
-
return this.cache.has(id);
|
|
933
|
-
}
|
|
934
|
-
set(id, value) {
|
|
935
|
-
this.cache.set(id, value);
|
|
936
|
-
return this;
|
|
937
|
-
}
|
|
938
|
-
delete(id) {
|
|
939
|
-
return this.cache.delete(id);
|
|
940
|
-
}
|
|
941
|
-
clear() {
|
|
942
|
-
this.cache.clear();
|
|
943
|
-
}
|
|
944
|
-
get size() {
|
|
945
|
-
return this.cache.size;
|
|
946
|
-
}
|
|
947
|
-
first() {
|
|
948
|
-
return this.cache.first();
|
|
949
|
-
}
|
|
950
|
-
values() {
|
|
951
|
-
return this.cache.array();
|
|
952
|
-
}
|
|
953
|
-
find(predicate) {
|
|
954
|
-
return this.cache.find(predicate);
|
|
955
|
-
}
|
|
956
|
-
[Symbol.iterator]() {
|
|
957
|
-
return this.cache[Symbol.iterator]();
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
721
|
// packages/rest/package.json
|
|
961
722
|
var package_default = {
|
|
962
723
|
name: "@lunibee/rest",
|
|
963
|
-
version: "0.1.
|
|
724
|
+
version: "0.1.8",
|
|
964
725
|
type: "module",
|
|
965
726
|
module: "./src/index.ts",
|
|
966
727
|
types: "./src/index.ts",
|
|
@@ -968,6 +729,7 @@ var package_default = {
|
|
|
968
729
|
".": "./src/index.ts"
|
|
969
730
|
}
|
|
970
731
|
};
|
|
732
|
+
|
|
971
733
|
// packages/rest/src/index.ts
|
|
972
734
|
var LIBRARY_VERSION = package_default.version;
|
|
973
735
|
var LIBRARY_URL = "https://github.com/Ekretos/lunibee";
|
|
@@ -981,6 +743,37 @@ var REQUEST_DATA_KEYS = new Set([
|
|
|
981
743
|
"auth",
|
|
982
744
|
"signal"
|
|
983
745
|
]);
|
|
746
|
+
// packages/ws/src/close-codes.ts
|
|
747
|
+
var GatewayCloseCodes = {
|
|
748
|
+
UnknownError: 4000,
|
|
749
|
+
UnknownOpcode: 4001,
|
|
750
|
+
DecodeError: 4002,
|
|
751
|
+
NotAuthenticated: 4003,
|
|
752
|
+
AuthenticationFailed: 4004,
|
|
753
|
+
AlreadyAuthenticated: 4005,
|
|
754
|
+
InvalidSeq: 4007,
|
|
755
|
+
RateLimited: 4008,
|
|
756
|
+
SessionTimedOut: 4009,
|
|
757
|
+
InvalidShard: 4010,
|
|
758
|
+
ShardingRequired: 4011,
|
|
759
|
+
InvalidAPIVersion: 4012,
|
|
760
|
+
InvalidIntents: 4013,
|
|
761
|
+
DisallowedIntents: 4014
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// packages/ws/src/reconnect.ts
|
|
765
|
+
var FATAL_CLOSE_CODES = [
|
|
766
|
+
GatewayCloseCodes.AuthenticationFailed,
|
|
767
|
+
GatewayCloseCodes.InvalidShard,
|
|
768
|
+
GatewayCloseCodes.ShardingRequired,
|
|
769
|
+
GatewayCloseCodes.InvalidAPIVersion,
|
|
770
|
+
GatewayCloseCodes.InvalidIntents,
|
|
771
|
+
GatewayCloseCodes.DisallowedIntents
|
|
772
|
+
];
|
|
773
|
+
var IDENTIFY_CLOSE_CODES = [
|
|
774
|
+
GatewayCloseCodes.InvalidSeq,
|
|
775
|
+
GatewayCloseCodes.SessionTimedOut
|
|
776
|
+
];
|
|
984
777
|
// packages/structures/src/resources.ts
|
|
985
778
|
function toDateOrNull(value) {
|
|
986
779
|
if (!value)
|
|
@@ -1166,7 +959,9 @@ class Emoji extends BaseStructure {
|
|
|
1166
959
|
animated;
|
|
1167
960
|
available;
|
|
1168
961
|
constructor(data) {
|
|
1169
|
-
super(data.id ?? "
|
|
962
|
+
super(data.id ?? "0");
|
|
963
|
+
if (data.id === null)
|
|
964
|
+
this.id = "unicode";
|
|
1170
965
|
this.name = data.name;
|
|
1171
966
|
this.roleIds = data.roles ?? [];
|
|
1172
967
|
this.user = data.user ? new User(data.user) : null;
|
|
@@ -1299,14 +1094,107 @@ class GuildOnboarding2 extends BaseStructure {
|
|
|
1299
1094
|
this.mode = data.mode;
|
|
1300
1095
|
}
|
|
1301
1096
|
}
|
|
1302
|
-
// packages/structures/src/
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1097
|
+
// packages/structures/src/channels.ts
|
|
1098
|
+
class NewsChannel extends TextChannel {
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
class DMChannel extends Channel {
|
|
1102
|
+
recipients;
|
|
1103
|
+
ownerId;
|
|
1104
|
+
constructor(data, context) {
|
|
1105
|
+
super(data, context);
|
|
1106
|
+
this.recipients = (data.recipients ?? []).map((u) => new User(u));
|
|
1107
|
+
this.ownerId = data.owner_id ?? null;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
class VoiceChannel extends Channel {
|
|
1112
|
+
bitrate;
|
|
1113
|
+
userLimit;
|
|
1114
|
+
rtcRegion;
|
|
1115
|
+
videoQualityMode;
|
|
1116
|
+
constructor(data, context) {
|
|
1117
|
+
super(data, context);
|
|
1118
|
+
this.bitrate = data.bitrate ?? 64000;
|
|
1119
|
+
this.userLimit = data.user_limit ?? 0;
|
|
1120
|
+
this.rtcRegion = data.rtc_region ?? null;
|
|
1121
|
+
this.videoQualityMode = data.video_quality_mode ?? 1;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
class StageChannel extends VoiceChannel {
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
class CategoryChannel extends Channel {
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
class ThreadChannel extends Channel {
|
|
1132
|
+
ownerId;
|
|
1133
|
+
messageCount;
|
|
1134
|
+
memberCount;
|
|
1135
|
+
metadata;
|
|
1136
|
+
constructor(data, context) {
|
|
1137
|
+
super(data, context);
|
|
1138
|
+
this.ownerId = data.owner_id ?? null;
|
|
1139
|
+
this.messageCount = data.message_count ?? 0;
|
|
1140
|
+
this.memberCount = data.member_count ?? 0;
|
|
1141
|
+
this.metadata = data.thread_metadata ?? null;
|
|
1142
|
+
}
|
|
1143
|
+
get archived() {
|
|
1144
|
+
return this.metadata?.archived ?? false;
|
|
1145
|
+
}
|
|
1146
|
+
get locked() {
|
|
1147
|
+
return this.metadata?.locked ?? false;
|
|
1148
|
+
}
|
|
1149
|
+
get autoArchiveDuration() {
|
|
1150
|
+
return this.metadata?.auto_archive_duration ?? null;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
class ForumChannel extends Channel {
|
|
1155
|
+
availableTags;
|
|
1156
|
+
defaultReactionEmoji;
|
|
1157
|
+
defaultThreadRateLimitPerUser;
|
|
1158
|
+
defaultAutoArchiveDuration;
|
|
1159
|
+
constructor(data, context) {
|
|
1160
|
+
super(data, context);
|
|
1161
|
+
this.availableTags = data.available_tags ?? [];
|
|
1162
|
+
this.defaultReactionEmoji = data.default_reaction_emoji ?? null;
|
|
1163
|
+
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user ?? 0;
|
|
1164
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration ?? null;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
class MediaChannel extends ForumChannel {
|
|
1169
|
+
}
|
|
1170
|
+
function createChannel(data, context) {
|
|
1171
|
+
switch (data.type) {
|
|
1172
|
+
case 0:
|
|
1173
|
+
return new TextChannel(data, context);
|
|
1174
|
+
case 1:
|
|
1175
|
+
case 3:
|
|
1176
|
+
return new DMChannel(data, context);
|
|
1177
|
+
case 2:
|
|
1178
|
+
return new VoiceChannel(data, context);
|
|
1179
|
+
case 4:
|
|
1180
|
+
return new CategoryChannel(data, context);
|
|
1181
|
+
case 5:
|
|
1182
|
+
return new NewsChannel(data, context);
|
|
1183
|
+
case 10:
|
|
1184
|
+
case 11:
|
|
1185
|
+
case 12:
|
|
1186
|
+
return new ThreadChannel(data, context);
|
|
1187
|
+
case 13:
|
|
1188
|
+
return new StageChannel(data, context);
|
|
1189
|
+
case 15:
|
|
1190
|
+
return new ForumChannel(data, context);
|
|
1191
|
+
case 16:
|
|
1192
|
+
return new MediaChannel(data, context);
|
|
1193
|
+
default:
|
|
1194
|
+
return new Channel(data, context);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
// packages/structures/src/options.ts
|
|
1310
1198
|
var OptionType = {
|
|
1311
1199
|
SubCommand: 1,
|
|
1312
1200
|
SubCommandGroup: 2,
|
|
@@ -1362,6 +1250,12 @@ class CommandOptions {
|
|
|
1362
1250
|
}
|
|
1363
1251
|
return this.#subcommandGroup;
|
|
1364
1252
|
}
|
|
1253
|
+
getFocused(full = false) {
|
|
1254
|
+
const focused = this.#options.find((o) => o.focused);
|
|
1255
|
+
if (!focused)
|
|
1256
|
+
throw new TypeError("No focused option was provided.");
|
|
1257
|
+
return full ? focused : focused.value ?? "";
|
|
1258
|
+
}
|
|
1365
1259
|
getString(name, required = false) {
|
|
1366
1260
|
const opt = this.#get(name);
|
|
1367
1261
|
if (!opt || opt.type !== OptionType.String) {
|
|
@@ -1467,6 +1361,14 @@ class CommandOptions {
|
|
|
1467
1361
|
return this.#options;
|
|
1468
1362
|
}
|
|
1469
1363
|
}
|
|
1364
|
+
// packages/structures/src/interactions.ts
|
|
1365
|
+
var InteractionType = {
|
|
1366
|
+
Ping: 1,
|
|
1367
|
+
ApplicationCommand: 2,
|
|
1368
|
+
MessageComponent: 3,
|
|
1369
|
+
ApplicationCommandAutocomplete: 4,
|
|
1370
|
+
ModalSubmit: 5
|
|
1371
|
+
};
|
|
1470
1372
|
|
|
1471
1373
|
class InteractionResponse {
|
|
1472
1374
|
type;
|
|
@@ -1495,7 +1397,7 @@ class InteractionResponse {
|
|
|
1495
1397
|
}
|
|
1496
1398
|
}
|
|
1497
1399
|
|
|
1498
|
-
class
|
|
1400
|
+
class Interaction {
|
|
1499
1401
|
id;
|
|
1500
1402
|
applicationId;
|
|
1501
1403
|
token;
|
|
@@ -1530,6 +1432,30 @@ class Interaction2 {
|
|
|
1530
1432
|
isAutocomplete() {
|
|
1531
1433
|
return this.type === InteractionType.ApplicationCommandAutocomplete;
|
|
1532
1434
|
}
|
|
1435
|
+
#componentType() {
|
|
1436
|
+
return this.isMessageComponent() ? this.data.data?.component_type ?? 0 : 0;
|
|
1437
|
+
}
|
|
1438
|
+
isButton() {
|
|
1439
|
+
return this.#componentType() === 2;
|
|
1440
|
+
}
|
|
1441
|
+
isStringSelectMenu() {
|
|
1442
|
+
return this.#componentType() === 3;
|
|
1443
|
+
}
|
|
1444
|
+
isUserSelectMenu() {
|
|
1445
|
+
return this.#componentType() === 5;
|
|
1446
|
+
}
|
|
1447
|
+
isRoleSelectMenu() {
|
|
1448
|
+
return this.#componentType() === 6;
|
|
1449
|
+
}
|
|
1450
|
+
isMentionableSelectMenu() {
|
|
1451
|
+
return this.#componentType() === 7;
|
|
1452
|
+
}
|
|
1453
|
+
isChannelSelectMenu() {
|
|
1454
|
+
return this.#componentType() === 8;
|
|
1455
|
+
}
|
|
1456
|
+
isAnySelectMenu() {
|
|
1457
|
+
return [3, 5, 6, 7, 8].includes(this.#componentType());
|
|
1458
|
+
}
|
|
1533
1459
|
assertUnacknowledged() {
|
|
1534
1460
|
if (this.replied || this.deferred)
|
|
1535
1461
|
throw new Error("Interaction has already been acknowledged.");
|
|
@@ -1580,7 +1506,7 @@ class Interaction2 {
|
|
|
1580
1506
|
}
|
|
1581
1507
|
}
|
|
1582
1508
|
|
|
1583
|
-
class CommandInteraction extends
|
|
1509
|
+
class CommandInteraction extends Interaction {
|
|
1584
1510
|
options;
|
|
1585
1511
|
get commandName() {
|
|
1586
1512
|
return typeof this.data.data?.name === "string" ? this.data.data.name : "";
|
|
@@ -1593,7 +1519,7 @@ class CommandInteraction extends Interaction2 {
|
|
|
1593
1519
|
}
|
|
1594
1520
|
}
|
|
1595
1521
|
|
|
1596
|
-
class ComponentInteraction extends
|
|
1522
|
+
class ComponentInteraction extends Interaction {
|
|
1597
1523
|
get customId() {
|
|
1598
1524
|
return this.data?.data?.custom_id ?? "";
|
|
1599
1525
|
}
|
|
@@ -1617,7 +1543,7 @@ class ComponentInteraction extends Interaction2 {
|
|
|
1617
1543
|
}
|
|
1618
1544
|
}
|
|
1619
1545
|
|
|
1620
|
-
class ModalSubmitInteraction extends
|
|
1546
|
+
class ModalSubmitInteraction extends Interaction {
|
|
1621
1547
|
get customId() {
|
|
1622
1548
|
return this.data?.data?.custom_id ?? "";
|
|
1623
1549
|
}
|
|
@@ -1639,7 +1565,12 @@ class ModalSubmitInteraction extends Interaction2 {
|
|
|
1639
1565
|
}
|
|
1640
1566
|
}
|
|
1641
1567
|
|
|
1642
|
-
class AutocompleteInteraction extends
|
|
1568
|
+
class AutocompleteInteraction extends Interaction {
|
|
1569
|
+
options;
|
|
1570
|
+
constructor(client, data) {
|
|
1571
|
+
super(client, data);
|
|
1572
|
+
this.options = new CommandOptions(data.data?.options ?? []);
|
|
1573
|
+
}
|
|
1643
1574
|
get commandName() {
|
|
1644
1575
|
return this.data?.data?.name ?? "";
|
|
1645
1576
|
}
|
|
@@ -1678,7 +1609,7 @@ function createInteraction(client, data) {
|
|
|
1678
1609
|
case InteractionType.ModalSubmit:
|
|
1679
1610
|
return new ModalSubmitInteraction(client, data);
|
|
1680
1611
|
default:
|
|
1681
|
-
return new
|
|
1612
|
+
return new Interaction(client, data);
|
|
1682
1613
|
}
|
|
1683
1614
|
}
|
|
1684
1615
|
// packages/structures/src/embed.ts
|
|
@@ -2008,33 +1939,42 @@ export {
|
|
|
2008
1939
|
AutoModerationRule,
|
|
2009
1940
|
AutocompleteInteraction,
|
|
2010
1941
|
BaseStructure,
|
|
1942
|
+
CategoryChannel,
|
|
2011
1943
|
Channel,
|
|
2012
1944
|
CommandInteraction,
|
|
2013
1945
|
CommandOptions,
|
|
2014
1946
|
ComponentInteraction,
|
|
1947
|
+
DMChannel,
|
|
2015
1948
|
Embed,
|
|
2016
1949
|
Emoji,
|
|
1950
|
+
ForumChannel,
|
|
2017
1951
|
Guild,
|
|
2018
1952
|
GuildMember,
|
|
2019
1953
|
GuildOnboarding2 as GuildOnboarding,
|
|
2020
1954
|
GuildWelcomeScreen2 as GuildWelcomeScreen,
|
|
2021
|
-
|
|
1955
|
+
Interaction,
|
|
2022
1956
|
InteractionResponse,
|
|
2023
1957
|
InteractionResponseType,
|
|
2024
1958
|
InteractionType,
|
|
2025
1959
|
Invite,
|
|
1960
|
+
MediaChannel,
|
|
2026
1961
|
Message,
|
|
2027
1962
|
ModalSubmitInteraction,
|
|
1963
|
+
NewsChannel,
|
|
2028
1964
|
OnboardingPrompt,
|
|
2029
1965
|
OnboardingPromptOption,
|
|
2030
1966
|
PermissionsBitField,
|
|
2031
1967
|
Role,
|
|
1968
|
+
StageChannel,
|
|
2032
1969
|
TextChannel,
|
|
1970
|
+
ThreadChannel,
|
|
2033
1971
|
User,
|
|
1972
|
+
VoiceChannel,
|
|
2034
1973
|
Webhook,
|
|
2035
1974
|
WebhookType,
|
|
2036
1975
|
WelcomeScreenChannel,
|
|
1976
|
+
createChannel,
|
|
2037
1977
|
createInteraction
|
|
2038
1978
|
};
|
|
2039
1979
|
|
|
2040
|
-
//# debugId=
|
|
1980
|
+
//# debugId=8FB0F7F12180BD8364756E2164756E21
|