@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,6 @@
|
|
|
1
|
+
import { type EventsList as FluoroEventsList, Service as FluoroService } from 'fluoro';
|
|
2
|
+
import type { EventsMapping } from '../types/events';
|
|
3
|
+
import type Context from './core';
|
|
4
|
+
export type EventsList = FluoroEventsList<EventsMapping>;
|
|
5
|
+
export type Service<T extends object = object> = FluoroService<T, Context>;
|
|
6
|
+
export declare const Service: new <T extends object = object>(ctx: Context, config: T, identity: string) => Service<T>;
|
package/lib/app/common.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,32 @@
|
|
|
1
|
+
import type { CoreConfig } from '../types';
|
|
2
|
+
/** Meta information. */
|
|
3
|
+
interface MetaInfo {
|
|
4
|
+
/** Program name */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Program core version */
|
|
7
|
+
coreVersion: string;
|
|
8
|
+
/** Program loader version if exists */
|
|
9
|
+
loaderVersion?: string;
|
|
10
|
+
/** Program version if exists */
|
|
11
|
+
version?: string;
|
|
12
|
+
/** Program description */
|
|
13
|
+
description: string;
|
|
14
|
+
/** Program entry file */
|
|
15
|
+
main: string;
|
|
16
|
+
/**
|
|
17
|
+
* Program license
|
|
18
|
+
*
|
|
19
|
+
* @constant
|
|
20
|
+
*/
|
|
21
|
+
license: 'GPL-3.0';
|
|
22
|
+
/** Program author */
|
|
23
|
+
author: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class Config {
|
|
26
|
+
readonly config: CoreConfig;
|
|
27
|
+
readonly meta: MetaInfo;
|
|
28
|
+
constructor(config?: Omit<Partial<CoreConfig>, 'global'> & {
|
|
29
|
+
global?: Partial<CoreConfig['global']>;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export default Config;
|
package/lib/app/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;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import I18n from '@kotori-bot/i18n';
|
|
2
|
+
import { Http } from '@kotori-bot/tools';
|
|
3
|
+
import FluoroContext from 'fluoro';
|
|
4
|
+
import type { Parser } from 'tsukiko';
|
|
5
|
+
import { type Api, Cache } from '../components';
|
|
6
|
+
import { Symbols } from '../global';
|
|
7
|
+
import type { AdapterClass } from '../types';
|
|
8
|
+
import type { EventsMapping } from '../types/events';
|
|
9
|
+
import Config from './config';
|
|
10
|
+
import Message from './message';
|
|
11
|
+
export interface Context {
|
|
12
|
+
/**
|
|
13
|
+
* Adapter constructors list.
|
|
14
|
+
*
|
|
15
|
+
* @readonly
|
|
16
|
+
*/
|
|
17
|
+
readonly [Symbols.adapter]: Context[typeof Symbols.adapter];
|
|
18
|
+
/**
|
|
19
|
+
* Bot instances list.
|
|
20
|
+
*
|
|
21
|
+
* @readonly
|
|
22
|
+
*/
|
|
23
|
+
readonly [Symbols.bot]: Context[typeof Symbols.bot];
|
|
24
|
+
/**
|
|
25
|
+
* Core config.
|
|
26
|
+
*
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
readonly config: Config['config'];
|
|
30
|
+
/**
|
|
31
|
+
* Meta information.
|
|
32
|
+
*
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
readonly meta: Config['meta'];
|
|
36
|
+
/**
|
|
37
|
+
* Registered middlewares list.
|
|
38
|
+
*
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
readonly [Symbols.midware]: Message[typeof Symbols.midware];
|
|
42
|
+
/**
|
|
43
|
+
* Registered commands list.
|
|
44
|
+
*
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
readonly [Symbols.command]: Message[typeof Symbols.command];
|
|
48
|
+
/**
|
|
49
|
+
* Registered regexps list.
|
|
50
|
+
*
|
|
51
|
+
* @readonly
|
|
52
|
+
*/
|
|
53
|
+
readonly [Symbols.regexp]: Message[typeof Symbols.regexp];
|
|
54
|
+
/**
|
|
55
|
+
* Registered scheduled tasks list.
|
|
56
|
+
*
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
readonly [Symbols.task]: Message[typeof Symbols.task];
|
|
60
|
+
/**
|
|
61
|
+
* Registered session filters list.
|
|
62
|
+
*
|
|
63
|
+
* @readonly
|
|
64
|
+
*/
|
|
65
|
+
readonly [Symbols.filter]: Message[typeof Symbols.filter];
|
|
66
|
+
/**
|
|
67
|
+
* Session promises in progress list.
|
|
68
|
+
*
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
readonly [Symbols.promise]: Message[typeof Symbols.promise];
|
|
72
|
+
/**
|
|
73
|
+
* Register a message handled middleware.
|
|
74
|
+
*
|
|
75
|
+
* @param callback - Middleware callback
|
|
76
|
+
* @param priority - Middleware priority, default is 100
|
|
77
|
+
* @returns dispose function
|
|
78
|
+
*/
|
|
79
|
+
midware: Message['midware'];
|
|
80
|
+
/**
|
|
81
|
+
* Register a command.
|
|
82
|
+
*
|
|
83
|
+
* @param template - Command template
|
|
84
|
+
* @param config - Command config, optional
|
|
85
|
+
* @returns Command instance
|
|
86
|
+
*/
|
|
87
|
+
command: Message['command'];
|
|
88
|
+
/**
|
|
89
|
+
* Register a regexp.
|
|
90
|
+
*
|
|
91
|
+
* @param match - Regexp to match
|
|
92
|
+
* @param callback - Regexp callback
|
|
93
|
+
* @returns dispose function
|
|
94
|
+
*/
|
|
95
|
+
regexp: Message['regexp'];
|
|
96
|
+
/**
|
|
97
|
+
* Register a scheduled task.
|
|
98
|
+
*
|
|
99
|
+
* @param options - Task options
|
|
100
|
+
* @param callback - Task callback
|
|
101
|
+
* @returns dispose function
|
|
102
|
+
*/
|
|
103
|
+
task: Message['task'];
|
|
104
|
+
/**
|
|
105
|
+
* Register a session filter.
|
|
106
|
+
*
|
|
107
|
+
* @param option - Filter option
|
|
108
|
+
* @returns new context
|
|
109
|
+
*/
|
|
110
|
+
filter: Message['filter'];
|
|
111
|
+
/**
|
|
112
|
+
* Send a notified message to the master of first bot instance at config.
|
|
113
|
+
*
|
|
114
|
+
* @experimental
|
|
115
|
+
*/
|
|
116
|
+
notify: Message['notify'];
|
|
117
|
+
/**
|
|
118
|
+
* Send a message to all sessions on all bots.
|
|
119
|
+
*
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
boardcast: Message['boardcast'];
|
|
123
|
+
/** Http request methods */
|
|
124
|
+
http: Http;
|
|
125
|
+
/** International methods */
|
|
126
|
+
i18n: I18n;
|
|
127
|
+
/** Cache service */
|
|
128
|
+
cache: Cache;
|
|
129
|
+
}
|
|
130
|
+
export declare class Context extends FluoroContext<EventsMapping> implements Context {
|
|
131
|
+
readonly [Symbols.adapter]: Map<string, [AdapterClass, Parser<unknown>?]>;
|
|
132
|
+
readonly [Symbols.bot]: Map<string, Set<Api>>;
|
|
133
|
+
constructor(config?: ConstructorParameters<typeof Config>[0]);
|
|
134
|
+
start(): void;
|
|
135
|
+
stop(): void;
|
|
136
|
+
}
|
|
137
|
+
export type Core = Context;
|
|
138
|
+
export declare const Core: typeof Context;
|
|
139
|
+
export default Core;
|
package/lib/app/core.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,13 +42,13 @@ __export(core_exports, {
|
|
|
42
42
|
default: () => core_default
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(core_exports);
|
|
45
|
-
var import_tools = require("@kotori-bot/tools");
|
|
46
45
|
var import_i18n = __toESM(require("@kotori-bot/i18n"));
|
|
46
|
+
var import_tools = require("@kotori-bot/tools");
|
|
47
47
|
var import_fluoro = __toESM(require("fluoro"));
|
|
48
|
-
var import_config = __toESM(require("./config"));
|
|
49
|
-
var import_message = __toESM(require("./message"));
|
|
50
48
|
var import_components = require("../components");
|
|
51
49
|
var import_global = require("../global");
|
|
50
|
+
var import_config = __toESM(require("./config"));
|
|
51
|
+
var import_message = __toESM(require("./message"));
|
|
52
52
|
class Context extends import_fluoro.default {
|
|
53
53
|
[import_global.Symbols.adapter] = /* @__PURE__ */ new Map();
|
|
54
54
|
[import_global.Symbols.bot] = /* @__PURE__ */ new Map();
|
package/lib/app/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,34 @@
|
|
|
1
|
+
import { CronJob } from 'cron';
|
|
2
|
+
import { Command, Filter, type SessionMsg } from '../components';
|
|
3
|
+
import { Symbols } from '../global';
|
|
4
|
+
import { type CommandConfig, type FilterOption, type MidwareCallback, type RegexpCallback, type TaskCallback, type TaskOptions } from '../types';
|
|
5
|
+
import type { Context } from './core';
|
|
6
|
+
interface MidwareData {
|
|
7
|
+
callback: MidwareCallback;
|
|
8
|
+
priority: number;
|
|
9
|
+
}
|
|
10
|
+
interface RegexpData {
|
|
11
|
+
match: RegExp;
|
|
12
|
+
callback: RegexpCallback;
|
|
13
|
+
}
|
|
14
|
+
export declare class Message {
|
|
15
|
+
readonly [Symbols.midware]: Set<MidwareData>;
|
|
16
|
+
readonly [Symbols.command]: Set<Command>;
|
|
17
|
+
readonly [Symbols.regexp]: Set<RegexpData>;
|
|
18
|
+
readonly [Symbols.task]: Set<CronJob>;
|
|
19
|
+
readonly [Symbols.filter]: Map<string, Filter>;
|
|
20
|
+
readonly [Symbols.promise]: Map<string, ((value: SessionMsg['message']) => void)[]>;
|
|
21
|
+
private handleMidware;
|
|
22
|
+
private handleRegexp;
|
|
23
|
+
private handleCommand;
|
|
24
|
+
private readonly ctx;
|
|
25
|
+
constructor(ctx: Context);
|
|
26
|
+
midware(callback: MidwareCallback, priority?: number): () => boolean;
|
|
27
|
+
command<T extends string>(template: T, config?: CommandConfig): Command<T, {}, "all">;
|
|
28
|
+
regexp(match: RegExp, callback: RegexpCallback): () => boolean;
|
|
29
|
+
boardcast(): void;
|
|
30
|
+
notify(): void;
|
|
31
|
+
task(options: TaskOptions, callback: TaskCallback): () => boolean;
|
|
32
|
+
filter(option: FilterOption): any;
|
|
33
|
+
}
|
|
34
|
+
export default Message;
|
package/lib/app/message.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;
|
|
@@ -41,14 +41,14 @@ __export(message_exports, {
|
|
|
41
41
|
default: () => message_default
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(message_exports);
|
|
44
|
+
var import_node_crypto = require("node:crypto");
|
|
44
45
|
var import_cron = require("cron");
|
|
45
|
-
var import_types = require("../types");
|
|
46
|
-
var import_internal = require("../utils/internal");
|
|
47
46
|
var import_components = require("../components");
|
|
48
|
-
var import_error = require("../utils/error");
|
|
49
|
-
var import_global = require("../global");
|
|
50
|
-
var import_node_crypto = require("node:crypto");
|
|
51
47
|
var import_utils = __toESM(require("../decorators/utils"));
|
|
48
|
+
var import_global = require("../global");
|
|
49
|
+
var import_types = require("../types");
|
|
50
|
+
var import_error = require("../utils/error");
|
|
51
|
+
var import_internal = require("../utils/internal");
|
|
52
52
|
class Message {
|
|
53
53
|
[import_global.Symbols.midware] = /* @__PURE__ */ new Set();
|
|
54
54
|
[import_global.Symbols.command] = /* @__PURE__ */ new Set();
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type Api from './api';
|
|
2
|
+
import type { AdapterConfig, EventDataApiBase } from '../types';
|
|
3
|
+
import type Elements from './elements';
|
|
4
|
+
import { Session } from './session';
|
|
5
|
+
import type { EventsList, Context } from '../app';
|
|
6
|
+
type EventApiType = {
|
|
7
|
+
[K in keyof EventsList]: EventsList[K] extends EventDataApiBase ? EventsList[K] : never;
|
|
8
|
+
};
|
|
9
|
+
/** Bot Status */
|
|
10
|
+
interface AdapterStatus {
|
|
11
|
+
/** Online status */
|
|
12
|
+
value: 'online' | 'offline';
|
|
13
|
+
/** Bot create time */
|
|
14
|
+
createTime: Date;
|
|
15
|
+
/** Bot last sending message time, or empty if haven't received message */
|
|
16
|
+
lastMsgTime: Date | null;
|
|
17
|
+
/** Received message count */
|
|
18
|
+
receivedMsg: number;
|
|
19
|
+
/** Sent message count */
|
|
20
|
+
sentMsg: number;
|
|
21
|
+
/** Offline times */
|
|
22
|
+
offlineTimes: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Platform adapter.
|
|
26
|
+
*
|
|
27
|
+
* @template A - Api instance of bot bind
|
|
28
|
+
* @template C - Adapter config
|
|
29
|
+
* @template E - Elements instance of bot bind
|
|
30
|
+
*
|
|
31
|
+
* @class
|
|
32
|
+
* @abstract
|
|
33
|
+
*/
|
|
34
|
+
export interface AdapterImpl<A extends Api = Api, C extends AdapterConfig = AdapterConfig, E extends Elements = Elements> {
|
|
35
|
+
/**
|
|
36
|
+
* Context instance.
|
|
37
|
+
*
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
readonly ctx: Context;
|
|
41
|
+
/**
|
|
42
|
+
* Adapter config.
|
|
43
|
+
*
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
readonly config: C;
|
|
47
|
+
/**
|
|
48
|
+
* Adapter support platform.
|
|
49
|
+
*
|
|
50
|
+
* @readonly
|
|
51
|
+
*/
|
|
52
|
+
readonly platform: string;
|
|
53
|
+
/**
|
|
54
|
+
* Platform id of bot instanceof itself.
|
|
55
|
+
*
|
|
56
|
+
* @readonly
|
|
57
|
+
*/
|
|
58
|
+
readonly selfId: string;
|
|
59
|
+
/**
|
|
60
|
+
* Unique identity of bot.
|
|
61
|
+
*
|
|
62
|
+
* @readonly
|
|
63
|
+
*/
|
|
64
|
+
readonly identity: string;
|
|
65
|
+
/**
|
|
66
|
+
* Api instance of bot bind.
|
|
67
|
+
*
|
|
68
|
+
* @readonly
|
|
69
|
+
*/
|
|
70
|
+
readonly api: A;
|
|
71
|
+
/**
|
|
72
|
+
* Elements instance of bot bind.
|
|
73
|
+
*
|
|
74
|
+
* @readonly
|
|
75
|
+
*/
|
|
76
|
+
readonly elements: E;
|
|
77
|
+
/**
|
|
78
|
+
* Bot status.
|
|
79
|
+
*
|
|
80
|
+
* @readonly
|
|
81
|
+
*/
|
|
82
|
+
readonly status: AdapterStatus;
|
|
83
|
+
/**
|
|
84
|
+
* Handle interactive data from platform.
|
|
85
|
+
*
|
|
86
|
+
* @param data - Data from platform.
|
|
87
|
+
*/
|
|
88
|
+
handle(...data: unknown[]): void;
|
|
89
|
+
/**
|
|
90
|
+
* Start bot.
|
|
91
|
+
*/
|
|
92
|
+
start(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Stop bot.
|
|
95
|
+
*/
|
|
96
|
+
stop(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Send interactive data to platform.
|
|
99
|
+
*
|
|
100
|
+
* @param data - Data to send.
|
|
101
|
+
*/
|
|
102
|
+
send(...data: unknown[]): void;
|
|
103
|
+
}
|
|
104
|
+
export declare abstract class Adapter<A extends Api = Api, C extends AdapterConfig = AdapterConfig, E extends Elements = Elements> implements AdapterImpl<A, C, E> {
|
|
105
|
+
constructor(ctx: Context, config: C, identity: string);
|
|
106
|
+
abstract readonly platform: string;
|
|
107
|
+
abstract readonly api: A;
|
|
108
|
+
abstract readonly elements: E;
|
|
109
|
+
abstract handle(...data: unknown[]): void;
|
|
110
|
+
abstract start(): void;
|
|
111
|
+
abstract stop(): void;
|
|
112
|
+
abstract send(...data: unknown[]): void;
|
|
113
|
+
protected online(): void;
|
|
114
|
+
protected offline(): void;
|
|
115
|
+
protected session<N extends keyof EventApiType>(type: N, data: EventApiType[N] extends Session<infer U> ? U : never): void;
|
|
116
|
+
readonly ctx: Context;
|
|
117
|
+
readonly config: C;
|
|
118
|
+
readonly identity: string;
|
|
119
|
+
readonly status: AdapterStatus;
|
|
120
|
+
selfId: string;
|
|
121
|
+
}
|
|
122
|
+
export default Adapter;
|
|
@@ -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;
|