@kotori-bot/core 1.7.1 → 1.7.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/app/common.d.ts +6 -0
- package/lib/app/common.js +2 -2
- package/lib/app/config.d.ts +32 -0
- package/lib/app/config.js +2 -2
- package/lib/app/core.d.ts +139 -0
- package/lib/app/core.js +5 -5
- package/lib/app/index.d.ts +3 -0
- package/lib/app/index.js +2 -2
- package/lib/app/message.d.ts +34 -0
- package/lib/app/message.js +7 -7
- package/lib/components/adapter.d.ts +122 -0
- package/lib/components/adapter.js +2 -2
- package/lib/components/api.d.ts +420 -0
- package/lib/components/api.js +4 -4
- package/lib/components/cache.d.ts +37 -0
- package/lib/components/cache.js +3 -3
- package/lib/components/command.d.ts +153 -0
- package/lib/components/command.js +2 -2
- package/lib/components/elements.d.ts +144 -0
- package/lib/components/elements.js +4 -4
- package/lib/components/filter.d.ts +22 -0
- package/lib/components/filter.js +2 -2
- package/lib/components/index.d.ts +8 -0
- package/lib/components/index.js +2 -2
- package/lib/components/messages.d.ts +186 -0
- package/lib/components/messages.js +2 -2
- package/lib/components/session.d.ts +177 -0
- package/lib/components/session.js +2 -2
- package/lib/decorators/index.d.ts +7 -0
- package/lib/decorators/index.js +2 -2
- package/lib/decorators/plugin.d.ts +7 -0
- package/lib/decorators/plugin.js +2 -2
- package/lib/decorators/utils.d.ts +60 -0
- package/lib/decorators/utils.js +5 -5
- package/lib/global/constants.d.ts +8 -0
- package/lib/global/constants.js +2 -2
- package/lib/global/index.d.ts +2 -0
- package/lib/global/index.js +2 -2
- package/lib/global/symbols.d.ts +15 -0
- package/lib/global/symbols.js +2 -2
- package/lib/index.d.ts +13 -0
- package/lib/index.js +16 -16
- package/lib/types/adapter.d.ts +22 -0
- package/lib/types/adapter.js +2 -2
- package/lib/types/api.d.ts +71 -0
- package/lib/types/api.js +2 -2
- package/lib/types/command.d.ts +78 -0
- package/lib/types/command.js +2 -2
- package/lib/types/config.d.ts +21 -0
- package/lib/types/config.js +2 -2
- package/lib/types/events.d.ts +3 -0
- package/lib/types/events.js +2 -2
- package/lib/types/filter.d.ts +51 -0
- package/lib/types/filter.js +2 -2
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.js +2 -2
- package/lib/types/message.d.ts +176 -0
- package/lib/types/message.js +2 -2
- package/lib/types/session.d.ts +349 -0
- package/lib/types/session.js +2 -2
- package/lib/utils/container.d.ts +9 -0
- package/lib/utils/container.js +2 -2
- package/lib/utils/error.d.ts +49 -0
- package/lib/utils/error.js +2 -2
- package/lib/utils/factory.d.ts +12 -0
- package/lib/utils/factory.js +2 -2
- package/lib/utils/internal.d.ts +46 -0
- package/lib/utils/internal.js +2 -2
- package/lib/utils/jsx.d.ts +57 -0
- package/lib/utils/jsx.js +5 -4
- package/package.json +3 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { type EventsList, type ModuleConfig } from 'fluoro';
|
|
3
|
+
import { type Constructor, Parser } from 'tsukiko';
|
|
4
|
+
import type { Context } from '../app';
|
|
5
|
+
import { Symbols } from '../global';
|
|
6
|
+
import type { CommandConfig } from '../types';
|
|
7
|
+
import type { KotoriPlugin } from './plugin';
|
|
8
|
+
declare module '../types/events' {
|
|
9
|
+
interface EventsMapping {
|
|
10
|
+
literal_ready_module_decorator(name: string, config: ModuleConfig): void;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
interface EventOption {
|
|
14
|
+
type: keyof EventsList;
|
|
15
|
+
isOnce?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface CommandOption extends Omit<CommandConfig, 'action'> {
|
|
18
|
+
template: string;
|
|
19
|
+
options?: [string, string][];
|
|
20
|
+
}
|
|
21
|
+
interface MidwareOption {
|
|
22
|
+
priority?: number;
|
|
23
|
+
}
|
|
24
|
+
interface RegexpOption {
|
|
25
|
+
match: RegExp;
|
|
26
|
+
}
|
|
27
|
+
type TaskOption = Exclude<Parameters<Context['task']>[0], string>;
|
|
28
|
+
type Fn = (...args: any[]) => any;
|
|
29
|
+
interface PluginMetaAll {
|
|
30
|
+
name: string;
|
|
31
|
+
lang?: string;
|
|
32
|
+
inject: string[];
|
|
33
|
+
schema?: Parser<object>;
|
|
34
|
+
events: [Fn, EventOption, boolean][];
|
|
35
|
+
midwares: [Fn, MidwareOption, boolean][];
|
|
36
|
+
commands: [Fn, CommandOption, boolean][];
|
|
37
|
+
regexps: [Fn, RegexpOption, boolean][];
|
|
38
|
+
tasks: [Fn, TaskOption, boolean][];
|
|
39
|
+
}
|
|
40
|
+
type KotoriPluginChild = new (...args: ConstructorParameters<typeof KotoriPlugin>) => KotoriPlugin;
|
|
41
|
+
export declare class Decorators {
|
|
42
|
+
static [Symbols.decorator]: Map<string, KotoriPluginChild>;
|
|
43
|
+
static getMeta(target: object | string): PluginMetaAll | undefined;
|
|
44
|
+
static setup(ctx: Context): void;
|
|
45
|
+
static load(ctx: Context, target: string | Constructor, config: ModuleConfig): boolean;
|
|
46
|
+
private readonly pkgName;
|
|
47
|
+
private error;
|
|
48
|
+
private getMeta;
|
|
49
|
+
constructor(pkgName: string);
|
|
50
|
+
readonly import: (target: object) => void;
|
|
51
|
+
readonly lang: <T extends object>(target: T, name: keyof T) => void;
|
|
52
|
+
readonly inject: <T extends object>(target: T, name: keyof T) => void;
|
|
53
|
+
readonly schema: <T extends object>(target: T, name: keyof T) => void;
|
|
54
|
+
on(options: EventOption): <T extends object>(target: T, key: keyof T) => void;
|
|
55
|
+
midware(options?: MidwareOption): <T extends object>(target: T, key: keyof T) => void;
|
|
56
|
+
command(options: CommandOption): <T extends object>(target: T, key: keyof T) => void;
|
|
57
|
+
regexp(options: RegexpOption): <T extends object>(target: T, key: keyof T) => void;
|
|
58
|
+
task(options: TaskOption): <T extends object>(target: T, key: keyof T) => void;
|
|
59
|
+
}
|
|
60
|
+
export default Decorators;
|
package/lib/decorators/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __create = Object.create;
|
|
@@ -42,12 +42,12 @@ __export(utils_exports, {
|
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(utils_exports);
|
|
44
44
|
var import_reflect_metadata = require("reflect-metadata");
|
|
45
|
+
var import_node_path = require("node:path");
|
|
46
|
+
var import_fast_safe_stringify = __toESM(require("fast-safe-stringify"));
|
|
45
47
|
var import_fluoro = require("fluoro");
|
|
46
48
|
var import_tsukiko = __toESM(require("tsukiko"));
|
|
47
|
-
var import_error = require("../utils/error");
|
|
48
49
|
var import_global = require("../global");
|
|
49
|
-
var
|
|
50
|
-
var import_fast_safe_stringify = __toESM(require("fast-safe-stringify"));
|
|
50
|
+
var import_error = require("../utils/error");
|
|
51
51
|
class Decorators {
|
|
52
52
|
static [import_global.Symbols.decorator] = /* @__PURE__ */ new Map();
|
|
53
53
|
static getMeta(target) {
|
package/lib/global/constants.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
package/lib/global/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare namespace Symbols {
|
|
2
|
+
const adapter: unique symbol;
|
|
3
|
+
const bot: unique symbol;
|
|
4
|
+
const midware: unique symbol;
|
|
5
|
+
const command: unique symbol;
|
|
6
|
+
const regexp: unique symbol;
|
|
7
|
+
const task: unique symbol;
|
|
8
|
+
const filter: unique symbol;
|
|
9
|
+
const promise: unique symbol;
|
|
10
|
+
const decorator: unique symbol;
|
|
11
|
+
const modules: unique symbol;
|
|
12
|
+
const getInstance: unique symbol;
|
|
13
|
+
const setInstance: unique symbol;
|
|
14
|
+
}
|
|
15
|
+
export default Symbols;
|
package/lib/global/symbols.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export * from '@kotori-bot/i18n';
|
|
3
|
+
export * from '@kotori-bot/tools';
|
|
4
|
+
export * from 'tsukiko';
|
|
5
|
+
export * from './app';
|
|
6
|
+
export * from './components';
|
|
7
|
+
export * from './decorators';
|
|
8
|
+
export * from './global';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './utils/container';
|
|
11
|
+
export * from './utils/error';
|
|
12
|
+
export * from './utils/factory';
|
|
13
|
+
export * from './utils/jsx';
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -25,30 +25,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
var index_exports = {};
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
var import_reflect_metadata = require("reflect-metadata");
|
|
28
|
+
__reExport(index_exports, require("@kotori-bot/i18n"), module.exports);
|
|
29
|
+
__reExport(index_exports, require("@kotori-bot/tools"), module.exports);
|
|
30
|
+
__reExport(index_exports, require("tsukiko"), module.exports);
|
|
28
31
|
__reExport(index_exports, require("./app"), module.exports);
|
|
29
32
|
__reExport(index_exports, require("./components"), module.exports);
|
|
30
33
|
__reExport(index_exports, require("./decorators"), module.exports);
|
|
31
|
-
__reExport(index_exports, require("./utils/jsx"), module.exports);
|
|
32
|
-
__reExport(index_exports, require("./utils/error"), module.exports);
|
|
33
|
-
__reExport(index_exports, require("./utils/factory"), module.exports);
|
|
34
|
-
__reExport(index_exports, require("./utils/container"), module.exports);
|
|
35
34
|
__reExport(index_exports, require("./global"), module.exports);
|
|
36
35
|
__reExport(index_exports, require("./types"), module.exports);
|
|
37
|
-
__reExport(index_exports, require("
|
|
38
|
-
__reExport(index_exports, require("
|
|
39
|
-
__reExport(index_exports, require("
|
|
36
|
+
__reExport(index_exports, require("./utils/container"), module.exports);
|
|
37
|
+
__reExport(index_exports, require("./utils/error"), module.exports);
|
|
38
|
+
__reExport(index_exports, require("./utils/factory"), module.exports);
|
|
39
|
+
__reExport(index_exports, require("./utils/jsx"), module.exports);
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
|
+
...require("@kotori-bot/i18n"),
|
|
43
|
+
...require("@kotori-bot/tools"),
|
|
44
|
+
...require("tsukiko"),
|
|
42
45
|
...require("./app"),
|
|
43
46
|
...require("./components"),
|
|
44
47
|
...require("./decorators"),
|
|
45
|
-
...require("./utils/jsx"),
|
|
46
|
-
...require("./utils/error"),
|
|
47
|
-
...require("./utils/factory"),
|
|
48
|
-
...require("./utils/container"),
|
|
49
48
|
...require("./global"),
|
|
50
49
|
...require("./types"),
|
|
51
|
-
...require("
|
|
52
|
-
...require("
|
|
53
|
-
...require("
|
|
50
|
+
...require("./utils/container"),
|
|
51
|
+
...require("./utils/error"),
|
|
52
|
+
...require("./utils/factory"),
|
|
53
|
+
...require("./utils/jsx")
|
|
54
54
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Context } from '../app';
|
|
2
|
+
import type { Adapter } from '../components';
|
|
3
|
+
import type { AdapterConfig } from './config';
|
|
4
|
+
declare module './events' {
|
|
5
|
+
interface EventsMapping {
|
|
6
|
+
connect(data: EventDataConnect): void;
|
|
7
|
+
status(data: EventDataStatus): void;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface EventDataConnect {
|
|
11
|
+
adapter: Adapter;
|
|
12
|
+
type: 'connect' | 'disconnect';
|
|
13
|
+
normal: boolean;
|
|
14
|
+
mode: 'ws' | 'ws-reverse' | 'other';
|
|
15
|
+
address: string;
|
|
16
|
+
}
|
|
17
|
+
interface EventDataStatus {
|
|
18
|
+
adapter: Adapter;
|
|
19
|
+
status: Adapter['status']['value'];
|
|
20
|
+
}
|
|
21
|
+
export type AdapterClass = new (ctx: Context, config: AdapterConfig, identity: string) => Adapter;
|
|
22
|
+
export {};
|
package/lib/types/adapter.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Response for sending message */
|
|
2
|
+
export interface SendMessageResponse {
|
|
3
|
+
/** Message id */
|
|
4
|
+
messageId: string;
|
|
5
|
+
/** Send time (milliseconds timestamp) */
|
|
6
|
+
time: number;
|
|
7
|
+
}
|
|
8
|
+
/** Response for bot self information */
|
|
9
|
+
export interface SelfInfoResponse {
|
|
10
|
+
/** User id */
|
|
11
|
+
userId: string;
|
|
12
|
+
/** User name or nickname */
|
|
13
|
+
username: string;
|
|
14
|
+
/** The display name, or empty string if none */
|
|
15
|
+
userDisplayname: string;
|
|
16
|
+
}
|
|
17
|
+
/** Response for user information */
|
|
18
|
+
export interface UserInfoResponse extends SelfInfoResponse {
|
|
19
|
+
/** The remark name set set by current bot account, or empty string if none */
|
|
20
|
+
userRemark: string;
|
|
21
|
+
}
|
|
22
|
+
/** Response for group information */
|
|
23
|
+
export interface GroupInfoResponse {
|
|
24
|
+
/** Group id */
|
|
25
|
+
groupId: string;
|
|
26
|
+
/** Group name */
|
|
27
|
+
groupName: string;
|
|
28
|
+
}
|
|
29
|
+
/** Response for guild information */
|
|
30
|
+
export interface GuildInfoResponse {
|
|
31
|
+
/** Guild id */
|
|
32
|
+
guildId: string;
|
|
33
|
+
/** Guild name */
|
|
34
|
+
guildName: string;
|
|
35
|
+
}
|
|
36
|
+
/** Response for channel information */
|
|
37
|
+
export interface ChannelInfoResponse {
|
|
38
|
+
/** Channel id */
|
|
39
|
+
channelId: string;
|
|
40
|
+
/** Channel name */
|
|
41
|
+
channelName: string;
|
|
42
|
+
}
|
|
43
|
+
/** Response for file upload */
|
|
44
|
+
export interface UploadFileResponse {
|
|
45
|
+
/** File id */
|
|
46
|
+
filedId: string;
|
|
47
|
+
}
|
|
48
|
+
/** Response for file get */
|
|
49
|
+
export interface GetFileResponse {
|
|
50
|
+
/** File name */
|
|
51
|
+
name: string;
|
|
52
|
+
/** File data (origin binary)'s SHA256 checksum, all lowercase, optional */
|
|
53
|
+
sha256?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Response for file get url */
|
|
56
|
+
export interface GetFileUrlResponse extends GetFileResponse {
|
|
57
|
+
/** File url */
|
|
58
|
+
url: string;
|
|
59
|
+
/** File download url headers, or empty object if none */
|
|
60
|
+
headers: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
/** Response for file get path */
|
|
63
|
+
export interface GetFilePathResponse extends GetFileResponse {
|
|
64
|
+
/** File path */
|
|
65
|
+
path: string;
|
|
66
|
+
}
|
|
67
|
+
/** Response for file get data */
|
|
68
|
+
export interface GetFileDataResponse extends GetFileResponse {
|
|
69
|
+
/** File data */
|
|
70
|
+
data: Buffer;
|
|
71
|
+
}
|
package/lib/types/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Tsu from 'tsukiko';
|
|
2
|
+
import type { TsuError } from 'tsukiko';
|
|
3
|
+
import type { MessageQuick, MessageScope, UserAccess } from './message';
|
|
4
|
+
import type { SessionMsg, SessionMsgChannel, SessionMsgGroup, SessionMsgPrivate } from '../components';
|
|
5
|
+
export type ArgsOrigin = CommandArgType[];
|
|
6
|
+
export type OptsOrigin = Record<string, CommandArgType>;
|
|
7
|
+
export type CommandAction<Args = ArgsOrigin, Opts = OptsOrigin, Scope = 'all'> = (data: {
|
|
8
|
+
args: Args;
|
|
9
|
+
options: Opts;
|
|
10
|
+
}, session: Scope extends MessageScope.PRIVATE ? SessionMsgPrivate : Scope extends MessageScope.GROUP ? SessionMsgGroup : Scope extends MessageScope.CHANNEL ? SessionMsgChannel : SessionMsg) => MessageQuick;
|
|
11
|
+
export type CommandArgType = string | number | boolean;
|
|
12
|
+
export declare const commandArgTypeSignSchema: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"string">, import("tsukiko").LiteralParser<"number">, import("tsukiko").LiteralParser<"boolean">]>;
|
|
13
|
+
export type CommandArgTypeSign = Tsu.infer<typeof commandArgTypeSignSchema>;
|
|
14
|
+
/** Command instance config */
|
|
15
|
+
export interface CommandConfig {
|
|
16
|
+
/** Command alias (need bring command prefix) */
|
|
17
|
+
alias?: string[];
|
|
18
|
+
/** Command shortcut (needn't bring command prefix) */
|
|
19
|
+
shortcut?: string[];
|
|
20
|
+
/** Command required message scope (session type) */
|
|
21
|
+
scope?: MessageScope | 'all';
|
|
22
|
+
/** Command required user access level */
|
|
23
|
+
access?: UserAccess;
|
|
24
|
+
/** Command help message (have more details than command description) */
|
|
25
|
+
help?: string;
|
|
26
|
+
/** Command action */
|
|
27
|
+
action?: CommandAction;
|
|
28
|
+
}
|
|
29
|
+
interface CommandParseResult {
|
|
30
|
+
option_error: {
|
|
31
|
+
expected: CommandArgTypeSign;
|
|
32
|
+
reality: CommandArgTypeSign;
|
|
33
|
+
target: string;
|
|
34
|
+
};
|
|
35
|
+
arg_error: {
|
|
36
|
+
expected: CommandArgTypeSign;
|
|
37
|
+
reality: CommandArgTypeSign;
|
|
38
|
+
index: number;
|
|
39
|
+
};
|
|
40
|
+
arg_many: {
|
|
41
|
+
expected: number;
|
|
42
|
+
reality: number;
|
|
43
|
+
};
|
|
44
|
+
arg_few: CommandParseResult['arg_many'];
|
|
45
|
+
syntax: {
|
|
46
|
+
index: number;
|
|
47
|
+
char: string;
|
|
48
|
+
};
|
|
49
|
+
unknown: {
|
|
50
|
+
input: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface CommandResult extends CommandParseResult {
|
|
54
|
+
error: {
|
|
55
|
+
error: unknown;
|
|
56
|
+
};
|
|
57
|
+
data_error: {
|
|
58
|
+
target: string | number;
|
|
59
|
+
};
|
|
60
|
+
res_error: {
|
|
61
|
+
error: TsuError;
|
|
62
|
+
};
|
|
63
|
+
num_error: null;
|
|
64
|
+
no_access_manger: null;
|
|
65
|
+
no_access_admin: null;
|
|
66
|
+
disable: null;
|
|
67
|
+
exists: {
|
|
68
|
+
target: string;
|
|
69
|
+
};
|
|
70
|
+
no_exists: CommandResult['exists'];
|
|
71
|
+
}
|
|
72
|
+
type CommandResultNoArgs = 'num_error' | 'no_access_manger' | 'no_access_admin' | 'disable';
|
|
73
|
+
export type CommandResultExtra = {
|
|
74
|
+
[K in keyof CommandResult]: {
|
|
75
|
+
type: K;
|
|
76
|
+
} & (K extends CommandResultNoArgs ? object : CommandResult[K]);
|
|
77
|
+
};
|
|
78
|
+
export {};
|
package/lib/types/command.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __create = Object.create;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LocaleType } from '@kotori-bot/i18n';
|
|
2
|
+
import type { ModuleConfig } from 'fluoro';
|
|
3
|
+
export interface CoreConfig {
|
|
4
|
+
global: GlobalConfig;
|
|
5
|
+
adapter: {
|
|
6
|
+
[propName: string]: AdapterConfig;
|
|
7
|
+
};
|
|
8
|
+
plugin: {
|
|
9
|
+
[propName: string]: ModuleConfig;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface GlobalConfig {
|
|
13
|
+
lang: LocaleType;
|
|
14
|
+
commandPrefix: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AdapterConfig {
|
|
17
|
+
extends: string;
|
|
18
|
+
master: string;
|
|
19
|
+
lang: LocaleType;
|
|
20
|
+
commandPrefix: string;
|
|
21
|
+
}
|
package/lib/types/config.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
package/lib/types/events.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare enum FilterTestList {
|
|
2
|
+
PLATFORM = "platform",
|
|
3
|
+
USER_ID = "userId",
|
|
4
|
+
GROUP_ID = "groupId",
|
|
5
|
+
OPERATOR_ID = "operatorId",
|
|
6
|
+
MESSAGE_ID = "messageId",
|
|
7
|
+
SCOPE = "scope",
|
|
8
|
+
ACCESS = "access",
|
|
9
|
+
IDENTITY = "identity",
|
|
10
|
+
LOCALE_TYPE = "localeType",
|
|
11
|
+
SELF_ID = "selfId"
|
|
12
|
+
}
|
|
13
|
+
export type FilterOption = FilterOptionBase | FilterOptionGroup;
|
|
14
|
+
/** Single filter option */
|
|
15
|
+
export interface FilterOptionBase {
|
|
16
|
+
test: FilterTestList;
|
|
17
|
+
operator: '==' | '!=' | '>' | '<' | '>=' | '<=';
|
|
18
|
+
value: string | number | boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Group filters option */
|
|
21
|
+
export interface FilterOptionGroup {
|
|
22
|
+
/** Match type, filters of all passed, filter of any one passed, filters of none passed */
|
|
23
|
+
type: 'all_of' | 'any_of' | 'none_of';
|
|
24
|
+
/** Filters list */
|
|
25
|
+
filters: FilterOption[];
|
|
26
|
+
}
|
|
27
|
+
export declare const filterOptionBaseSchema: import("tsukiko").ObjectParser<{
|
|
28
|
+
test: import("tsukiko").CustomParser<FilterTestList>;
|
|
29
|
+
operator: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"==">, import("tsukiko").LiteralParser<"!=">, import("tsukiko").LiteralParser<">">, import("tsukiko").LiteralParser<"<">, import("tsukiko").LiteralParser<">=">, import("tsukiko").LiteralParser<"<=">]>;
|
|
30
|
+
value: import("tsukiko").UnionParser<[import("tsukiko").StringParser, import("tsukiko").NumberParser, import("tsukiko").BooleanParser]>;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const filterOptionGroupSchema: import("tsukiko").ObjectParser<{
|
|
33
|
+
type: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"all_of">, import("tsukiko").LiteralParser<"any_of">, import("tsukiko").LiteralParser<"none_of">]>;
|
|
34
|
+
filters: import("tsukiko").ArrayParser<import("tsukiko").ObjectParser<{
|
|
35
|
+
test: import("tsukiko").CustomParser<FilterTestList>;
|
|
36
|
+
operator: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"==">, import("tsukiko").LiteralParser<"!=">, import("tsukiko").LiteralParser<">">, import("tsukiko").LiteralParser<"<">, import("tsukiko").LiteralParser<">=">, import("tsukiko").LiteralParser<"<=">]>;
|
|
37
|
+
value: import("tsukiko").UnionParser<[import("tsukiko").StringParser, import("tsukiko").NumberParser, import("tsukiko").BooleanParser]>;
|
|
38
|
+
}>>;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const filterOptionSchema: import("tsukiko").UnionParser<[import("tsukiko").ObjectParser<{
|
|
41
|
+
test: import("tsukiko").CustomParser<FilterTestList>;
|
|
42
|
+
operator: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"==">, import("tsukiko").LiteralParser<"!=">, import("tsukiko").LiteralParser<">">, import("tsukiko").LiteralParser<"<">, import("tsukiko").LiteralParser<">=">, import("tsukiko").LiteralParser<"<=">]>;
|
|
43
|
+
value: import("tsukiko").UnionParser<[import("tsukiko").StringParser, import("tsukiko").NumberParser, import("tsukiko").BooleanParser]>;
|
|
44
|
+
}>, import("tsukiko").ObjectParser<{
|
|
45
|
+
type: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"all_of">, import("tsukiko").LiteralParser<"any_of">, import("tsukiko").LiteralParser<"none_of">]>;
|
|
46
|
+
filters: import("tsukiko").ArrayParser<import("tsukiko").ObjectParser<{
|
|
47
|
+
test: import("tsukiko").CustomParser<FilterTestList>;
|
|
48
|
+
operator: import("tsukiko").UnionParser<[import("tsukiko").LiteralParser<"==">, import("tsukiko").LiteralParser<"!=">, import("tsukiko").LiteralParser<">">, import("tsukiko").LiteralParser<"<">, import("tsukiko").LiteralParser<">=">, import("tsukiko").LiteralParser<"<=">]>;
|
|
49
|
+
value: import("tsukiko").UnionParser<[import("tsukiko").StringParser, import("tsukiko").NumberParser, import("tsukiko").BooleanParser]>;
|
|
50
|
+
}>>;
|
|
51
|
+
}>]>;
|
package/lib/types/filter.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __create = Object.create;
|
package/lib/types/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @Package @kotori-bot/core
|
|
3
|
-
* @Version 1.7.
|
|
3
|
+
* @Version 1.7.2
|
|
4
4
|
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
5
|
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
6
|
* @License GPL-3.0
|
|
7
7
|
* @Link https://github.com/kotorijs/kotori
|
|
8
|
-
* @Date 2026/2/14
|
|
8
|
+
* @Date 2026/2/14 15:50:13
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
var __defProp = Object.defineProperty;
|