@satorijs/adapter-discord 3.2.7 → 3.3.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/lib/bot.d.ts +17 -17
- package/lib/index.d.ts +1 -1
- package/lib/index.js +164 -184
- package/lib/index.js.map +4 -4
- package/lib/{sender.d.ts → message.d.ts} +6 -13
- package/lib/utils.d.ts +7 -7
- package/package.json +2 -2
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import { Dict, Schema, segment } from '@satorijs/satori';
|
|
1
|
+
import { Dict, Messenger, Schema, segment } from '@satorijs/satori';
|
|
2
2
|
import { DiscordBot } from './bot';
|
|
3
|
-
export declare class
|
|
4
|
-
private bot;
|
|
5
|
-
private url;
|
|
6
|
-
private results;
|
|
7
|
-
private errors;
|
|
3
|
+
export declare class DiscordMessenger extends Messenger<DiscordBot> {
|
|
8
4
|
private buffer;
|
|
9
5
|
private addition;
|
|
10
6
|
private figure;
|
|
11
7
|
private mode;
|
|
12
|
-
constructor(bot: DiscordBot, url: string);
|
|
13
8
|
post(data?: any, headers?: any): Promise<void>;
|
|
14
9
|
sendEmbed(fileBuffer: ArrayBuffer, payload_json: Dict, filename: string): Promise<void>;
|
|
15
10
|
sendContent(content: string, addition: Dict): Promise<void>;
|
|
16
11
|
sendAsset(type: string, data: Dict<string>, addition: Dict): Promise<void>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sendMessage(elements: segment[]): Promise<void>;
|
|
20
|
-
send(content: string): Promise<string[]>;
|
|
12
|
+
flush(): Promise<void>;
|
|
13
|
+
visit(element: segment): Promise<void>;
|
|
21
14
|
}
|
|
22
|
-
export declare namespace
|
|
15
|
+
export declare namespace DiscordMessenger {
|
|
23
16
|
type HandleExternalAsset = 'auto' | 'download' | 'direct';
|
|
24
17
|
type HandleMixedContent = 'auto' | 'separate' | 'attach';
|
|
25
18
|
interface Config {
|
|
@@ -38,5 +31,5 @@ export declare namespace Sender {
|
|
|
38
31
|
*/
|
|
39
32
|
handleMixedContent?: HandleMixedContent;
|
|
40
33
|
}
|
|
41
|
-
const Config: Schema<
|
|
34
|
+
const Config: Schema<DiscordMessenger.Config>;
|
|
42
35
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Session, Universal } from '@satorijs/satori';
|
|
2
2
|
import { DiscordBot } from './bot';
|
|
3
3
|
import * as Discord from './types';
|
|
4
|
-
export declare const adaptUser: (user: Discord.User) => User;
|
|
5
|
-
export declare const adaptGuild: (data: Discord.Guild) => Guild;
|
|
6
|
-
export declare const adaptChannel: (data: Discord.Channel) => Channel;
|
|
7
|
-
export declare const adaptAuthor: (author: Discord.User) => Author;
|
|
8
|
-
export declare function adaptMessage(bot: DiscordBot, meta: Discord.Message, session?: Partial<Session>): Promise<Message>;
|
|
4
|
+
export declare const adaptUser: (user: Discord.User) => Universal.User;
|
|
5
|
+
export declare const adaptGuild: (data: Discord.Guild) => Universal.Guild;
|
|
6
|
+
export declare const adaptChannel: (data: Discord.Channel) => Universal.Channel;
|
|
7
|
+
export declare const adaptAuthor: (author: Discord.User) => Universal.Author;
|
|
8
|
+
export declare function adaptMessage(bot: DiscordBot, meta: Discord.Message, session?: Partial<Session>): Promise<Universal.Message>;
|
|
9
9
|
export declare function prepareMessage(session: Partial<Session>, data: Partial<Discord.Message>): void;
|
|
10
|
-
export declare function adaptSession(bot: DiscordBot, input: Discord.GatewayPayload): Promise<Session
|
|
10
|
+
export declare function adaptSession(bot: DiscordBot, input: Discord.GatewayPayload): Promise<Session>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@satorijs/adapter-discord",
|
|
3
3
|
"description": "Discord Adapter for Satorijs",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.1",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"satori"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@satorijs/satori": "^1.
|
|
32
|
+
"@satorijs/satori": "^1.3.5"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"file-type": "^16.5.4",
|