dsh-qq-tools 0.9.5 → 0.10.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.
Files changed (41) hide show
  1. package/README.md +23 -11
  2. package/cordis.patch.yml +1 -1
  3. package/lib/config.js +96 -0
  4. package/lib/images.js +420 -0
  5. package/lib/index.js +2 -1
  6. package/lib/mount-all.js +59 -0
  7. package/lib/observation.js +24 -0
  8. package/lib/onebot.js +32 -0
  9. package/lib/prompts.js +56 -0
  10. package/lib/qq-state.js +51 -0
  11. package/lib/render.js +49 -0
  12. package/lib/session.js +201 -0
  13. package/lib/shared.js +26 -3377
  14. package/lib/tools/avatar.js +54 -0
  15. package/lib/tools/faces.js +296 -0
  16. package/lib/tools/friends.js +559 -0
  17. package/lib/tools/groups.js +220 -0
  18. package/lib/tools/poke.js +41 -0
  19. package/lib/tools/private.js +190 -0
  20. package/lib/tools/qzone.js +569 -0
  21. package/lib/utils.js +73 -0
  22. package/lib/watchers/mentions.js +167 -0
  23. package/lib/watchers/poke.js +87 -0
  24. package/lib/watchers/private.js +95 -0
  25. package/lib/watchers/ws.js +61 -0
  26. package/package.json +98 -103
  27. package/tools/qq-favorite-faces/index.js +11 -10
  28. package/tools/qq-favorite-faces/locale/en.json +1 -1
  29. package/tools/qq-favorite-faces/locale/zh.json +1 -1
  30. package/tools/qq-friend-management/index.js +28 -28
  31. package/tools/qq-get-group-history/index.js +10 -8
  32. package/tools/qq-get-group-members/index.js +9 -8
  33. package/tools/qq-list-groups/index.js +9 -8
  34. package/tools/qq-private-chat/index.js +16 -20
  35. package/tools/qq-qzone/index.js +22 -22
  36. package/tools/qq-send-face/index.js +11 -8
  37. package/tools/qq-send-face/locale/en.json +1 -1
  38. package/tools/qq-send-face/locale/zh.json +1 -1
  39. package/tools/qq-send-group-message/index.js +13 -10
  40. package/tools/qq-send-poke/index.js +13 -10
  41. package/tools/qq-set-avatar/index.js +9 -8
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "收藏表情",
4
- "description": "管理 QQ 账号的收藏表情(SnowLuma):看收藏夹、收藏图片或消息里的表情、取消收藏、改备注、移到最前。"
4
+ "description": "管理 QQ 账号的收藏表情(SnowLuma):看收藏夹的 emoji_id 和文字备注、收藏图片或消息里的表情、取消收藏、改备注、移到最前。"
5
5
  }
6
6
  }
@@ -1,28 +1,28 @@
1
- import {
2
- makeDeleteFriendTool,
3
- makeGetFriendInfoTool,
4
- makeHandleFriendRequestTool,
5
- makeListFriendCategoriesTool,
6
- makeListFriendRequestsTool,
7
- makeSendLikeTool,
8
- makeUpdateFriendTool,
9
- mountOneTool,
10
- startFriendRequestWatcher,
11
- } from '../../lib/shared.js'
12
-
13
- export const name = 'qq-tools-friend-management'
14
- export const inject = ['agents', 'timer', 'tools']
15
-
16
- export function apply(ctx) {
17
- const tools = [
18
- mountOneTool(ctx, makeGetFriendInfoTool()),
19
- mountOneTool(ctx, makeListFriendCategoriesTool()),
20
- mountOneTool(ctx, makeUpdateFriendTool()),
21
- mountOneTool(ctx, makeDeleteFriendTool()),
22
- mountOneTool(ctx, makeSendLikeTool()),
23
- mountOneTool(ctx, makeListFriendRequestsTool()),
24
- mountOneTool(ctx, makeHandleFriendRequestTool()),
25
- ]
26
- startFriendRequestWatcher(ctx)
27
- return { tools }
28
- }
1
+ import {
2
+ makeDeleteFriendTool,
3
+ makeGetFriendInfoTool,
4
+ makeHandleFriendRequestTool,
5
+ makeListFriendCategoriesTool,
6
+ makeListFriendRequestsTool,
7
+ makeSendLikeTool,
8
+ makeUpdateFriendTool,
9
+ startFriendRequestWatcher,
10
+ } from '../../lib/tools/friends.js'
11
+ import { mountOneTool } from '../../lib/session.js'
12
+
13
+ export const name = 'qq-tools-friend-management'
14
+ export const inject = ['agents', 'timer', 'tools']
15
+
16
+ export function apply(ctx) {
17
+ const tools = [
18
+ mountOneTool(ctx, makeGetFriendInfoTool()),
19
+ mountOneTool(ctx, makeListFriendCategoriesTool()),
20
+ mountOneTool(ctx, makeUpdateFriendTool()),
21
+ mountOneTool(ctx, makeDeleteFriendTool()),
22
+ mountOneTool(ctx, makeSendLikeTool()),
23
+ mountOneTool(ctx, makeListFriendRequestsTool()),
24
+ mountOneTool(ctx, makeHandleFriendRequestTool()),
25
+ ]
26
+ startFriendRequestWatcher(ctx)
27
+ return { tools }
28
+ }
@@ -1,8 +1,10 @@
1
- import { admitImagesFor, makeHistoryTool, mountOneTool } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-group-history'
4
- export const inject = ['agents', 'timer', 'tools', 'attachments']
5
-
6
- export function apply(ctx) {
7
- return mountOneTool(ctx, makeHistoryTool(admitImagesFor(ctx)))
8
- }
1
+ import { admitImagesFor } from '../../lib/images.js'
2
+ import { makeHistoryTool } from '../../lib/tools/groups.js'
3
+ import { mountOneTool } from '../../lib/session.js'
4
+
5
+ export const name = 'qq-tools-group-history'
6
+ export const inject = ['agents', 'timer', 'tools', 'attachments']
7
+
8
+ export function apply(ctx) {
9
+ return mountOneTool(ctx, makeHistoryTool(admitImagesFor(ctx)))
10
+ }
@@ -1,8 +1,9 @@
1
- import { makeMembersTool, mountOneTool } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-group-members'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- return mountOneTool(ctx, makeMembersTool())
8
- }
1
+ import { makeMembersTool } from '../../lib/tools/groups.js'
2
+ import { mountOneTool } from '../../lib/session.js'
3
+
4
+ export const name = 'qq-tools-group-members'
5
+ export const inject = ['agents', 'timer', 'tools']
6
+
7
+ export function apply(ctx) {
8
+ return mountOneTool(ctx, makeMembersTool())
9
+ }
@@ -1,8 +1,9 @@
1
- import { makeListTool, mountOneTool } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-list-groups'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- return mountOneTool(ctx, makeListTool())
8
- }
1
+ import { makeListTool } from '../../lib/tools/groups.js'
2
+ import { mountOneTool } from '../../lib/session.js'
3
+
4
+ export const name = 'qq-tools-list-groups'
5
+ export const inject = ['agents', 'timer', 'tools']
6
+
7
+ export function apply(ctx) {
8
+ return mountOneTool(ctx, makeListTool())
9
+ }
@@ -1,20 +1,16 @@
1
- import {
2
- admitImagesFor,
3
- makeListFriendsTool,
4
- makePrivateHistoryTool,
5
- makeSendPrivateTool,
6
- mountOneTool,
7
- startPrivateWatcher,
8
- } from '../../lib/shared.js'
9
-
10
- export const name = 'qq-tools-private-chat'
11
- export const inject = ['agents', 'timer', 'tools', 'attachments']
12
-
13
- export function apply(ctx) {
14
- const admitImages = admitImagesFor(ctx)
15
- const friends = mountOneTool(ctx, makeListFriendsTool())
16
- const history = mountOneTool(ctx, makePrivateHistoryTool(admitImages))
17
- const send = mountOneTool(ctx, makeSendPrivateTool())
18
- startPrivateWatcher(ctx, admitImages)
19
- return { tools: [friends, history, send] }
20
- }
1
+ import { admitImagesFor } from '../../lib/images.js'
2
+ import { makeListFriendsTool, makePrivateHistoryTool, makeSendPrivateTool } from '../../lib/tools/private.js'
3
+ import { mountOneTool } from '../../lib/session.js'
4
+ import { startPrivateWatcher } from '../../lib/watchers/private.js'
5
+
6
+ export const name = 'qq-tools-private-chat'
7
+ export const inject = ['agents', 'timer', 'tools', 'attachments']
8
+
9
+ export function apply(ctx) {
10
+ const admitImages = admitImagesFor(ctx)
11
+ const friends = mountOneTool(ctx, makeListFriendsTool())
12
+ const history = mountOneTool(ctx, makePrivateHistoryTool(admitImages))
13
+ const send = mountOneTool(ctx, makeSendPrivateTool())
14
+ startPrivateWatcher(ctx, admitImages)
15
+ return { tools: [friends, history, send] }
16
+ }
@@ -1,22 +1,22 @@
1
- import {
2
- admitImagesFor,
3
- makeGetQzonePostTool,
4
- makeListQzoneTool,
5
- makeManageQzoneTool,
6
- makeSendQzonePostTool,
7
- mountOneTool,
8
- } from '../../lib/shared.js'
9
-
10
- export const name = 'qq-tools-qzone'
11
- export const inject = ['agents', 'timer', 'tools', 'attachments']
12
-
13
- export function apply(ctx) {
14
- const admitImages = admitImagesFor(ctx)
15
- const tools = [
16
- mountOneTool(ctx, makeListQzoneTool(admitImages)),
17
- mountOneTool(ctx, makeGetQzonePostTool(admitImages)),
18
- mountOneTool(ctx, makeSendQzonePostTool()),
19
- mountOneTool(ctx, makeManageQzoneTool()),
20
- ]
21
- return { tools }
22
- }
1
+ import { admitImagesFor } from '../../lib/images.js'
2
+ import {
3
+ makeGetQzonePostTool,
4
+ makeListQzoneTool,
5
+ makeManageQzoneTool,
6
+ makeSendQzonePostTool,
7
+ } from '../../lib/tools/qzone.js'
8
+ import { mountOneTool } from '../../lib/session.js'
9
+
10
+ export const name = 'qq-tools-qzone'
11
+ export const inject = ['agents', 'timer', 'tools', 'attachments']
12
+
13
+ export function apply(ctx) {
14
+ const admitImages = admitImagesFor(ctx)
15
+ const tools = [
16
+ mountOneTool(ctx, makeListQzoneTool(admitImages)),
17
+ mountOneTool(ctx, makeGetQzonePostTool(admitImages)),
18
+ mountOneTool(ctx, makeSendQzonePostTool()),
19
+ mountOneTool(ctx, makeManageQzoneTool()),
20
+ ]
21
+ return { tools }
22
+ }
@@ -1,8 +1,11 @@
1
- import { makeSendFaceTool, mountOneTool, startObservation } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-send-face'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- return mountOneTool(ctx, makeSendFaceTool(startObservation))
8
- }
1
+ import { admitImagesFor } from '../../lib/images.js'
2
+ import { makeSendFaceTool } from '../../lib/tools/faces.js'
3
+ import { mountOneTool } from '../../lib/session.js'
4
+ import { startObservation } from '../../lib/observation.js'
5
+
6
+ export const name = 'qq-tools-send-face'
7
+ export const inject = ['agents', 'timer', 'tools', 'attachments']
8
+
9
+ export function apply(ctx) {
10
+ return mountOneTool(ctx, makeSendFaceTool(startObservation, admitImagesFor(ctx)))
11
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Send face",
4
- "description": "Send a QQ system face or a saved custom face to a group or private chat, optionally with a line of text."
4
+ "description": "Send a saved QQ custom face to a group or private chat, optionally with a line of text; preview the image before sending."
5
5
  }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "发表情",
4
- "description": "在群里或私聊里发一个表情:系统表情或 QQ 收藏夹里的自定义表情,可以顺带一句话。"
4
+ "description": "在群里或私聊里发一个 QQ 收藏夹里的自定义表情,可以顺带一句话;正式发之前可以先预览这张图。"
5
5
  }
6
6
  }
@@ -1,10 +1,13 @@
1
- import { makeSendTool, mountOneTool, startMentionPolling, startObservation } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-send-group-message'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- const mounted = mountOneTool(ctx, makeSendTool(startObservation))
8
- startMentionPolling(ctx)
9
- return mounted
10
- }
1
+ import { makeSendTool } from '../../lib/tools/groups.js'
2
+ import { mountOneTool } from '../../lib/session.js'
3
+ import { startMentionPolling } from '../../lib/watchers/mentions.js'
4
+ import { startObservation } from '../../lib/observation.js'
5
+
6
+ export const name = 'qq-tools-send-group-message'
7
+ export const inject = ['agents', 'timer', 'tools']
8
+
9
+ export function apply(ctx) {
10
+ const mounted = mountOneTool(ctx, makeSendTool(startObservation))
11
+ startMentionPolling(ctx)
12
+ return mounted
13
+ }
@@ -1,10 +1,13 @@
1
- import { makePokeTool, mountOneTool, startObservation, startPokeWatcher } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-send-poke'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- const mounted = mountOneTool(ctx, makePokeTool(startObservation))
8
- startPokeWatcher(ctx)
9
- return mounted
10
- }
1
+ import { makePokeTool } from '../../lib/tools/poke.js'
2
+ import { mountOneTool } from '../../lib/session.js'
3
+ import { startObservation } from '../../lib/observation.js'
4
+ import { startPokeWatcher } from '../../lib/watchers/poke.js'
5
+
6
+ export const name = 'qq-tools-send-poke'
7
+ export const inject = ['agents', 'timer', 'tools']
8
+
9
+ export function apply(ctx) {
10
+ const mounted = mountOneTool(ctx, makePokeTool(startObservation))
11
+ startPokeWatcher(ctx)
12
+ return mounted
13
+ }
@@ -1,8 +1,9 @@
1
- import { makeSetAvatarTool, mountOneTool } from '../../lib/shared.js'
2
-
3
- export const name = 'qq-tools-set-avatar'
4
- export const inject = ['agents', 'timer', 'tools']
5
-
6
- export function apply(ctx) {
7
- return mountOneTool(ctx, makeSetAvatarTool())
8
- }
1
+ import { makeSetAvatarTool } from '../../lib/tools/avatar.js'
2
+ import { mountOneTool } from '../../lib/session.js'
3
+
4
+ export const name = 'qq-tools-set-avatar'
5
+ export const inject = ['agents', 'timer', 'tools']
6
+
7
+ export function apply(ctx) {
8
+ return mountOneTool(ctx, makeSetAvatarTool())
9
+ }