@karinjs/adapter-qqbot 1.2.9 → 1.2.10

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.
Files changed (68) hide show
  1. package/config/comment/config.json +3 -0
  2. package/config/config/config.yaml +53 -0
  3. package/lib/cli/pr.d.ts +2 -0
  4. package/lib/cli/pr.js +73 -0
  5. package/lib/core/adapter/adapter.d.ts +91 -0
  6. package/lib/core/adapter/adapter.js +144 -0
  7. package/lib/core/adapter/handler.d.ts +49 -0
  8. package/lib/core/adapter/handler.js +140 -0
  9. package/lib/core/adapter/markdown.d.ts +38 -0
  10. package/lib/core/adapter/markdown.js +220 -0
  11. package/lib/core/adapter/normal.d.ts +30 -0
  12. package/lib/core/adapter/normal.js +263 -0
  13. package/lib/core/api/index.d.ts +167 -0
  14. package/lib/core/api/index.js +180 -0
  15. package/lib/core/api/sign.d.ts +22 -0
  16. package/lib/core/api/sign.js +40 -0
  17. package/lib/core/api/types.d.ts +236 -0
  18. package/lib/core/event/conver.d.ts +10 -0
  19. package/lib/core/event/conver.js +57 -0
  20. package/lib/core/event/index.d.ts +9 -0
  21. package/lib/core/event/index.js +98 -0
  22. package/lib/core/event/message.d.ts +27 -0
  23. package/lib/core/event/message.js +95 -0
  24. package/lib/core/event/notice.d.ts +50 -0
  25. package/lib/core/event/notice.js +133 -0
  26. package/lib/{types/event.d.ts → core/event/types.d.ts} +255 -14
  27. package/lib/core/internal/axios.d.ts +25 -0
  28. package/lib/core/internal/axios.js +46 -0
  29. package/lib/core/internal/sign.d.ts +22 -0
  30. package/lib/core/internal/sign.js +40 -0
  31. package/lib/core/webhook/c2c.d.ts +2 -0
  32. package/lib/core/webhook/c2c.js +14 -0
  33. package/lib/core/webhook/http.d.ts +2 -0
  34. package/lib/core/webhook/http.js +35 -0
  35. package/lib/core/webhook/index.d.ts +17 -0
  36. package/lib/core/webhook/index.js +87 -0
  37. package/lib/core/webhook/ws.d.ts +2 -0
  38. package/lib/core/webhook/ws.js +79 -0
  39. package/lib/index.d.ts +1 -3
  40. package/lib/index.js +5 -7
  41. package/lib/root.d.ts +5 -0
  42. package/lib/root.js +9 -0
  43. package/lib/types/config.d.ts +53 -0
  44. package/lib/utils/common.d.ts +75 -61
  45. package/lib/utils/common.js +190 -202
  46. package/lib/utils/config.d.ts +5 -130
  47. package/lib/utils/config.js +50 -172
  48. package/lib/utils/dir.d.ts +1 -5
  49. package/lib/utils/dir.js +1 -10
  50. package/lib/utils/index.d.ts +4 -3
  51. package/lib/utils/index.js +4 -3
  52. package/package.json +41 -23
  53. package/config/config.yaml +0 -69
  54. package/lib/core/api.d.ts +0 -180
  55. package/lib/core/api.js +0 -454
  56. package/lib/core/index.d.ts +0 -90
  57. package/lib/core/index.js +0 -349
  58. package/lib/core/intents.d.ts +0 -6
  59. package/lib/core/intents.js +0 -57
  60. package/lib/core/markdown.d.ts +0 -23
  61. package/lib/core/markdown.js +0 -265
  62. package/lib/types/index.d.ts +0 -3
  63. package/lib/types/index.js +0 -3
  64. package/lib/types/media.d.ts +0 -100
  65. package/lib/types/message.d.ts +0 -85
  66. /package/lib/{types/event.js → core/api/types.js} +0 -0
  67. /package/lib/{types/media.js → core/event/types.js} +0 -0
  68. /package/lib/types/{message.js → config.js} +0 -0
@@ -0,0 +1,40 @@
1
+ import nacl from 'tweetnacl';
2
+ /**
3
+ * 从提供的种子生成密钥对
4
+ * @param seed 用于生成密钥的种子
5
+ */
6
+ export const generateKeyPair = (seed) => {
7
+ let finalSeed = seed;
8
+ while (finalSeed.length < 32) {
9
+ finalSeed = finalSeed.repeat(2); // 确保种子长度至少为32字节
10
+ }
11
+ finalSeed = finalSeed.slice(0, 32); // 截断为32字节
12
+ const seedBuffer = Buffer.from(finalSeed, 'utf-8');
13
+ const keyPair = nacl.sign.keyPair.fromSeed(seedBuffer);
14
+ return keyPair;
15
+ };
16
+ /**
17
+ * 使用提供的私钥、事件时间戳和明文令牌对消息进行签名
18
+ * @param privateKey 用于签名的私钥
19
+ * @param eventTs 计算签名使用时间戳
20
+ * @param plainToken 需要计算签名的字符串
21
+ * @returns 生成的十六进制格式的签名
22
+ */
23
+ export const signMessage = (privateKey, eventTs, plainToken) => {
24
+ const message = eventTs + plainToken;
25
+ const messageBytes = Buffer.from(message, 'utf-8');
26
+ const signature = nacl.sign.detached(messageBytes, privateKey);
27
+ return Buffer.from(signature).toString('hex');
28
+ };
29
+ /**
30
+ * 签名
31
+ * @param secret 机器人密钥
32
+ * @param eventTs 计算签名使用时间戳
33
+ * @param plainToken 需要计算签名的字符串
34
+ * @returns 生成的十六进制格式的签名
35
+ */
36
+ export const sign = (secret, eventTs, plainToken) => {
37
+ const { secretKey } = generateKeyPair(secret);
38
+ const signature = signMessage(secretKey, eventTs, plainToken);
39
+ return signature;
40
+ };
@@ -0,0 +1,2 @@
1
+ /** 创建端到端webhook路由 */
2
+ export declare const createC2CWebhook: () => void;
@@ -0,0 +1,14 @@
1
+ import { webhook } from '.';
2
+ import { app } from 'node-karin';
3
+ import { expressAfterInit } from '@/utils/common';
4
+ /** 创建端到端webhook路由 */
5
+ export const createC2CWebhook = () => {
6
+ const c2cRouting = '/webhook/c2c';
7
+ /**
8
+ * api 端到端
9
+ * tx -> bot/webhook
10
+ */
11
+ app.post(c2cRouting, (req, res) => webhook(req, res, () => true));
12
+ /** 调整中间件顺序 不使用json中间件 */
13
+ expressAfterInit(app._router.stack, c2cRouting, 'post');
14
+ };
@@ -0,0 +1,2 @@
1
+ /** 创建http中转webhook路由 */
2
+ export declare const createHttpWebhook: () => void;
@@ -0,0 +1,35 @@
1
+ import { webhook } from '.';
2
+ import { app, } from 'node-karin';
3
+ import { config } from '@/utils/config';
4
+ import { expressAfterInit, fakeEvent } from '@/utils/common';
5
+ /** 创建http中转webhook路由 */
6
+ export const createHttpWebhook = () => {
7
+ const httpRouting = '/webhook/http';
8
+ /**
9
+ * api 中转
10
+ * tx -> webhook ->bot/http
11
+ */
12
+ app.post(httpRouting, (req, res) => webhook(req, res, (req, appid) => {
13
+ const auth = req.headers['authorization'];
14
+ if (!auth) {
15
+ fakeEvent(`${appid} 未在头部中找到 Authorization: ${req.socket.remoteAddress}`);
16
+ return false;
17
+ }
18
+ const cfg = config()[appid];
19
+ if (!cfg) {
20
+ fakeEvent(`[配置错误][${appid}] 配置文件中未找到对应的appid,请检查配置文件`);
21
+ return false;
22
+ }
23
+ if (cfg.event.type !== 2) {
24
+ fakeEvent(`${appid} http中转服务未启用,请检查配置文件: ${req.socket.remoteAddress}`);
25
+ return false;
26
+ }
27
+ if (auth !== cfg.event.httpToken) {
28
+ fakeEvent(`${appid} Authorization 验证失败: ${req.socket.remoteAddress}`);
29
+ return false;
30
+ }
31
+ return true;
32
+ }));
33
+ /** 调整中间件顺序 不使用json中间件 */
34
+ expressAfterInit(app._router.stack, httpRouting, 'post');
35
+ };
@@ -0,0 +1,17 @@
1
+ import { Request, Response } from 'express';
2
+ /**
3
+ * webhook
4
+ * @param req 请求
5
+ * @param res 响应
6
+ */
7
+ export declare const webhook: (req: Request, res: Response, fnc: Function) => Promise<void>;
8
+ /**
9
+ * 判断请求是否合规并返回appid
10
+ * @param req 请求
11
+ * @param res 响应
12
+ */
13
+ export declare const checkAppid: (req: Request, res: Response) => Promise<{
14
+ appid: string;
15
+ rawBody: string;
16
+ body: Record<string, any>;
17
+ } | undefined>;
@@ -0,0 +1,87 @@
1
+ import { sign } from '../api/sign';
2
+ import { logger } from 'node-karin';
3
+ import { config } from '@/utils/config';
4
+ import { event, fakeEvent } from '@/utils/common';
5
+ /**
6
+ * webhook
7
+ * @param req 请求
8
+ * @param res 响应
9
+ */
10
+ export const webhook = async (req, res, fnc) => {
11
+ const data = await checkAppid(req, res);
12
+ if (!data)
13
+ return;
14
+ if (!fnc(req))
15
+ return;
16
+ const api = config()[data.appid];
17
+ if (!api) {
18
+ logger.error(`[配置错误][${data.appid}] 配置文件中未找到对应的appid,请检查配置文件`);
19
+ return;
20
+ }
21
+ if (api.event.type !== 1) {
22
+ logger.error(`[配置错误][${data.appid}] webhook未启用,请检查配置文件`);
23
+ return;
24
+ }
25
+ /** 接口初始化 鉴权回调 */
26
+ if (data.body.op === 13) {
27
+ const eventTs = data.body?.d?.event_ts;
28
+ const plainToken = data.body?.d?.plain_token;
29
+ if (!eventTs || !plainToken) {
30
+ logger.error(`[请求数据错误][${data.appid}] 未找到 event_ts 或 plain_token: ${data.rawBody}`);
31
+ return;
32
+ }
33
+ const signature = sign(api.secret, eventTs, plainToken);
34
+ logger.mark(`[signature][${data.appid}] ${signature}`);
35
+ res.setHeader('Content-Type', 'application/json');
36
+ res.status(200).end(JSON.stringify({ plain_token: plainToken, signature }));
37
+ return;
38
+ }
39
+ /** 非回调事件 进行鉴权验证 */
40
+ const ed25519 = req.headers['x-signature-ed25519'];
41
+ const signature = sign(api.secret, req.headers['x-signature-timestamp'], data.rawBody);
42
+ if (ed25519 !== signature) {
43
+ fakeEvent(`签名验证失败:\nappid: ${data.appid}\ned25519: ${ed25519}\n实际签名: ${signature}\nbody: ${data.rawBody}`);
44
+ return;
45
+ }
46
+ event.emit(data.appid, data.body);
47
+ };
48
+ /**
49
+ * 判断请求是否合规并返回appid
50
+ * @param req 请求
51
+ * @param res 响应
52
+ */
53
+ export const checkAppid = async (req, res) => {
54
+ let response = true;
55
+ try {
56
+ const ip = req.socket.remoteAddress;
57
+ const appid = req.headers['x-bot-appid'];
58
+ const rawBody = await new Promise((resolve) => {
59
+ const raw = [];
60
+ req.on('data', (chunk) => raw.push(chunk));
61
+ req.on('end', () => resolve(raw.join('')));
62
+ });
63
+ if (!appid) {
64
+ fakeEvent(`未找到 x-bot-appid: ${ip} body: ${rawBody}`);
65
+ return;
66
+ }
67
+ const userAgent = req.headers['user-agent'];
68
+ if (userAgent !== 'QQBot-Callback') {
69
+ fakeEvent(`未找到 User-Agent: ${ip} body: ${rawBody}`);
70
+ return;
71
+ }
72
+ const body = JSON.parse(rawBody) || {};
73
+ if (typeof body.op !== 'number') {
74
+ fakeEvent(`非法请求体,未找到 op: ${ip} body: ${rawBody}`);
75
+ return;
76
+ }
77
+ else if (body.op === 13) {
78
+ /** op13是计算sign返回 不可以直接返回状态码 */
79
+ response = false;
80
+ }
81
+ return { appid, rawBody, body };
82
+ }
83
+ finally {
84
+ /** 根据文档 返回200或者204都可以 必须在3秒内完成 */
85
+ response && res.status(200).end();
86
+ }
87
+ };
@@ -0,0 +1,2 @@
1
+ /** 创建ws中转路由 */
2
+ export declare const createWebSocketWebhook: () => void;
@@ -0,0 +1,79 @@
1
+ import WebSocket from 'node-karin/ws';
2
+ import { config } from '@/utils/config';
3
+ import { logger } from 'node-karin';
4
+ import { sign } from '../api/sign';
5
+ import { event, fakeEvent } from '@/utils/common';
6
+ /** 创建ws中转路由 */
7
+ export const createWebSocketWebhook = () => {
8
+ const cfg = config();
9
+ for (const appid of Object.keys(cfg)) {
10
+ const api = cfg[appid];
11
+ if (appid === 'default')
12
+ continue;
13
+ if (api?.event?.type !== 3)
14
+ continue;
15
+ const url = api.event.wsUrl;
16
+ const headers = { 'x-bot-appid': appid, authorization: api.event.wsToken };
17
+ createWebSocket(api, url, headers);
18
+ }
19
+ };
20
+ const createWebSocket = (cfg, url, headers) => {
21
+ const socket = new WebSocket(url, { headers });
22
+ const appid = headers['x-bot-appid'];
23
+ const close = (isClose = true) => {
24
+ /** 停止监听 */
25
+ socket.removeAllListeners();
26
+ isClose && socket?.close();
27
+ logger.error(`[QQBot][${appid}] WebSocket连接已断开,将在5秒后重连: ${url}`);
28
+ setTimeout(() => createWebSocket(cfg, url, headers), 5000);
29
+ };
30
+ socket.on('close', () => close(false));
31
+ socket.on('error', (error) => { logger.error(error); close(); });
32
+ socket.on('open', () => logger.info(`[QQBot][${appid}] WebSocket连接已打开: ${url}`));
33
+ socket.on('message', (data) => {
34
+ const raw = data.toString();
35
+ const parse = JSON.parse(raw);
36
+ if (parse?.type === 'event') {
37
+ return eventHandler(appid, cfg.secret, raw, parse);
38
+ }
39
+ if (parse?.type === 'sign') {
40
+ signHandler(appid, cfg.secret, raw, parse, socket);
41
+ }
42
+ logger.error(`[QQBot][${appid}] 未知的消息类型: ${raw}`);
43
+ });
44
+ };
45
+ /**
46
+ * 事件处理
47
+ * @param appid 机器人id
48
+ * @param secret 机器人密钥
49
+ * @param raw 原始数据
50
+ * @param parse 解析后的数据
51
+ */
52
+ const eventHandler = (appid, secret, raw, parse) => {
53
+ if (!parse?.data?.headers || !parse?.data?.headers['x-signature-ed25519'] || !parse?.data?.headers['x-signature-timestamp']) {
54
+ fakeEvent(`未找到签名字段: ${raw}`);
55
+ return;
56
+ }
57
+ const signature = sign(secret, parse.data.headers['x-signature-timestamp'], parse.data.event);
58
+ if (signature !== parse.data.headers['x-signature-ed25519']) {
59
+ logger.error(`[QQBot][${appid}] 签名验证失败: ${raw}`);
60
+ return;
61
+ }
62
+ event.emit(appid, JSON.parse(parse.data.event));
63
+ };
64
+ /**
65
+ * 签名处理
66
+ * @param appid 机器人id
67
+ * @param secret 机器人密钥
68
+ * @param raw 原始数据
69
+ * @param parse 解析后的数据
70
+ * @param socket websocket实例
71
+ */
72
+ const signHandler = (appid, secret, raw, parse, socket) => {
73
+ if (!parse?.data?.eventTs || !parse?.data?.plainToken) {
74
+ logger.error(`[QQBot][${appid}] 未找到 eventTs 或 plainToken: ${raw}`);
75
+ return;
76
+ }
77
+ const signature = sign(secret, parse.data.eventTs, parse.data.plainToken);
78
+ socket.send(JSON.stringify({ echo: parse.echo, data: { signature } }));
79
+ };
package/lib/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- import './core/index.js';
2
- import Jimp from 'jimp';
3
- export default Jimp;
1
+ import '@/core/event/index';
package/lib/index.js CHANGED
@@ -1,7 +1,5 @@
1
- import './core/index.js';
2
- import Jimp from 'jimp';
3
- import { logger, common } from 'node-karin';
4
- import { basename, dirPath } from './utils/dir.js';
5
- const pkg = common.readJson(dirPath + '/package.json');
6
- logger.info(`${logger.violet(`[插件:${pkg.version}]`)} ${logger.green(basename)} 初始化完成~`);
7
- export default Jimp;
1
+ import '@/core/event/index';
2
+ import { logger } from 'node-karin';
3
+ import { basename, config } from '@/utils';
4
+ /** 请不要在这编写插件 不会有任何效果~ */
5
+ logger.info(`${logger.violet(`[插件:${config.pkg().version}]`)} ${logger.green(basename)} 初始化完成~`);
package/lib/root.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /** 插件包绝对路径 */
2
+ declare const dirPath: string;
3
+ /** 插件包的名称 */
4
+ declare const basename: string;
5
+ export { dirPath, basename };
package/lib/root.js ADDED
@@ -0,0 +1,9 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ /** 当前文件的绝对路径 */
4
+ const filePath = fileURLToPath(import.meta.url);
5
+ /** 插件包绝对路径 */
6
+ const dirPath = path.resolve(filePath, '../..');
7
+ /** 插件包的名称 */
8
+ const basename = path.basename(dirPath);
9
+ export { dirPath, basename };
@@ -0,0 +1,53 @@
1
+ /** markdown */
2
+ type Markdown = {
3
+ /** markdown模式 */
4
+ mode: 0 | 1 | 3 | 4 | 5;
5
+ /** 模板ID */
6
+ id: string;
7
+ /** 模板键配置 */
8
+ kv: string[];
9
+ };
10
+ /** `config.yaml` 文件的类型定义 */
11
+ export type Config = Record<string, {
12
+ /** 机器人ID */
13
+ appId: string;
14
+ /** 机器人密钥 */
15
+ secret: string;
16
+ /** 正式环境Api */
17
+ prodApi: string;
18
+ /** 测试环境Api */
19
+ sandboxApi: string;
20
+ /** 调用凭证的Api */
21
+ tokenApi: string;
22
+ /** 开启沙盒环境 */
23
+ sandbox: boolean;
24
+ /** 开启QQ场景能力 */
25
+ qqEnable: boolean;
26
+ /** 开启频道场景能力 */
27
+ guildEnable: boolean;
28
+ /** 频道场景模式 0-公域 1-私域 */
29
+ guildMode: 0 | 1;
30
+ /** 文本中的url转二维码白名单 配置后将不转换这些url为二维码 */
31
+ exclude: string[];
32
+ /** Markdown */
33
+ markdown: Markdown;
34
+ /** 接受到消息后对文本进行表达式处理 */
35
+ regex: {
36
+ /** 表达式 */
37
+ reg: string | RegExp;
38
+ /** 替换 */
39
+ rep: string;
40
+ }[];
41
+ /** 事件接收配置 */
42
+ event: {
43
+ /** 接收方式 0-关闭 1-webhook 2-http 3-ws */
44
+ type: 0 | 1 | 2 | 3;
45
+ /** ws服务器地址 */
46
+ wsUrl: string;
47
+ /** ws服务器鉴权token */
48
+ wsToken: string;
49
+ /** http鉴权token */
50
+ httpToken: string;
51
+ };
52
+ }>;
53
+ export {};
@@ -1,66 +1,80 @@
1
+ import EventEmitter from 'node:events';
1
2
  import { ButtonElement } from 'node-karin';
2
3
  /**
3
- * 二维码返回参数
4
+ * 事件总线
4
5
  */
5
- export interface QRRes {
6
- /** 二维码base64 */
7
- base64: string;
8
- /** 宽度 */
6
+ export declare const event: EventEmitter<[never]>;
7
+ /**
8
+ * 睡眠函数
9
+ * @param ms - 毫秒
10
+ */
11
+ export declare const sleep: (ms: number) => Promise<unknown>;
12
+ /**
13
+ * 生成随机数
14
+ * @param min - 最小值
15
+ * @param max - 最大值
16
+ */
17
+ export declare const random: (min: number, max: number) => number;
18
+ /**
19
+ * 调整express中间件和路由的顺序,将路由提升到中间件前面
20
+ * @param stack - express实例的stack
21
+ * @param path - 路由名称
22
+ * @param method - 请求方法
23
+ * @param middlewareName - 中间件名称
24
+ */
25
+ export declare const expressStack: (stack: any[], path: string, method: "use" | "get" | "post" | "put" | "delete", middlewareName: string) => void;
26
+ /**
27
+ * 调整express路由的顺序 使其在`expressInit`之后
28
+ * @param stack - express实例的stack
29
+ * @param path - 路由名称
30
+ * @param method - 请求方法
31
+ */
32
+ export declare const expressAfterInit: (stack: any[], path: string, method: "use" | "get" | "post" | "put" | "delete") => void;
33
+ /**
34
+ * 虚假事件
35
+ * @param log 日志
36
+ */
37
+ export declare const fakeEvent: (log: string) => void;
38
+ /**
39
+ * 处理url
40
+ * @param text - 文本
41
+ * @param exclude - 排除的URL
42
+ * @returns url列表
43
+ */
44
+ export declare const handleUrl: (text: string, exclude?: string[]) => string[];
45
+ /**
46
+ * 生成二维码
47
+ * @param urls - url列表
48
+ * @returns 返回带`base64://`前缀的二维码列表
49
+ */
50
+ export declare const qrs: (urls: string[]) => Promise<string[]>;
51
+ /**
52
+ * 语音文件转silk
53
+ * @param file 文件路径 base64 buffer
54
+ * @returns silk文件buffer
55
+ */
56
+ export declare const silkEncode: (file: string | Buffer) => Promise<Buffer>;
57
+ /**
58
+ * 处理文本 提取其中的url转为按钮
59
+ * @param text - 文本
60
+ * @param isC2C - 是否为C2C消息
61
+ */
62
+ export declare const textToButton: (text: string, isC2C?: boolean) => {
63
+ text: string;
64
+ buttons: ButtonElement[];
65
+ };
66
+ /**
67
+ * 传入一个图片链接,获取图片的宽高
68
+ * @param url - 图片链接
69
+ * @returns 图片的宽高
70
+ */
71
+ export declare const getImageSize: (url: string) => Promise<{
9
72
  width: number;
10
- /** 高度 */
11
73
  height: number;
12
- }
13
- declare class Common {
14
- /** ffmpeg */
15
- ffmpeg: string;
16
- constructor();
17
- random(min: number, max: number): number;
18
- /**
19
- * 语音转silk
20
- * @param voice - 语音文件
21
- * @returns silk buffer
22
- */
23
- voiceToSilk(voice: string): Promise<string>;
24
- /**
25
- * 初始化ffmpeg
26
- */
27
- initFfmpeg(): Promise<void>;
28
- /**
29
- * 处理URL
30
- * @param url - URL
31
- * @param exclude - 排除的URL
32
- */
33
- getUrls(url: string, exclude?: never[]): string[];
34
- /**
35
- * 传入URL数组,转为二维码base64
36
- * @param urls - URL数组
37
- */
38
- getQrCode(urls: string[]): Promise<QRRes>;
39
- /**
40
- * 传入文本 返回处理后的文本、图片
41
- * @param text - 文本
42
- */
43
- getQQBotText(text: string): Promise<{
44
- /** 处理后的文本 */
45
- text: string;
46
- /** 二维码数据 */
47
- data?: QRRes;
48
- }>;
49
- /**
50
- * 传入文本 处理文本 返回的按钮为多行按钮
51
- * @param text - 文本
52
- */
53
- getQQBotButton(text: string): {
54
- text: string;
55
- data: ButtonElement[];
56
- };
57
- /**
58
- * 传入文本 将文本一些特殊字符转义去除 用于处理markdown
59
- * @param text - 文本
60
- * @param isC2C - 是否是C2C
61
- * @returns 处理后的文本
62
- */
63
- formatText(text: string, isC2C?: boolean): string;
64
- }
65
- export declare const common: Common;
66
- export {};
74
+ }>;
75
+ /**
76
+ * 处理模板文本,对不能直接发送的 Markdown 语法进行转义
77
+ * @param text - 文本
78
+ * @returns 转义后的文本
79
+ */
80
+ export declare const escapeMarkdown: (text: string) => string;