@satorijs/adapter-discord 3.7.0 → 3.8.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/lib/bot.d.ts +7 -2
- package/lib/index.d.ts +8 -3
- package/lib/index.js +1171 -968
- package/lib/index.js.map +4 -4
- package/lib/message.d.ts +1 -0
- package/lib/types/channel.d.ts +2 -2
- package/lib/types/gateway.d.ts +268 -264
- package/lib/types/guild-member.d.ts +2 -2
- package/lib/types/index.d.ts +2 -1
- package/lib/types/interaction.d.ts +96 -89
- package/lib/utils.d.ts +10 -7
- package/package.json +2 -2
package/lib/bot.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Bot, Context, Fragment, Quester, Schema, Universal } from '@satorijs/satori';
|
|
1
|
+
import { Bot, Context, Fragment, Quester, Schema, SendOptions, Universal } from '@satorijs/satori';
|
|
2
|
+
import * as Discord from './utils';
|
|
2
3
|
import { DiscordMessageEncoder } from './message';
|
|
3
4
|
import { Internal, Webhook } from './types';
|
|
4
5
|
import { WsClient } from './ws';
|
|
@@ -8,9 +9,11 @@ export declare class DiscordBot extends Bot<DiscordBot.Config> {
|
|
|
8
9
|
internal: Internal;
|
|
9
10
|
webhooks: Record<string, Webhook>;
|
|
10
11
|
webhookLock: Record<string, Promise<Webhook>>;
|
|
12
|
+
commands: Universal.Command[];
|
|
11
13
|
constructor(ctx: Context, config: DiscordBot.Config);
|
|
14
|
+
session(payload?: {}): import("@satorijs/core").Session;
|
|
12
15
|
private _ensureWebhook;
|
|
13
|
-
ensureWebhook(channelId: string): Promise<Webhook>;
|
|
16
|
+
ensureWebhook(channelId: string): Promise<Discord.Webhook>;
|
|
14
17
|
getSelf(): Promise<Universal.User>;
|
|
15
18
|
deleteMessage(channelId: string, messageId: string): Promise<void>;
|
|
16
19
|
editMessage(channelId: string, messageId: string, content: Fragment): Promise<void>;
|
|
@@ -41,6 +44,8 @@ export declare class DiscordBot extends Bot<DiscordBot.Config> {
|
|
|
41
44
|
createGuildRole(guildId: string, data: Partial<Universal.Role>): Promise<Universal.Role>;
|
|
42
45
|
modifyGuildRole(guildId: string, roleId: string, data: Partial<Universal.Role>): Promise<void>;
|
|
43
46
|
deleteGuildRole(guildId: string, roleId: string): Promise<void>;
|
|
47
|
+
sendPrivateMessage(userId: string, content: Fragment, options?: SendOptions): Promise<string[]>;
|
|
48
|
+
updateCommands(commands: Universal.Command[]): Promise<void>;
|
|
44
49
|
}
|
|
45
50
|
export declare namespace DiscordBot {
|
|
46
51
|
interface Config extends Bot.Config, Quester.Config, DiscordMessageEncoder.Config, WsClient.Config {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { DiscordBot } from './bot';
|
|
2
|
-
import * as Discord from './
|
|
2
|
+
import * as Discord from './utils';
|
|
3
3
|
export { Discord };
|
|
4
4
|
export * from './bot';
|
|
5
5
|
export * from './message';
|
|
6
|
-
export * from './utils';
|
|
7
6
|
export * from './ws';
|
|
8
7
|
export default DiscordBot;
|
|
8
|
+
type ParamCase<S extends string> = S extends `${infer L}${infer R}` ? `${L extends '_' ? '-' : Lowercase<L>}${ParamCase<R>}` : S;
|
|
9
|
+
type DiscordEvents = {
|
|
10
|
+
[T in keyof Discord.GatewayEvents as `discord/${ParamCase<T>}`]: (input: Discord.GatewayEvents[T]) => void;
|
|
11
|
+
};
|
|
9
12
|
declare module '@satorijs/core' {
|
|
10
13
|
interface Session {
|
|
11
|
-
discord?: Discord.
|
|
14
|
+
discord?: Discord.Gateway.Payload & Discord.Internal;
|
|
15
|
+
}
|
|
16
|
+
interface Events extends DiscordEvents {
|
|
12
17
|
}
|
|
13
18
|
}
|