@wlix/ceres 0.0.1
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 +7 -0
- package/README.md +60 -0
- package/dist/index.cjs +543 -0
- package/dist/index.d.cts +143 -0
- package/dist/index.d.mts +143 -0
- package/dist/index.mjs +519 -0
- package/package.json +54 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { APIAllowedMentions, APIChannel, APIEmbed, APIMessage, APIMessageComponent, APIMessageReference, APIUser, ActivityType, ActivityType as ActivityType$1, ChannelType, ChannelType as ChannelType$1, GatewayDispatchEvents } from "discord-api-types/v10";
|
|
2
|
+
|
|
3
|
+
//#region src/structures/EventHandler.d.ts
|
|
4
|
+
declare class EventHandler<Events extends Record<string, any[]>> {
|
|
5
|
+
#private;
|
|
6
|
+
on<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
7
|
+
once<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
8
|
+
off<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
9
|
+
emit<K extends keyof Events>(event: K, ...args: Events[K]): boolean;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/structures/Channel.d.ts
|
|
13
|
+
declare class Channel {
|
|
14
|
+
client: Client<true>;
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
type: ChannelType$1;
|
|
18
|
+
guildId?: string;
|
|
19
|
+
constructor(client: Client<true>, data: APIChannel);
|
|
20
|
+
isText(): boolean;
|
|
21
|
+
send(props: CreateMessageProps): Promise<Message | null>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/structures/Client.d.ts
|
|
25
|
+
declare class Client<Ready extends boolean = false> extends EventHandler<ClientEvents> {
|
|
26
|
+
#private;
|
|
27
|
+
static gatewayUrl: string;
|
|
28
|
+
static baseApiUrl: string;
|
|
29
|
+
intents: number;
|
|
30
|
+
ready: boolean;
|
|
31
|
+
token: string;
|
|
32
|
+
user: If<Ready, User, null>;
|
|
33
|
+
constructor(options: ClientOptions);
|
|
34
|
+
isReady(): this is Client<true>;
|
|
35
|
+
get presence(): ClientPresence | null;
|
|
36
|
+
setToken(token: string): void;
|
|
37
|
+
connect(): Promise<this>;
|
|
38
|
+
disconnect(): void;
|
|
39
|
+
fetchChannel(id: string): Promise<Channel | null>;
|
|
40
|
+
fetchUser(id: string): Promise<User | null>;
|
|
41
|
+
createMessage(channelId: string, props: CreateMessageProps): Promise<Message | null>;
|
|
42
|
+
setPresence(presence: ClientPresence): void;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/structures/Message.d.ts
|
|
46
|
+
declare class Message {
|
|
47
|
+
client: Client<true>;
|
|
48
|
+
id: string;
|
|
49
|
+
content: string;
|
|
50
|
+
author: User;
|
|
51
|
+
channel: Channel;
|
|
52
|
+
channelId: string;
|
|
53
|
+
timestamp: Date;
|
|
54
|
+
constructor(client: Client<true>, channel: Channel, data: APIMessage);
|
|
55
|
+
reply(props: CreateMessageProps): Promise<Message | null>;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/structures/User.d.ts
|
|
59
|
+
declare class User {
|
|
60
|
+
client: Client<true>;
|
|
61
|
+
id: string;
|
|
62
|
+
username: string;
|
|
63
|
+
discriminator: string;
|
|
64
|
+
bot: boolean;
|
|
65
|
+
get tag(): string;
|
|
66
|
+
toString(): string;
|
|
67
|
+
constructor(client: Client<true>, data: APIUser);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/utils/client-events.d.ts
|
|
71
|
+
declare function handleClientEvent(client: Client<true>, packet: any): Promise<void>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/utils/intents.d.ts
|
|
74
|
+
declare const ClientIntents: {
|
|
75
|
+
readonly AutoModerationConfiguration: number;
|
|
76
|
+
readonly AutoModerationExecution: number;
|
|
77
|
+
readonly DirectMessagePolls: number;
|
|
78
|
+
readonly DirectMessageReactions: number;
|
|
79
|
+
readonly DirectMessages: number;
|
|
80
|
+
readonly DirectMessageTyping: number;
|
|
81
|
+
readonly GuildExpressions: number;
|
|
82
|
+
readonly GuildIntegrations: number;
|
|
83
|
+
readonly GuildInvites: number;
|
|
84
|
+
readonly GuildMembers: number;
|
|
85
|
+
readonly GuildMessagePolls: number;
|
|
86
|
+
readonly GuildMessageReactions: number;
|
|
87
|
+
readonly GuildMessages: number;
|
|
88
|
+
readonly GuildMessageTyping: number;
|
|
89
|
+
readonly GuildModeration: number;
|
|
90
|
+
readonly GuildPresences: number;
|
|
91
|
+
readonly Guilds: number;
|
|
92
|
+
readonly GuildScheduledEvents: number;
|
|
93
|
+
readonly GuildVoiceStates: number;
|
|
94
|
+
readonly GuildWebhooks: number;
|
|
95
|
+
readonly MessageContent: number;
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/types.d.ts
|
|
99
|
+
interface ClientActivity {
|
|
100
|
+
name: string;
|
|
101
|
+
state?: string;
|
|
102
|
+
type: ActivityType$1;
|
|
103
|
+
url?: string;
|
|
104
|
+
}
|
|
105
|
+
type ClientEvents = {
|
|
106
|
+
debug: [message: string];
|
|
107
|
+
disconnect: [];
|
|
108
|
+
error: [error: any];
|
|
109
|
+
messageCreate: [message: Message];
|
|
110
|
+
ready: [readyClient: Client<true>];
|
|
111
|
+
};
|
|
112
|
+
type ClientIntent = (typeof ClientIntents)[keyof typeof ClientIntents];
|
|
113
|
+
interface ClientOptions {
|
|
114
|
+
token: string;
|
|
115
|
+
intents: ClientIntent[];
|
|
116
|
+
presence?: ClientPresence;
|
|
117
|
+
}
|
|
118
|
+
interface ClientPresence {
|
|
119
|
+
status: UserStatus;
|
|
120
|
+
activities?: ClientActivity[];
|
|
121
|
+
}
|
|
122
|
+
type CreateMessageProps = CreateMessagePropsObject | string;
|
|
123
|
+
interface CreateMessagePropsObject {
|
|
124
|
+
content?: string;
|
|
125
|
+
nonce?: string | number;
|
|
126
|
+
tts?: boolean;
|
|
127
|
+
embeds?: APIEmbed[];
|
|
128
|
+
allowedMentions?: APIAllowedMentions;
|
|
129
|
+
messageReference?: APIMessageReference;
|
|
130
|
+
components?: APIMessageComponent[];
|
|
131
|
+
stickerIds?: string[];
|
|
132
|
+
attachments?: {
|
|
133
|
+
id?: string;
|
|
134
|
+
filename: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
}[];
|
|
137
|
+
flags?: number;
|
|
138
|
+
enforceNonce?: boolean;
|
|
139
|
+
}
|
|
140
|
+
type If<Condition extends boolean, True, False = null> = Condition extends true ? True : False;
|
|
141
|
+
type UserStatus = "online" | "idle" | "dnd" | "offline";
|
|
142
|
+
//#endregion
|
|
143
|
+
export { ActivityType, Channel, ChannelType, Client, ClientActivity, ClientEvents, ClientIntent, ClientIntents, ClientOptions, ClientPresence, CreateMessageProps, CreateMessagePropsObject, EventHandler, GatewayDispatchEvents, If, Message, User, UserStatus, handleClientEvent };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { APIAllowedMentions, APIChannel, APIEmbed, APIMessage, APIMessageComponent, APIMessageReference, APIUser, ActivityType, ActivityType as ActivityType$1, ChannelType, ChannelType as ChannelType$1, GatewayDispatchEvents } from "discord-api-types/v10";
|
|
2
|
+
|
|
3
|
+
//#region src/structures/EventHandler.d.ts
|
|
4
|
+
declare class EventHandler<Events extends Record<string, any[]>> {
|
|
5
|
+
#private;
|
|
6
|
+
on<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
7
|
+
once<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
8
|
+
off<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
|
|
9
|
+
emit<K extends keyof Events>(event: K, ...args: Events[K]): boolean;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/structures/Channel.d.ts
|
|
13
|
+
declare class Channel {
|
|
14
|
+
client: Client<true>;
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
type: ChannelType$1;
|
|
18
|
+
guildId?: string;
|
|
19
|
+
constructor(client: Client<true>, data: APIChannel);
|
|
20
|
+
isText(): boolean;
|
|
21
|
+
send(props: CreateMessageProps): Promise<Message | null>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/structures/Client.d.ts
|
|
25
|
+
declare class Client<Ready extends boolean = false> extends EventHandler<ClientEvents> {
|
|
26
|
+
#private;
|
|
27
|
+
static gatewayUrl: string;
|
|
28
|
+
static baseApiUrl: string;
|
|
29
|
+
intents: number;
|
|
30
|
+
ready: boolean;
|
|
31
|
+
token: string;
|
|
32
|
+
user: If<Ready, User, null>;
|
|
33
|
+
constructor(options: ClientOptions);
|
|
34
|
+
isReady(): this is Client<true>;
|
|
35
|
+
get presence(): ClientPresence | null;
|
|
36
|
+
setToken(token: string): void;
|
|
37
|
+
connect(): Promise<this>;
|
|
38
|
+
disconnect(): void;
|
|
39
|
+
fetchChannel(id: string): Promise<Channel | null>;
|
|
40
|
+
fetchUser(id: string): Promise<User | null>;
|
|
41
|
+
createMessage(channelId: string, props: CreateMessageProps): Promise<Message | null>;
|
|
42
|
+
setPresence(presence: ClientPresence): void;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/structures/Message.d.ts
|
|
46
|
+
declare class Message {
|
|
47
|
+
client: Client<true>;
|
|
48
|
+
id: string;
|
|
49
|
+
content: string;
|
|
50
|
+
author: User;
|
|
51
|
+
channel: Channel;
|
|
52
|
+
channelId: string;
|
|
53
|
+
timestamp: Date;
|
|
54
|
+
constructor(client: Client<true>, channel: Channel, data: APIMessage);
|
|
55
|
+
reply(props: CreateMessageProps): Promise<Message | null>;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/structures/User.d.ts
|
|
59
|
+
declare class User {
|
|
60
|
+
client: Client<true>;
|
|
61
|
+
id: string;
|
|
62
|
+
username: string;
|
|
63
|
+
discriminator: string;
|
|
64
|
+
bot: boolean;
|
|
65
|
+
get tag(): string;
|
|
66
|
+
toString(): string;
|
|
67
|
+
constructor(client: Client<true>, data: APIUser);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/utils/client-events.d.ts
|
|
71
|
+
declare function handleClientEvent(client: Client<true>, packet: any): Promise<void>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/utils/intents.d.ts
|
|
74
|
+
declare const ClientIntents: {
|
|
75
|
+
readonly AutoModerationConfiguration: number;
|
|
76
|
+
readonly AutoModerationExecution: number;
|
|
77
|
+
readonly DirectMessagePolls: number;
|
|
78
|
+
readonly DirectMessageReactions: number;
|
|
79
|
+
readonly DirectMessages: number;
|
|
80
|
+
readonly DirectMessageTyping: number;
|
|
81
|
+
readonly GuildExpressions: number;
|
|
82
|
+
readonly GuildIntegrations: number;
|
|
83
|
+
readonly GuildInvites: number;
|
|
84
|
+
readonly GuildMembers: number;
|
|
85
|
+
readonly GuildMessagePolls: number;
|
|
86
|
+
readonly GuildMessageReactions: number;
|
|
87
|
+
readonly GuildMessages: number;
|
|
88
|
+
readonly GuildMessageTyping: number;
|
|
89
|
+
readonly GuildModeration: number;
|
|
90
|
+
readonly GuildPresences: number;
|
|
91
|
+
readonly Guilds: number;
|
|
92
|
+
readonly GuildScheduledEvents: number;
|
|
93
|
+
readonly GuildVoiceStates: number;
|
|
94
|
+
readonly GuildWebhooks: number;
|
|
95
|
+
readonly MessageContent: number;
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/types.d.ts
|
|
99
|
+
interface ClientActivity {
|
|
100
|
+
name: string;
|
|
101
|
+
state?: string;
|
|
102
|
+
type: ActivityType$1;
|
|
103
|
+
url?: string;
|
|
104
|
+
}
|
|
105
|
+
type ClientEvents = {
|
|
106
|
+
debug: [message: string];
|
|
107
|
+
disconnect: [];
|
|
108
|
+
error: [error: any];
|
|
109
|
+
messageCreate: [message: Message];
|
|
110
|
+
ready: [readyClient: Client<true>];
|
|
111
|
+
};
|
|
112
|
+
type ClientIntent = (typeof ClientIntents)[keyof typeof ClientIntents];
|
|
113
|
+
interface ClientOptions {
|
|
114
|
+
token: string;
|
|
115
|
+
intents: ClientIntent[];
|
|
116
|
+
presence?: ClientPresence;
|
|
117
|
+
}
|
|
118
|
+
interface ClientPresence {
|
|
119
|
+
status: UserStatus;
|
|
120
|
+
activities?: ClientActivity[];
|
|
121
|
+
}
|
|
122
|
+
type CreateMessageProps = CreateMessagePropsObject | string;
|
|
123
|
+
interface CreateMessagePropsObject {
|
|
124
|
+
content?: string;
|
|
125
|
+
nonce?: string | number;
|
|
126
|
+
tts?: boolean;
|
|
127
|
+
embeds?: APIEmbed[];
|
|
128
|
+
allowedMentions?: APIAllowedMentions;
|
|
129
|
+
messageReference?: APIMessageReference;
|
|
130
|
+
components?: APIMessageComponent[];
|
|
131
|
+
stickerIds?: string[];
|
|
132
|
+
attachments?: {
|
|
133
|
+
id?: string;
|
|
134
|
+
filename: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
}[];
|
|
137
|
+
flags?: number;
|
|
138
|
+
enforceNonce?: boolean;
|
|
139
|
+
}
|
|
140
|
+
type If<Condition extends boolean, True, False = null> = Condition extends true ? True : False;
|
|
141
|
+
type UserStatus = "online" | "idle" | "dnd" | "offline";
|
|
142
|
+
//#endregion
|
|
143
|
+
export { ActivityType, Channel, ChannelType, Client, ClientActivity, ClientEvents, ClientIntent, ClientIntents, ClientOptions, ClientPresence, CreateMessageProps, CreateMessagePropsObject, EventHandler, GatewayDispatchEvents, If, Message, User, UserStatus, handleClientEvent };
|