x
This commit is contained in:
+18
-4
@@ -388,7 +388,7 @@ var typeat = `declare class Sender {
|
|||||||
allow_users?: string[];
|
allow_users?: string[];
|
||||||
prohibit_users?: string[];
|
prohibit_users?: string[];
|
||||||
persistent?: boolean;
|
persistent?: boolean;
|
||||||
}): Promise<Sender>;
|
}): Promise<Sender | undefined>;
|
||||||
holdOn(str: string): string;
|
holdOn(str: string): string;
|
||||||
reply(content: string): Promise<string | undefined>;
|
reply(content: string): Promise<string | undefined>;
|
||||||
action(options: any): Promise<any | undefined>;
|
action(options: any): Promise<any | undefined>;
|
||||||
@@ -433,8 +433,8 @@ declare class Adapter {
|
|||||||
constructor(options: {
|
constructor(options: {
|
||||||
platform?: string;
|
platform?: string;
|
||||||
bot_id?: string;
|
bot_id?: string;
|
||||||
replyHandler?: (message: Message) => string | undefined;
|
replyHandler?: (message: Message) => string | undefined | Promise<string | undefined>;
|
||||||
actionHandler?: (message: Message) => string | undefined;
|
actionHandler?: (message: Message) => string | undefined | Promise<string | undefined>;
|
||||||
});
|
});
|
||||||
setActionHandler(func: (action: {}) => any): void;
|
setActionHandler(func: (action: {}) => any): void;
|
||||||
receive(message: Message): Promise<Sender>;
|
receive(message: Message): Promise<Sender>;
|
||||||
@@ -444,7 +444,21 @@ declare class Adapter {
|
|||||||
}
|
}
|
||||||
declare let sender: Sender;
|
declare let sender: Sender;
|
||||||
declare function sleep(ms: number | undefined): Promise<unknown>;
|
declare function sleep(ms: number | undefined): Promise<unknown>;
|
||||||
export { Adapter, Bucket, sender, sleep, console };
|
interface CQItem {
|
||||||
|
type: string;
|
||||||
|
params: {};
|
||||||
|
}
|
||||||
|
declare let utils: {
|
||||||
|
parseCQText: (text: string, prefix?: string) => (string | CQItem)[];
|
||||||
|
};
|
||||||
|
declare let console: {
|
||||||
|
log(...args: any[]): void;
|
||||||
|
info(...args: any[]): void;
|
||||||
|
error(...args: any[]): void;
|
||||||
|
debug(...args: any[]): void;
|
||||||
|
};
|
||||||
|
export { Adapter, Bucket, sender, sleep, utils, console };
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
func defaultScript(title string) string {
|
func defaultScript(title string) string {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ func initWeb() {
|
|||||||
if _, err := os.Stat(dir); err != nil { //执行压缩
|
if _, err := os.Stat(dir); err != nil { //执行压缩
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
dir = strings.ReplaceAll(dir, "\\", "/")
|
||||||
ss := strings.Split(dir, "/")
|
ss := strings.Split(dir, "/")
|
||||||
name := ss[len(ss)-1]
|
name := ss[len(ss)-1]
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
|||||||
Vendored
+5
-4
@@ -84,11 +84,12 @@ declare class Adapter {
|
|||||||
}
|
}
|
||||||
declare let sender: Sender;
|
declare let sender: Sender;
|
||||||
declare function sleep(ms: number | undefined): Promise<unknown>;
|
declare function sleep(ms: number | undefined): Promise<unknown>;
|
||||||
|
interface CQItem {
|
||||||
|
type: string;
|
||||||
|
params: {};
|
||||||
|
}
|
||||||
declare let utils: {
|
declare let utils: {
|
||||||
parseCQText: (text: string, prefix?: string) => (string | {
|
parseCQText: (text: string, prefix?: string) => (string | CQItem)[];
|
||||||
type: string;
|
|
||||||
params: any;
|
|
||||||
})[];
|
|
||||||
};
|
};
|
||||||
declare let console: {
|
declare let console: {
|
||||||
log(...args: any[]): void;
|
log(...args: any[]): void;
|
||||||
|
|||||||
+5
-6
@@ -676,23 +676,22 @@ let utils = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
exports.utils = utils;
|
exports.utils = utils;
|
||||||
let slog = (type, ...args) => {
|
let slog = (type, ...args) => { };
|
||||||
};
|
|
||||||
let console = {
|
let console = {
|
||||||
log(...args) {
|
log(...args) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '');
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "log", content, plugin_id }), (err, resp) => { });
|
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "log", content, plugin_id }), (err, resp) => { });
|
||||||
},
|
},
|
||||||
info(...args) {
|
info(...args) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '');
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "info", content, plugin_id }), (err, resp) => { });
|
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "info", content, plugin_id }), (err, resp) => { });
|
||||||
},
|
},
|
||||||
error(...args) {
|
error(...args) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '');
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "error", content, plugin_id }), (err, resp) => { });
|
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "error", content, plugin_id }), (err, resp) => { });
|
||||||
},
|
},
|
||||||
debug(...args) {
|
debug(...args) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '');
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "debug", content, plugin_id }), (err, resp) => { });
|
client.Console(new srpc_1.srpc.ConsoleRequest({ type: "debug", content, plugin_id }), (err, resp) => { });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-12
@@ -749,11 +749,16 @@ class Console {
|
|||||||
debug = (message?: any, ...optionalParams: any[]) => {};
|
debug = (message?: any, ...optionalParams: any[]) => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CQItem {
|
||||||
|
type: string;
|
||||||
|
params: {};
|
||||||
|
}
|
||||||
|
|
||||||
let utils = {
|
let utils = {
|
||||||
parseCQText: (text: string, prefix = "CQ") => {
|
parseCQText: (text: string, prefix = "CQ") => {
|
||||||
const cqRegex = new RegExp(`\\[${prefix}:(\\w+)(.*?)\\]`, "g");
|
const cqRegex = new RegExp(`\\[${prefix}:(\\w+)(.*?)\\]`, "g");
|
||||||
const cqMatches = text.matchAll(cqRegex);
|
const cqMatches = text.matchAll(cqRegex);
|
||||||
const result = [];
|
const result: (CQItem | string)[] = [];
|
||||||
|
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
for (const match of cqMatches) {
|
for (const match of cqMatches) {
|
||||||
@@ -784,38 +789,36 @@ let utils = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let slog = (type: string, ...args: any[]) => {
|
let slog = (type: string, ...args: any[]) => {};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
let console = {
|
let console = {
|
||||||
log(...args: any[]) {
|
log(...args: any[]) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '')
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(
|
client.Console(
|
||||||
new srpc.ConsoleRequest({ type: "log", content, plugin_id }),
|
new srpc.ConsoleRequest({ type: "log", content, plugin_id }),
|
||||||
(err, resp) => {}
|
(err, resp) => {}
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
info(...args: any[]) {
|
info(...args: any[]) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '')
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(
|
client.Console(
|
||||||
new srpc.ConsoleRequest({ type: "info", content, plugin_id }),
|
new srpc.ConsoleRequest({ type: "info", content, plugin_id }),
|
||||||
(err, resp) => {}
|
(err, resp) => {}
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
error(...args: any[]) {
|
error(...args: any[]) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '')
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(
|
client.Console(
|
||||||
new srpc.ConsoleRequest({ type: "error", content, plugin_id }),
|
new srpc.ConsoleRequest({ type: "error", content, plugin_id }),
|
||||||
(err, resp) => {}
|
(err, resp) => {}
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
debug(...args: any[]) {
|
debug(...args: any[]) {
|
||||||
const content = args.reduce((acc, arg) => acc + ' ' + arg, '')
|
const content = args.reduce((acc, arg) => acc + " " + arg, "");
|
||||||
client.Console(
|
client.Console(
|
||||||
new srpc.ConsoleRequest({ type: "debug", content, plugin_id }),
|
new srpc.ConsoleRequest({ type: "debug", content, plugin_id }),
|
||||||
(err, resp) => {}
|
(err, resp) => {}
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user