@alemonjs/discord 2.1.0-alpha.4 → 2.1.0-alpha.6

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.
@@ -1,46 +0,0 @@
1
- /**
2
- * 基础配置结构
3
- */
4
- class BaseConfig {
5
- #data = null;
6
- constructor(val) {
7
- this.#data = val;
8
- }
9
- /**
10
- * 设置配置
11
- * @param key
12
- * @param val
13
- */
14
- set(key, val) {
15
- if (val !== undefined)
16
- this.#data[key] = val;
17
- return this;
18
- }
19
- /**
20
- *
21
- * @param key
22
- * @returns
23
- */
24
- has(key) {
25
- if (Object.prototype.hasOwnProperty.call(this.#data, key)) ;
26
- return false;
27
- }
28
- /**
29
- * 读取配置
30
- * @param key
31
- * @returns
32
- */
33
- all() {
34
- return this.#data;
35
- }
36
- /**
37
- * 读取配置
38
- * @param key
39
- * @returns
40
- */
41
- get(key) {
42
- return this.#data[key];
43
- }
44
- }
45
-
46
- export { BaseConfig };
@@ -1,42 +0,0 @@
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
-
6
- /**
7
- * 创建form
8
- * @param image
9
- * @param name
10
- * @returns
11
- */
12
- async function createPicFrom(image, name = 'image.jpg') {
13
- let picData;
14
- // 是 string
15
- if (typeof image === 'string') {
16
- if (!existsSync(image))
17
- return false;
18
- if (!name)
19
- name = basename(image);
20
- picData = createReadStream(image);
21
- // 是 buffer
22
- }
23
- else if (Buffer.isBuffer(image)) {
24
- if (!name)
25
- name = 'file.' + (await fileTypeFromBuffer(image)).ext;
26
- picData = new Readable();
27
- picData.push(image);
28
- picData.push(null);
29
- // 是 文件流
30
- }
31
- else if (isReadable(image)) {
32
- if (!name)
33
- name = 'file.' + (await fileTypeFromStream(image)).ext;
34
- picData = image;
35
- }
36
- else {
37
- return false;
38
- }
39
- return { picData, image, name };
40
- }
41
-
42
- export { createPicFrom };
package/lib/sdk/types.js DELETED
@@ -1,25 +0,0 @@
1
- const AvailableIntentsEventsEnum = [
2
- 'GUILDS',
3
- 'GUILD_MEMBERS',
4
- 'GUILD_MODERATION',
5
- 'GUILD_EXPRESSIONS',
6
- 'GUILD_INTEGRATIONS',
7
- 'GUILD_WEBHOOKS',
8
- 'GUILD_INVITES',
9
- 'GUILD_VOICE_STATES',
10
- 'GUILD_PRESENCES',
11
- 'GUILD_MESSAGES',
12
- 'GUILD_MESSAGE_REACTIONS',
13
- 'GUILD_MESSAGE_TYPING',
14
- 'DIRECT_MESSAGES',
15
- 'DIRECT_MESSAGE_REACTIONS',
16
- 'DIRECT_MESSAGE_TYPING',
17
- 'MESSAGE_CONTENT',
18
- 'GUILD_SCHEDULED_EVENTS',
19
- 'AUTO_MODERATION_CONFIGURATION',
20
- 'AUTO_MODERATION_EXECUTION',
21
- 'GUILD_MESSAGE_POLLS',
22
- 'DIRECT_MESSAGE_POLLS'
23
- ];
24
-
25
- export { AvailableIntentsEventsEnum };