@alemonjs/qq-bot 0.0.9 → 0.0.10
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/assets/index.css +476 -0
- package/dist/assets/index.js +11032 -0
- package/dist/index.html +15 -0
- package/lib/api.d.ts +971 -843
- package/lib/api.js +1172 -1156
- package/lib/client.d.ts +22 -22
- package/lib/client.js +201 -217
- package/lib/config.js +2 -2
- package/lib/desktop.d.ts +2 -2
- package/lib/desktop.js +60 -59
- package/lib/from.js +27 -34
- package/lib/index.d.ts +7 -7
- package/lib/index.js +406 -405
- package/lib/message/AT_MESSAGE_CREATE.d.ts +35 -35
- package/lib/message/C2C_MESSAGE_CREATE.d.ts +9 -9
- package/lib/message/CHANNEL_CREATE.d.ts +15 -15
- package/lib/message/CHANNEL_DELETE.d.ts +15 -15
- package/lib/message/CHANNEL_UPDATE.d.ts +15 -15
- package/lib/message/DIRECT_MESSAGE_CREATE.d.ts +29 -29
- package/lib/message/DIRECT_MESSAGE_DELETE.d.ts +17 -17
- package/lib/message/ERROR.d.ts +2 -2
- package/lib/message/GROUP_AT_MESSAGE_CREATE.d.ts +10 -10
- package/lib/message/GUILD_CREATE.d.ts +15 -15
- package/lib/message/GUILD_DELETE.d.ts +15 -15
- package/lib/message/GUILD_MEMBER_ADD.d.ts +14 -14
- package/lib/message/GUILD_MEMBER_REMOVE.d.ts +14 -14
- package/lib/message/GUILD_MEMBER_UPDATE.d.ts +14 -14
- package/lib/message/GUILD_UPDATE.d.ts +15 -15
- package/lib/message/INTERACTION_CREATE.d.ts +2 -2
- package/lib/message/MESSAGE_CREATE.d.ts +2 -2
- package/lib/message/MESSAGE_DELETE.d.ts +2 -2
- package/lib/message/MESSAGE_REACTION_ADD.d.ts +13 -13
- package/lib/message/MESSAGE_REACTION_REMOVE.d.ts +13 -13
- package/lib/message/PUBLIC_MESSAGE_DELETE.d.ts +15 -15
- package/lib/message/READY.d.ts +6 -6
- package/lib/message.d.ts +46 -46
- package/lib/send/index.js +230 -192
- package/lib/typing.d.ts +62 -54
- package/lib/webhook.js +46 -48
- package/package.json +1 -1
package/lib/from.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync, createReadStream } from 'fs'
|
|
2
|
-
import { Readable, isReadable } from 'stream'
|
|
3
|
-
import { basename } from 'path'
|
|
4
|
-
import { fileTypeFromBuffer, fileTypeFromStream } from 'file-type'
|
|
1
|
+
import { existsSync, createReadStream } from 'fs'
|
|
2
|
+
import { Readable, isReadable } from 'stream'
|
|
3
|
+
import { basename } from 'path'
|
|
4
|
+
import { fileTypeFromBuffer, fileTypeFromStream } from 'file-type'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 创建form
|
|
@@ -10,35 +10,28 @@ import { fileTypeFromBuffer, fileTypeFromStream } from 'file-type';
|
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
12
|
async function createPicFrom(image, name = 'image.jpg') {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
name = 'file.' + file?.ext;
|
|
36
|
-
picData = image;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return { picData, image, name };
|
|
13
|
+
let picData
|
|
14
|
+
// 是 string
|
|
15
|
+
if (typeof image === 'string') {
|
|
16
|
+
if (!existsSync(image)) return false
|
|
17
|
+
if (!name) name = basename(image)
|
|
18
|
+
picData = createReadStream(image)
|
|
19
|
+
// 是 buffer
|
|
20
|
+
} else if (Buffer.isBuffer(image)) {
|
|
21
|
+
const file = await fileTypeFromBuffer(image)
|
|
22
|
+
if (!name) name = 'file.' + file?.ext
|
|
23
|
+
picData = new Readable()
|
|
24
|
+
picData.push(image)
|
|
25
|
+
picData.push(null)
|
|
26
|
+
// 是 文件流
|
|
27
|
+
} else if (isReadable(image)) {
|
|
28
|
+
const file = await fileTypeFromStream(image)
|
|
29
|
+
if (!name) name = 'file.' + file?.ext
|
|
30
|
+
picData = image
|
|
31
|
+
} else {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
return { picData, image, name }
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
export { createPicFrom }
|
|
37
|
+
export { createPicFrom }
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as alemonjs from 'alemonjs'
|
|
2
|
-
import { QQBotClient } from './client.js'
|
|
1
|
+
import * as alemonjs from 'alemonjs'
|
|
2
|
+
import { QQBotClient } from './client.js'
|
|
3
3
|
|
|
4
|
-
type Client = typeof QQBotClient.prototype
|
|
5
|
-
declare const client: Client
|
|
6
|
-
declare const platform =
|
|
7
|
-
declare const _default: () => alemonjs.ClientAPI
|
|
4
|
+
type Client = typeof QQBotClient.prototype
|
|
5
|
+
declare const client: Client
|
|
6
|
+
declare const platform = 'qq-bot'
|
|
7
|
+
declare const _default: () => alemonjs.ClientAPI
|
|
8
8
|
|
|
9
|
-
export { type Client, client, _default as default, platform }
|
|
9
|
+
export { type Client, client, _default as default, platform }
|