alemonjs 1.0.1 → 1.0.2
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/alemon/apps.js +1 -1
- package/lib/alemon/dealmsg.js +2 -2
- package/lib/alemon/dialogue.js +1 -1
- package/lib/alemon/plugin.js +3 -0
- package/lib/alemon/screenshot.js +6 -2
- package/lib/alemon/typings.js +3 -0
- package/lib/{main.js → bot.js} +0 -8
- package/lib/index.js +12 -6
- package/lib/login.js +3 -0
- package/lib/types.js +5 -0
- package/package.json +2 -2
- package/types/alemon/apps.d.ts +1 -1
- package/types/alemon/dealmsg.d.ts +1 -1
- package/types/alemon/plugin.d.ts +9 -0
- package/types/alemon/typings.d.ts +6 -0
- package/types/index.d.ts +2 -5
- package/types/types.d.ts +61 -11
- /package/types/{main.d.ts → bot.d.ts} +0 -0
package/lib/alemon/apps.js
CHANGED
package/lib/alemon/dealmsg.js
CHANGED
|
@@ -25,7 +25,7 @@ const plugins = {};
|
|
|
25
25
|
/**
|
|
26
26
|
* 默认执行地址
|
|
27
27
|
*/
|
|
28
|
-
const route = '/
|
|
28
|
+
const route = '/public/defset';
|
|
29
29
|
/**
|
|
30
30
|
* 执行文件
|
|
31
31
|
*/
|
|
@@ -36,7 +36,7 @@ let addressMenu = join(process.cwd(), route);
|
|
|
36
36
|
let mergedRegex;
|
|
37
37
|
/**
|
|
38
38
|
* 设置指令json地址
|
|
39
|
-
* @param rt '/
|
|
39
|
+
* @param rt '/public/defset'
|
|
40
40
|
*/
|
|
41
41
|
export function setAppsHelp(rt = route) {
|
|
42
42
|
addressMenu = join(process.cwd(), rt);
|
package/lib/alemon/dialogue.js
CHANGED
package/lib/alemon/plugin.js
CHANGED
package/lib/alemon/screenshot.js
CHANGED
|
@@ -59,14 +59,18 @@ export function createStr(Options) {
|
|
|
59
59
|
* 插件路径
|
|
60
60
|
*/
|
|
61
61
|
const basePath = join(process.cwd(), appDir, AppName);
|
|
62
|
+
/**
|
|
63
|
+
* 数据路径
|
|
64
|
+
*/
|
|
65
|
+
const dataPath = join(process.cwd(), '.data', AppName);
|
|
62
66
|
/**
|
|
63
67
|
* 写入地址
|
|
64
68
|
*/
|
|
65
|
-
const AdressHtml = join(
|
|
69
|
+
const AdressHtml = join(dataPath, basename(tplFile));
|
|
66
70
|
/**
|
|
67
71
|
* 确保写入目录存在
|
|
68
72
|
*/
|
|
69
|
-
mkdirSync(
|
|
73
|
+
mkdirSync(dataPath, { recursive: true });
|
|
70
74
|
/**
|
|
71
75
|
* 判断初始模板是否改变
|
|
72
76
|
*/
|
package/lib/alemon/typings.js
CHANGED
package/lib/{main.js → bot.js}
RENAMED
|
@@ -96,11 +96,3 @@ export async function createBot(val = {
|
|
|
96
96
|
export { getBotConfigByKey, setBotConfigByKey } from './login.js';
|
|
97
97
|
// 设置独立鉴权路径
|
|
98
98
|
export const setAuthenticationByNtqq = ClientAPIByQQ.setAuthentication;
|
|
99
|
-
// 监听退出
|
|
100
|
-
process.on('SIGINT', signals => {
|
|
101
|
-
console.info(signals);
|
|
102
|
-
if (process.pid) {
|
|
103
|
-
process.exit();
|
|
104
|
-
}
|
|
105
|
-
return;
|
|
106
|
-
});
|
package/lib/index.js
CHANGED
|
@@ -2,11 +2,17 @@ if (process.argv.slice(2).includes('discord') &&
|
|
|
2
2
|
!process.argv.slice(2).includes('not')) {
|
|
3
3
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
4
4
|
}
|
|
5
|
-
//
|
|
6
|
-
export
|
|
5
|
+
// 导出编译工具
|
|
6
|
+
export { compilationTools, integration } from 'alemon-rollup';
|
|
7
7
|
// 导出核心方法
|
|
8
8
|
export * from './alemon/index.js';
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// 导出机器人
|
|
10
|
+
export * from './bot.js';
|
|
11
|
+
// 监听退出
|
|
12
|
+
process.on('SIGINT', signals => {
|
|
13
|
+
console.info(signals);
|
|
14
|
+
if (process.pid) {
|
|
15
|
+
process.exit();
|
|
16
|
+
}
|
|
17
|
+
return;
|
|
18
|
+
});
|
package/lib/login.js
CHANGED
package/lib/types.js
CHANGED
package/package.json
CHANGED
package/types/alemon/apps.d.ts
CHANGED
package/types/alemon/plugin.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { EventEnum, EventType } from './typings.js';
|
|
2
|
+
/**
|
|
3
|
+
* 插件类型
|
|
4
|
+
*/
|
|
2
5
|
export interface PluginInitType {
|
|
3
6
|
event?: (typeof EventEnum)[number];
|
|
4
7
|
eventType?: (typeof EventType)[number];
|
|
@@ -7,6 +10,9 @@ export interface PluginInitType {
|
|
|
7
10
|
dsc?: string;
|
|
8
11
|
rule?: PluginRuleType[];
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* 插件类型
|
|
15
|
+
*/
|
|
10
16
|
export interface PluginRuleType {
|
|
11
17
|
/**
|
|
12
18
|
* 正则
|
|
@@ -29,6 +35,9 @@ export interface PluginRuleType {
|
|
|
29
35
|
*/
|
|
30
36
|
priority?: number;
|
|
31
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* 插件模板
|
|
40
|
+
*/
|
|
32
41
|
export declare class plugin {
|
|
33
42
|
/**
|
|
34
43
|
* 模块名
|
|
@@ -517,7 +517,13 @@ export interface MuteController {
|
|
|
517
517
|
*/
|
|
518
518
|
muteMembers?: (...args: any[]) => any;
|
|
519
519
|
}
|
|
520
|
+
/**
|
|
521
|
+
* 卡片枚举
|
|
522
|
+
*/
|
|
520
523
|
export declare const CacrdEnum: readonly ["qq_embed", "qq_ark", "kook_card"];
|
|
524
|
+
/**
|
|
525
|
+
* 卡片类型
|
|
526
|
+
*/
|
|
521
527
|
export interface CardType {
|
|
522
528
|
type: (typeof CacrdEnum)[number];
|
|
523
529
|
card: any;
|
package/types/index.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { GatewayIntentBits } from 'discord.js';
|
|
2
2
|
import { AvailableIntentsEventsEnum } from 'qq-guild-bot';
|
|
3
|
+
/**
|
|
4
|
+
* ****
|
|
5
|
+
* config
|
|
6
|
+
* /////
|
|
7
|
+
*/
|
|
8
|
+
export interface ConfigType {
|
|
9
|
+
redis?: RedisConfig;
|
|
10
|
+
mysql?: MysqlConfig;
|
|
11
|
+
discord?: DiscordConfig;
|
|
12
|
+
kook?: KookConfig;
|
|
13
|
+
villa?: VillaConfig;
|
|
14
|
+
qq?: QQConfig;
|
|
15
|
+
server?: ServerConfig;
|
|
16
|
+
puppeteer?: PuppeteerConfig;
|
|
17
|
+
ntqq?: NtQQConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* ****
|
|
21
|
+
* redis
|
|
22
|
+
* *****
|
|
23
|
+
*/
|
|
3
24
|
export interface RedisConfig {
|
|
4
25
|
host: string;
|
|
5
26
|
port: number;
|
|
6
27
|
password: string;
|
|
7
28
|
db: number;
|
|
8
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* ***
|
|
32
|
+
* mysql
|
|
33
|
+
* **
|
|
34
|
+
*/
|
|
9
35
|
export interface MysqlConfig {
|
|
10
36
|
host: string;
|
|
11
37
|
port: number;
|
|
@@ -13,17 +39,32 @@ export interface MysqlConfig {
|
|
|
13
39
|
password: string;
|
|
14
40
|
database: string;
|
|
15
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* **
|
|
44
|
+
* discord
|
|
45
|
+
* **
|
|
46
|
+
*/
|
|
16
47
|
export interface DiscordConfig {
|
|
17
48
|
token: string;
|
|
18
49
|
masterID: string;
|
|
19
50
|
password: string;
|
|
20
51
|
intents: GatewayIntentBits[];
|
|
21
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* ****
|
|
55
|
+
* kook
|
|
56
|
+
* ***
|
|
57
|
+
*/
|
|
22
58
|
export interface KookConfig {
|
|
23
59
|
token: string;
|
|
24
60
|
masterID: string;
|
|
25
61
|
password: string;
|
|
26
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* ****
|
|
65
|
+
* villa
|
|
66
|
+
* *****
|
|
67
|
+
*/
|
|
27
68
|
export interface VillaConfig {
|
|
28
69
|
bot_id: string;
|
|
29
70
|
secret: string;
|
|
@@ -37,6 +78,11 @@ export interface VillaConfig {
|
|
|
37
78
|
img_url: string;
|
|
38
79
|
IMAGE_DIR: string;
|
|
39
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* *****
|
|
83
|
+
* ntqq
|
|
84
|
+
* ****
|
|
85
|
+
*/
|
|
40
86
|
export declare enum NtQQEventsEnum {
|
|
41
87
|
GROUP_AT_MESSAGE_CREATE = "GROUP_AT_MESSAGE_CREATE",
|
|
42
88
|
C2C_MESSAGE_CREATE = "C2C_MESSAGE_CREATE"
|
|
@@ -54,6 +100,11 @@ export interface NtQQConfig {
|
|
|
54
100
|
IMAGE_DIR: string;
|
|
55
101
|
http: string;
|
|
56
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* ******
|
|
105
|
+
* qq
|
|
106
|
+
* *****
|
|
107
|
+
*/
|
|
57
108
|
export interface QQConfig {
|
|
58
109
|
appID: string;
|
|
59
110
|
token: string;
|
|
@@ -63,23 +114,22 @@ export interface QQConfig {
|
|
|
63
114
|
isPrivate: boolean;
|
|
64
115
|
sandbox: boolean;
|
|
65
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* ******
|
|
119
|
+
* server
|
|
120
|
+
* *****
|
|
121
|
+
*/
|
|
66
122
|
export interface ServerConfig {
|
|
67
123
|
host: string;
|
|
68
124
|
port: number;
|
|
69
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* ********
|
|
128
|
+
* pup
|
|
129
|
+
* *******
|
|
130
|
+
*/
|
|
70
131
|
export interface PuppeteerConfig {
|
|
71
132
|
args: string[];
|
|
72
133
|
headless: 'new';
|
|
73
134
|
timeout: number;
|
|
74
135
|
}
|
|
75
|
-
export interface ConfigType {
|
|
76
|
-
redis?: RedisConfig;
|
|
77
|
-
mysql?: MysqlConfig;
|
|
78
|
-
discord?: DiscordConfig;
|
|
79
|
-
kook?: KookConfig;
|
|
80
|
-
villa?: VillaConfig;
|
|
81
|
-
qq?: QQConfig;
|
|
82
|
-
server?: ServerConfig;
|
|
83
|
-
puppeteer?: PuppeteerConfig;
|
|
84
|
-
ntqq?: NtQQConfig;
|
|
85
|
-
}
|
|
File without changes
|