mioki 0.7.0 → 0.7.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/dist/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/package-C-2yoqkl.mjs +6 -0
- package/dist/package-C-2yoqkl.mjs.map +1 -0
- package/dist/{package-CBPOLltF.cjs → package-DtVmw4Ds.cjs} +2 -2
- package/dist/package-DtVmw4Ds.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/package-BcfUfnW0.mjs +0 -6
- package/dist/package-BcfUfnW0.mjs.map +0 -1
- package/dist/package-CBPOLltF.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,7 +30,7 @@ interface StartOptions {
|
|
|
30
30
|
}
|
|
31
31
|
declare function start(options?: StartOptions): Promise<void>;
|
|
32
32
|
declare namespace utils_d_exports {
|
|
33
|
-
export { AnyFunc, Arrayable, ChromeUA, CreateCmdOptions, Gettable, HasMessage, Noop, PureObject, START_TIME, base64Decode, base64Encode, box, clamp, colorize, colors, createCmd, createDB, createStore, dayjs, dedent, ensureBuffer, filesize, filter, find, formatDuration, formatQQLevel, fs, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getQQAvatarLink, getQuoteImage, getQuoteImageUrl,
|
|
33
|
+
export { AnyFunc, Arrayable, ChromeUA, CreateCmdOptions, Gettable, HasMessage, Noop, PureObject, START_TIME, base64Decode, base64Encode, box, clamp, colorize, colors, createCmd, createDB, createStore, dayjs, dedent, ensureBuffer, filesize, filter, find, formatDuration, formatQQLevel, fs, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getQQAvatarLink, getQuoteImage, getQuoteImageUrl, getQuoteMsg, getQuoteText, getTerminalInput, isBoolean, isDefined, isFunction, isGroupMsg, isNumber, isObject, isPrivateMsg, isString, jiti, localNum, localeDate, localeTime, match, md5, mri, noNullish, path, prettyMs, qs, queryDevToolsLoginStatus, randomId, randomInt, randomItem, randomItems, requestLoginViaDevTools, runWithReaction, string2argv, stringifyError, stripAnsi, systemInfo, text, toArray, toMsgId, unique, uuid, wait };
|
|
34
34
|
}
|
|
35
35
|
declare const ChromeUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0";
|
|
36
36
|
type Noop = () => void;
|
|
@@ -240,7 +240,7 @@ declare function getQQAvatarLink(qq: number, size?: number): string;
|
|
|
240
240
|
*/
|
|
241
241
|
declare function getGroupAvatarLink(group: number, size?: number): string;
|
|
242
242
|
/** 获取引用回复的消息 */
|
|
243
|
-
declare function
|
|
243
|
+
declare function getQuoteMsg(event: MessageEvent, timeout?: number): Promise<GroupMessageEvent | PrivateMessageEvent | null>;
|
|
244
244
|
/**
|
|
245
245
|
* 获取原创表情包的图片链接
|
|
246
246
|
*/
|
|
@@ -662,5 +662,5 @@ declare function findLocalPlugins(): Promise<{
|
|
|
662
662
|
absPath: string;
|
|
663
663
|
}[]>;
|
|
664
664
|
//#endregion
|
|
665
|
-
export { AnyFunc, Arrayable, BOT_CWD, ChromeUA, CreateCmdOptions, Gettable, HasMessage, MiokiConfig, MiokiContext, MiokiPlugin, MiokiServices, Noop, OmitBotParamFromFunc, PureObject, START_TIME, StartOptions, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl,
|
|
665
|
+
export { AnyFunc, Arrayable, BOT_CWD, ChromeUA, CreateCmdOptions, Gettable, HasMessage, MiokiConfig, MiokiContext, MiokiPlugin, MiokiServices, Noop, OmitBotParamFromFunc, PureObject, START_TIME, StartOptions, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl, getQuoteMsg, getQuoteText, getTerminalInput, getViolationRecords, hasRight, isAdmin, isBoolean, isDefined, isFunction, isGroupMsg, isInPm2, isNumber, isObject, isOwner, isOwnerOrAdmin, isPrivateMsg, isString, jiti, localNum, localeDate, localeTime, logger, match, md5, mri, noNullish, noticeAdmins, noticeFriends, noticeGroups, noticeMainOwner, noticeOwners, path, prettyMs, qs, queryDevToolsLoginStatus, randomId, randomInt, randomItem, randomItems, readMiokiConfig, readPackageJson, requestLoginViaDevTools, runWithErrorHandler, runWithReaction, runtimePlugins, services, signArk, start, string2argv, stringifyError, stripAnsi, systemInfo, text, toArray, toMsgId, unique, updateBotCWD, updateBotConfig, uploadImageToCollection, uploadImageToGroupHomework, uploadImageToGroupNotice, uuid, wait, writePackageJson };
|
|
666
666
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -28,7 +28,7 @@ interface StartOptions {
|
|
|
28
28
|
}
|
|
29
29
|
declare function start(options?: StartOptions): Promise<void>;
|
|
30
30
|
declare namespace utils_d_exports {
|
|
31
|
-
export { AnyFunc, Arrayable, ChromeUA, CreateCmdOptions, Gettable, HasMessage, Noop, PureObject, START_TIME, base64Decode, base64Encode, box, clamp, colorize, colors, createCmd, createDB, createStore, dayjs, dedent, ensureBuffer, filesize, filter, find, formatDuration, formatQQLevel, fs, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getQQAvatarLink, getQuoteImage, getQuoteImageUrl,
|
|
31
|
+
export { AnyFunc, Arrayable, ChromeUA, CreateCmdOptions, Gettable, HasMessage, Noop, PureObject, START_TIME, base64Decode, base64Encode, box, clamp, colorize, colors, createCmd, createDB, createStore, dayjs, dedent, ensureBuffer, filesize, filter, find, formatDuration, formatQQLevel, fs, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getQQAvatarLink, getQuoteImage, getQuoteImageUrl, getQuoteMsg, getQuoteText, getTerminalInput, isBoolean, isDefined, isFunction, isGroupMsg, isNumber, isObject, isPrivateMsg, isString, jiti, localNum, localeDate, localeTime, match, md5, mri, noNullish, path, prettyMs, qs, queryDevToolsLoginStatus, randomId, randomInt, randomItem, randomItems, requestLoginViaDevTools, runWithReaction, string2argv, stringifyError, stripAnsi, systemInfo, text, toArray, toMsgId, unique, uuid, wait };
|
|
32
32
|
}
|
|
33
33
|
declare const ChromeUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0";
|
|
34
34
|
type Noop = () => void;
|
|
@@ -238,7 +238,7 @@ declare function getQQAvatarLink(qq: number, size?: number): string;
|
|
|
238
238
|
*/
|
|
239
239
|
declare function getGroupAvatarLink(group: number, size?: number): string;
|
|
240
240
|
/** 获取引用回复的消息 */
|
|
241
|
-
declare function
|
|
241
|
+
declare function getQuoteMsg(event: MessageEvent, timeout?: number): Promise<GroupMessageEvent | PrivateMessageEvent | null>;
|
|
242
242
|
/**
|
|
243
243
|
* 获取原创表情包的图片链接
|
|
244
244
|
*/
|
|
@@ -660,5 +660,5 @@ declare function findLocalPlugins(): Promise<{
|
|
|
660
660
|
absPath: string;
|
|
661
661
|
}[]>;
|
|
662
662
|
//#endregion
|
|
663
|
-
export { AnyFunc, Arrayable, BOT_CWD, ChromeUA, CreateCmdOptions, Gettable, HasMessage, MiokiConfig, MiokiContext, MiokiPlugin, MiokiServices, Noop, OmitBotParamFromFunc, PureObject, START_TIME, StartOptions, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl,
|
|
663
|
+
export { AnyFunc, Arrayable, BOT_CWD, ChromeUA, CreateCmdOptions, Gettable, HasMessage, MiokiConfig, MiokiContext, MiokiPlugin, MiokiServices, Noop, OmitBotParamFromFunc, PureObject, START_TIME, StartOptions, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl, getQuoteMsg, getQuoteText, getTerminalInput, getViolationRecords, hasRight, isAdmin, isBoolean, isDefined, isFunction, isGroupMsg, isInPm2, isNumber, isObject, isOwner, isOwnerOrAdmin, isPrivateMsg, isString, jiti, localNum, localeDate, localeTime, logger, match, md5, mri, noNullish, noticeAdmins, noticeFriends, noticeGroups, noticeMainOwner, noticeOwners, path, prettyMs, qs, queryDevToolsLoginStatus, randomId, randomInt, randomItem, randomItems, readMiokiConfig, readPackageJson, requestLoginViaDevTools, runWithErrorHandler, runWithReaction, runtimePlugins, services, signArk, start, string2argv, stringifyError, stripAnsi, systemInfo, text, toArray, toMsgId, unique, updateBotCWD, updateBotConfig, uploadImageToCollection, uploadImageToGroupHomework, uploadImageToGroupNotice, uuid, wait, writePackageJson };
|
|
664
664
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __export } from "./chunk-DYZpOiH0.mjs";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-C-2yoqkl.mjs";
|
|
3
3
|
import fs, { default as fs$1 } from "node:fs";
|
|
4
4
|
import util from "node:util";
|
|
5
5
|
import path, { default as path$1 } from "node:path";
|
|
@@ -57,7 +57,7 @@ var utils_exports = /* @__PURE__ */ __export({
|
|
|
57
57
|
getQQAvatarLink: () => getQQAvatarLink,
|
|
58
58
|
getQuoteImage: () => getQuoteImage,
|
|
59
59
|
getQuoteImageUrl: () => getQuoteImageUrl,
|
|
60
|
-
|
|
60
|
+
getQuoteMsg: () => getQuoteMsg,
|
|
61
61
|
getQuoteText: () => getQuoteText,
|
|
62
62
|
getTerminalInput: () => getTerminalInput,
|
|
63
63
|
isBoolean: () => isBoolean,
|
|
@@ -442,7 +442,7 @@ function getGroupAvatarLink(group, size = 640) {
|
|
|
442
442
|
}
|
|
443
443
|
const messageCacheMap = /* @__PURE__ */ new Map();
|
|
444
444
|
/** 获取引用回复的消息 */
|
|
445
|
-
async function
|
|
445
|
+
async function getQuoteMsg(event, timeout = 3e3) {
|
|
446
446
|
if (!event.quote_id) return null;
|
|
447
447
|
const quote_id = event.quote_id;
|
|
448
448
|
const key = isGroupMsg(event) ? `${event.group_id}_${quote_id}` : `${event.sender.user_id}_${quote_id}`;
|
|
@@ -465,7 +465,7 @@ async function getQuoteMessage(event, timeout = 3e3) {
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
messageCacheMap.set(key, "loading");
|
|
468
|
-
const msg = await event.
|
|
468
|
+
const msg = await event.getQuoteMsg();
|
|
469
469
|
if (messageCacheMap.size > 100) messageCacheMap.clear();
|
|
470
470
|
messageCacheMap.set(key, msg);
|
|
471
471
|
return msg;
|
|
@@ -499,7 +499,7 @@ async function getImageUrl(event) {
|
|
|
499
499
|
* 获取引用回复的消息中的图片链接
|
|
500
500
|
*/
|
|
501
501
|
async function getQuoteImageUrl(event) {
|
|
502
|
-
const quoteMsg = await
|
|
502
|
+
const quoteMsg = await getQuoteMsg(event);
|
|
503
503
|
if (!quoteMsg) return "";
|
|
504
504
|
return await getImageUrl(quoteMsg);
|
|
505
505
|
}
|
|
@@ -519,7 +519,7 @@ function getImage(event) {
|
|
|
519
519
|
* 获取引用回复的图片消息
|
|
520
520
|
*/
|
|
521
521
|
async function getQuoteImage(event) {
|
|
522
|
-
const quoteMsg = await
|
|
522
|
+
const quoteMsg = await getQuoteMsg(event);
|
|
523
523
|
if (quoteMsg) return find(quoteMsg.message, "image") || null;
|
|
524
524
|
return null;
|
|
525
525
|
}
|
|
@@ -549,7 +549,7 @@ function text(event, options = {}) {
|
|
|
549
549
|
* 获取回复的消息中的文本内容
|
|
550
550
|
*/
|
|
551
551
|
async function getQuoteText(event) {
|
|
552
|
-
const msg = await
|
|
552
|
+
const msg = await getQuoteMsg(event);
|
|
553
553
|
if (!msg) return "";
|
|
554
554
|
return text(msg);
|
|
555
555
|
}
|
|
@@ -557,7 +557,7 @@ async function getQuoteText(event) {
|
|
|
557
557
|
* 获取提到的用户 QQ 号,可以通过 if(!qq) 判断是否提到了用户,返回 0 代表没有提到用户
|
|
558
558
|
*/
|
|
559
559
|
async function getMentionedUserId(event) {
|
|
560
|
-
const quoteId = (await
|
|
560
|
+
const quoteId = (await getQuoteMsg(event))?.sender.user_id || 0;
|
|
561
561
|
const msgAtId = +(find(event.message, "at")?.qq || 0);
|
|
562
562
|
return Number.isNaN(msgAtId) || !msgAtId ? quoteId : msgAtId;
|
|
563
563
|
}
|
|
@@ -1826,5 +1826,5 @@ async function start(options = {}) {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
|
|
1828
1828
|
//#endregion
|
|
1829
|
-
export { BOT_CWD, ChromeUA, START_TIME, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl,
|
|
1829
|
+
export { BOT_CWD, ChromeUA, START_TIME, addService, base64Decode, base64Encode, bindBot, botConfig, box, clamp, colorize, colors, createCmd, createDB, createForwardMsg, createStore, dayjs, dedent, definePlugin, enablePlugin, ensureBuffer, ensurePluginDir, filesize, filter, find, findLocalPlugins, formatDuration, formatQQLevel, fs, getAbsPluginDir, getAuthCodeViaTicket, getBfaceUrl, getGroupAvatarLink, getImage, getImageUrl, getLogFilePath, getMentionedImage, getMentionedImageUrl, getMentionedUserId, getMinicoTokenViaAuthCode, getMiokiLogger, getQQAvatarLink, getQuoteImage, getQuoteImageUrl, getQuoteMsg, getQuoteText, getTerminalInput, getViolationRecords, hasRight, isAdmin, isBoolean, isDefined, isFunction, isGroupMsg, isInPm2, isNumber, isObject, isOwner, isOwnerOrAdmin, isPrivateMsg, isString, jiti, localNum, localeDate, localeTime, logger, match, md5, mri, noNullish, noticeAdmins, noticeFriends, noticeGroups, noticeMainOwner, noticeOwners, path, prettyMs, qs, queryDevToolsLoginStatus, randomId, randomInt, randomItem, randomItems, readMiokiConfig, readPackageJson, requestLoginViaDevTools, runWithErrorHandler, runWithReaction, runtimePlugins, services, signArk, start, string2argv, stringifyError, stripAnsi, systemInfo, text, toArray, toMsgId, unique, updateBotCWD, updateBotConfig, uploadImageToCollection, uploadImageToGroupHomework, uploadImageToGroupNotice, uuid, wait, writePackageJson };
|
|
1830
1830
|
//# sourceMappingURL=index.mjs.map
|