@chatluna/patchbay 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +57 -2
- package/lib/apply.d.ts +5 -0
- package/lib/apply.js +59 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +33 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/manifest.d.ts +24 -0
- package/lib/manifest.js +13 -0
- package/lib/patch.d.ts +7 -0
- package/lib/patch.js +43 -0
- package/lib/sync.d.ts +31 -0
- package/lib/sync.js +144 -0
- package/package.json +54 -4
- package/patchbay.json +69 -0
- package/patches/@cordisjs+plugin-cli-cordis@1.0.5.patch +56 -0
- package/patches/@cordisjs+plugin-database@4.1.1.patch +15 -0
- package/patches/@cordisjs+plugin-http@1.5.2.patch +13 -0
- package/patches/@cordisjs+plugin-loader@1.0.0-rc.9.patch +82 -0
- package/patches/@cordisjs+plugin-server@1.7.0.patch +22 -0
- package/patches/@cordisjs+unyaml@2.0.3.patch +69 -0
- package/patches/@koishijs+core@4.18.11.patch +1144 -0
- package/patches/@satorijs+core@4.6.1.patch +584 -0
- package/patches/koishi-plugin-adapter-onebot@6.9.5.patch +194 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
diff --git a/lib/bot/base.d.ts b/lib/bot/base.d.ts
|
|
2
|
+
index 1d9a656..da138a1 100644
|
|
3
|
+
--- a/lib/bot/base.d.ts
|
|
4
|
+
+++ b/lib/bot/base.d.ts
|
|
5
|
+
@@ -1,4 +1,4 @@
|
|
6
|
+
-import { Bot, Context, Schema, Universal } from 'koishi';
|
|
7
|
+
+import { Bot, Context, Schema, Universal } from '@satorijs/core';
|
|
8
|
+
import * as OneBot from '../utils';
|
|
9
|
+
import { OneBotMessageEncoder } from './message';
|
|
10
|
+
export declare class BaseBot<C extends Context = Context, T extends BaseBot.Config = BaseBot.Config> extends Bot<C, T> {
|
|
11
|
+
diff --git a/lib/bot/cqcode.d.ts b/lib/bot/cqcode.d.ts
|
|
12
|
+
index 23233d5..3347907 100644
|
|
13
|
+
--- a/lib/bot/cqcode.d.ts
|
|
14
|
+
+++ b/lib/bot/cqcode.d.ts
|
|
15
|
+
@@ -1,4 +1,4 @@
|
|
16
|
+
-import { Dict, h } from 'koishi';
|
|
17
|
+
+import { Dict, h } from '@satorijs/core';
|
|
18
|
+
export declare function CQCode(type: string, attrs: Dict<string>): string;
|
|
19
|
+
export interface CQCode {
|
|
20
|
+
type: string;
|
|
21
|
+
diff --git a/lib/bot/index.d.ts b/lib/bot/index.d.ts
|
|
22
|
+
index c28ed8b..ea4d60c 100644
|
|
23
|
+
--- a/lib/bot/index.d.ts
|
|
24
|
+
+++ b/lib/bot/index.d.ts
|
|
25
|
+
@@ -1,4 +1,4 @@
|
|
26
|
+
-import { Context, Schema, Session, Universal } from 'koishi';
|
|
27
|
+
+import { Context, Schema, Session, Universal } from '@satorijs/core';
|
|
28
|
+
import { HttpServer } from '../http';
|
|
29
|
+
import { WsClient, WsServer } from '../ws';
|
|
30
|
+
import { QQGuildBot } from './qqguild';
|
|
31
|
+
diff --git a/lib/bot/message.d.ts b/lib/bot/message.d.ts
|
|
32
|
+
index 6272232..6c33411 100644
|
|
33
|
+
--- a/lib/bot/message.d.ts
|
|
34
|
+
+++ b/lib/bot/message.d.ts
|
|
35
|
+
@@ -1,4 +1,4 @@
|
|
36
|
+
-import { Context, h, MessageEncoder, Universal } from 'koishi';
|
|
37
|
+
+import { Context, h, MessageEncoder, Universal } from '@satorijs/core';
|
|
38
|
+
import { BaseBot } from './base';
|
|
39
|
+
import { CQCode } from './cqcode';
|
|
40
|
+
export interface Author extends Universal.User {
|
|
41
|
+
diff --git a/lib/bot/qqguild.d.ts b/lib/bot/qqguild.d.ts
|
|
42
|
+
index 4799f1c..c8d5b27 100644
|
|
43
|
+
--- a/lib/bot/qqguild.d.ts
|
|
44
|
+
+++ b/lib/bot/qqguild.d.ts
|
|
45
|
+
@@ -1,4 +1,4 @@
|
|
46
|
+
-import { Context, Universal } from 'koishi';
|
|
47
|
+
+import { Context, Universal } from '@satorijs/core';
|
|
48
|
+
import { BaseBot } from './base';
|
|
49
|
+
import { OneBotBot } from '.';
|
|
50
|
+
import * as OneBot from '../utils';
|
|
51
|
+
diff --git a/lib/http.d.ts b/lib/http.d.ts
|
|
52
|
+
index fa25003..dad0b2d 100644
|
|
53
|
+
--- a/lib/http.d.ts
|
|
54
|
+
+++ b/lib/http.d.ts
|
|
55
|
+
@@ -1,4 +1,4 @@
|
|
56
|
+
-import { Adapter, Context, HTTP, Schema } from 'koishi';
|
|
57
|
+
+import { Adapter, Context, HTTP, Schema } from '@satorijs/core';
|
|
58
|
+
import { OneBotBot } from './bot';
|
|
59
|
+
export declare class HttpServer<C extends Context = Context> extends Adapter<C, OneBotBot<C>> {
|
|
60
|
+
static inject: string[];
|
|
61
|
+
diff --git a/lib/index.d.ts b/lib/index.d.ts
|
|
62
|
+
index 120885c..d5ba237 100644
|
|
63
|
+
--- a/lib/index.d.ts
|
|
64
|
+
+++ b/lib/index.d.ts
|
|
65
|
+
@@ -1,4 +1,4 @@
|
|
66
|
+
-import { Session } from 'koishi';
|
|
67
|
+
+import { Session } from '@satorijs/core';
|
|
68
|
+
import { OneBotBot } from './bot';
|
|
69
|
+
import * as OneBot from './utils';
|
|
70
|
+
export { OneBot };
|
|
71
|
+
@@ -12,7 +12,7 @@ declare module '@satorijs/core' {
|
|
72
|
+
subsubtype?: string;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
-declare module 'koishi' {
|
|
76
|
+
+declare module '@satorijs/core' {
|
|
77
|
+
interface Events {
|
|
78
|
+
'onebot/message-reactions-updated'(session: Session): void;
|
|
79
|
+
'onebot/channel-updated'(session: Session): void;
|
|
80
|
+
diff --git a/lib/index.js b/lib/index.js
|
|
81
|
+
index 996a9c8..5b58e18 100644
|
|
82
|
+
--- a/lib/index.js
|
|
83
|
+
+++ b/lib/index.js
|
|
84
|
+
@@ -46,10 +46,10 @@ __export(index_exports, {
|
|
85
|
+
module.exports = __toCommonJS(index_exports);
|
|
86
|
+
|
|
87
|
+
// src/bot/index.ts
|
|
88
|
+
-var import_koishi8 = require("koishi");
|
|
89
|
+
+var import_koishi8 = require("@satorijs/core");
|
|
90
|
+
|
|
91
|
+
// src/http.ts
|
|
92
|
+
-var import_koishi3 = require("koishi");
|
|
93
|
+
+var import_koishi3 = require("@satorijs/core");
|
|
94
|
+
|
|
95
|
+
// src/utils.ts
|
|
96
|
+
var utils_exports = {};
|
|
97
|
+
@@ -67,11 +67,11 @@ __export(utils_exports, {
|
|
98
|
+
decodeUser: () => decodeUser,
|
|
99
|
+
dispatchSession: () => dispatchSession
|
|
100
|
+
});
|
|
101
|
+
-var import_koishi2 = require("koishi");
|
|
102
|
+
+var import_koishi2 = require("@satorijs/core");
|
|
103
|
+
var qface = __toESM(require("qface"));
|
|
104
|
+
|
|
105
|
+
// src/types.ts
|
|
106
|
+
-var import_koishi = require("koishi");
|
|
107
|
+
+var import_koishi = require("@satorijs/core");
|
|
108
|
+
var SafetyLevel = /* @__PURE__ */ ((SafetyLevel2) => {
|
|
109
|
+
SafetyLevel2[SafetyLevel2["safe"] = 0] = "safe";
|
|
110
|
+
SafetyLevel2[SafetyLevel2["unknown"] = 1] = "unknown";
|
|
111
|
+
@@ -594,7 +594,7 @@ var HttpServer = class extends import_koishi3.Adapter {
|
|
112
|
+
})(HttpServer || (HttpServer = {}));
|
|
113
|
+
|
|
114
|
+
// src/ws.ts
|
|
115
|
+
-var import_koishi4 = require("koishi");
|
|
116
|
+
+var import_koishi4 = require("@satorijs/core");
|
|
117
|
+
var WsClient = class extends import_koishi4.Adapter.WsClient {
|
|
118
|
+
static {
|
|
119
|
+
__name(this, "WsClient");
|
|
120
|
+
@@ -734,10 +734,10 @@ function accept(socket, bot) {
|
|
121
|
+
__name(accept, "accept");
|
|
122
|
+
|
|
123
|
+
// src/bot/base.ts
|
|
124
|
+
-var import_koishi6 = require("koishi");
|
|
125
|
+
+var import_koishi6 = require("@satorijs/core");
|
|
126
|
+
|
|
127
|
+
// src/bot/message.ts
|
|
128
|
+
-var import_koishi5 = require("koishi");
|
|
129
|
+
+var import_koishi5 = require("@satorijs/core");
|
|
130
|
+
var import_node_url = require("node:url");
|
|
131
|
+
var State = class {
|
|
132
|
+
constructor(type) {
|
|
133
|
+
@@ -830,7 +830,7 @@ var OneBotMessageEncoder = class extends import_koishi5.MessageEncoder {
|
|
134
|
+
}
|
|
135
|
+
async sendFile(attrs) {
|
|
136
|
+
const src = attrs.src || attrs.url;
|
|
137
|
+
- const name = attrs.title || (await this.bot.ctx.http.file(src)).filename;
|
|
138
|
+
+ const name = attrs.filename || attrs.name || attrs.title || (await this.bot.ctx.http.file(src)).filename;
|
|
139
|
+
const file = src.startsWith("file:") ? (0, import_node_url.fileURLToPath)(src) : await this.bot.internal.downloadFile(src);
|
|
140
|
+
if (this.session.event.channel.type === import_koishi5.Universal.Channel.Type.DIRECT) {
|
|
141
|
+
await this.bot.internal.uploadPrivateFile(
|
|
142
|
+
@@ -977,7 +977,7 @@ var BaseBot2 = class extends import_koishi6.Bot {
|
|
143
|
+
__name(this, "BaseBot");
|
|
144
|
+
}
|
|
145
|
+
static MessageEncoder = OneBotMessageEncoder;
|
|
146
|
+
- static inject = ["http"];
|
|
147
|
+
+ static inject = ["http", "satori", "timer"];
|
|
148
|
+
parent;
|
|
149
|
+
internal;
|
|
150
|
+
async createDirectChannel(userId) {
|
|
151
|
+
@@ -1112,7 +1112,7 @@ var QQGuildBot = class extends BaseBot2 {
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/bot/cqcode.ts
|
|
155
|
+
-var import_koishi7 = require("koishi");
|
|
156
|
+
+var import_koishi7 = require("@satorijs/core");
|
|
157
|
+
function CQCode(type, attrs) {
|
|
158
|
+
if (type === "text") return attrs.content;
|
|
159
|
+
let output = "[CQ:" + type;
|
|
160
|
+
diff --git a/lib/types.d.ts b/lib/types.d.ts
|
|
161
|
+
index fc0546b..d0a5cc5 100644
|
|
162
|
+
--- a/lib/types.d.ts
|
|
163
|
+
+++ b/lib/types.d.ts
|
|
164
|
+
@@ -1,4 +1,4 @@
|
|
165
|
+
-import { Dict } from 'koishi';
|
|
166
|
+
+import { Dict } from '@satorijs/core';
|
|
167
|
+
import { BaseBot, CQCode } from './bot';
|
|
168
|
+
export interface Response {
|
|
169
|
+
status: string;
|
|
170
|
+
diff --git a/lib/utils.d.ts b/lib/utils.d.ts
|
|
171
|
+
index 078165b..77b0d93 100644
|
|
172
|
+
--- a/lib/utils.d.ts
|
|
173
|
+
+++ b/lib/utils.d.ts
|
|
174
|
+
@@ -1,4 +1,4 @@
|
|
175
|
+
-import { Context, Universal } from 'koishi';
|
|
176
|
+
+import { Context, Universal } from '@satorijs/core';
|
|
177
|
+
import { BaseBot } from './bot';
|
|
178
|
+
import * as OneBot from './types';
|
|
179
|
+
export * from './types';
|
|
180
|
+
diff --git a/lib/ws.d.ts b/lib/ws.d.ts
|
|
181
|
+
index 666be9e..fce4d30 100644
|
|
182
|
+
--- a/lib/ws.d.ts
|
|
183
|
+
+++ b/lib/ws.d.ts
|
|
184
|
+
@@ -1,5 +1,8 @@
|
|
185
|
+
-import { Adapter, Context, HTTP, Logger, Schema, Universal } from 'koishi';
|
|
186
|
+
-import { WebSocketLayer } from '@koishijs/plugin-server';
|
|
187
|
+
+import { Adapter, Context, HTTP, Logger, Schema, Universal } from '@satorijs/core';
|
|
188
|
+
+// Inline the equivalent type: @koishijs/plugin-server is not installed in this repository.
|
|
189
|
+
+interface WebSocketLayer {
|
|
190
|
+
+ accepts?: string[];
|
|
191
|
+
+}
|
|
192
|
+
import { OneBotBot } from './bot';
|
|
193
|
+
interface SharedConfig<T = 'ws' | 'ws-reverse'> {
|
|
194
|
+
protocol: T;
|