mioki 0.7.0 → 0.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/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, getQuoteMessage, 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 };
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 getQuoteMessage(event: MessageEvent, timeout?: number): Promise<GroupMessageEvent | PrivateMessageEvent | null>;
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, getQuoteMessage, 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 };
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, getQuoteMessage, 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 };
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 getQuoteMessage(event: MessageEvent, timeout?: number): Promise<GroupMessageEvent | PrivateMessageEvent | null>;
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, getQuoteMessage, 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 };
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-BcfUfnW0.mjs";
2
+ import { t as version } from "./package-z_NEfbNK.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
- getQuoteMessage: () => getQuoteMessage,
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 getQuoteMessage(event, timeout = 3e3) {
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.getQuoteMessage();
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 getQuoteMessage(event);
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 getQuoteMessage(event);
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 getQuoteMessage(event);
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 getQuoteMessage(event))?.sender.user_id || 0;
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
  }
@@ -933,9 +933,7 @@ async function noticeFriends(bot, friendIdList, message, delay = 1e3) {
933
933
  return;
934
934
  }
935
935
  for (const friendId of friendIdList) {
936
- const friend = await bot.pickFriend(friendId);
937
- if (!friend) continue;
938
- await friend.sendMsg(message);
936
+ await bot.sendPrivateMsg(friendId, message);
939
937
  await wait(delay);
940
938
  }
941
939
  }
@@ -965,7 +963,7 @@ async function noticeMainOwner(bot, message) {
965
963
  }
966
964
  const mainOwner = botConfig.owners[0];
967
965
  if (mainOwner) {
968
- await (await bot.pickFriend(mainOwner))?.sendMsg(message);
966
+ await bot.sendPrivateMsg(mainOwner, message);
969
967
  return;
970
968
  }
971
969
  throw new Error("请至少设置一个主人");
@@ -1826,5 +1824,5 @@ async function start(options = {}) {
1826
1824
  }
1827
1825
 
1828
1826
  //#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, getQuoteMessage, 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 };
1827
+ 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
1828
  //# sourceMappingURL=index.mjs.map