koishi-plugin-chat-patch 5.0.3 → 5.3.0

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 (32) hide show
  1. package/client/web/dist/assets/Chat-B448YOeN.js +28 -0
  2. package/client/web/dist/assets/{MsgBody-LNGNGtE3.js → MsgBody-DDacjWJ9.js} +1 -1
  3. package/client/web/dist/assets/MsgBody.vue_vue_type_script_setup_true_lang-B1dWyCB0.js +67 -0
  4. package/client/web/dist/assets/{index-CwyyQN13.js → index-BlLut5xn.js} +121 -129
  5. package/client/web/dist/assets/index-fW_zcub3.css +1 -0
  6. package/client/web/dist/assets/pinyin-Dsq98249.js +157657 -0
  7. package/client/web/dist/index.html +2 -2
  8. package/client/web/dist/notice_local.json +1 -0
  9. package/client/web/package-lock.json +49 -0
  10. package/client/web/package.json +1 -0
  11. package/client/web/public/notice_local.json +1 -0
  12. package/client/web/src/components/EmojiFace.vue +0 -6
  13. package/client/web/src/components/FacePan.vue +0 -12
  14. package/client/web/src/components/MsgBody.vue +3 -4
  15. package/client/web/src/components/SettingsTab.vue +133 -0
  16. package/client/web/src/function/connect.ts +42 -21
  17. package/client/web/src/function/model/emoji.ts +7 -67
  18. package/client/web/src/function/msg.ts +74 -23
  19. package/client/web/src/function/satori-model.ts +4 -3
  20. package/client/web/src/function/utils/appUtil.ts +1 -4
  21. package/client/web/src/function/utils/msgUtil.ts +121 -87
  22. package/client/web/src/function/utils/pinyin.ts +25 -65
  23. package/client/web/src/function/utils/sessionUtil.ts +107 -9
  24. package/client/web/src/pages/Friends.vue +49 -13
  25. package/client/web/src/pages/Messages.vue +45 -14
  26. package/client/web/src/pages/Options.vue +4 -4
  27. package/client/web/src/pages/options/OptDev.vue +1 -14
  28. package/package.json +1 -1
  29. package/src/web.ts +712 -712
  30. package/client/web/dist/assets/Chat-CXjwWCiV.js +0 -28
  31. package/client/web/dist/assets/MsgBody.vue_vue_type_script_setup_true_lang-BK5okBfM.js +0 -67
  32. package/client/web/dist/assets/index-BgOX_tNa.css +0 -1
@@ -11,8 +11,8 @@
11
11
  <link rel="stylesheet" href="./bcui/css/style.css">
12
12
  <link rel="stylesheet" href="./bcui/css/color-light.css">
13
13
  <link rel="stylesheet" href="./css/append-light.css">
14
- <script type="module" crossorigin src="./assets/index-CwyyQN13.js"></script>
15
- <link rel="stylesheet" crossorigin href="./assets/index-BgOX_tNa.css">
14
+ <script type="module" crossorigin src="./assets/index-BlLut5xn.js"></script>
15
+ <link rel="stylesheet" crossorigin href="./assets/index-fW_zcub3.css">
16
16
  </head>
17
17
 
18
18
  <body>
@@ -0,0 +1 @@
1
+ []
@@ -30,6 +30,7 @@
30
30
  "jsonpath": "^1.1.1",
31
31
  "markdown-it": "^14.1.1",
32
32
  "pinia": "^3.0.3",
33
+ "pinyin": "^4.0.0",
33
34
  "pofile": "^1.1.4",
34
35
  "querystring": "^0.2.1",
35
36
  "spacingjs": "^1.0.8",
@@ -2422,6 +2423,12 @@
2422
2423
  "underscore": "1.13.6"
2423
2424
  }
2424
2425
  },
2426
+ "node_modules/keypress": {
2427
+ "version": "0.1.0",
2428
+ "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz",
2429
+ "integrity": "sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA==",
2430
+ "license": "MIT"
2431
+ },
2425
2432
  "node_modules/klona": {
2426
2433
  "version": "2.0.6",
2427
2434
  "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz",
@@ -2645,6 +2652,48 @@
2645
2652
  }
2646
2653
  }
2647
2654
  },
2655
+ "node_modules/pinyin": {
2656
+ "version": "4.0.0",
2657
+ "resolved": "https://registry.npmjs.org/pinyin/-/pinyin-4.0.0.tgz",
2658
+ "integrity": "sha512-vHpV5K+vpp6XUUpZNGRDuHoN+1xcmieM3EWlH4QjSX2kkpG/gVOwpqwV9EOJ9x9c9UERFKeLml5XVSukE/PLgQ==",
2659
+ "license": "MIT",
2660
+ "dependencies": {
2661
+ "commander": "~1.1.1"
2662
+ },
2663
+ "bin": {
2664
+ "pinyin": "bin/pinyin"
2665
+ },
2666
+ "engines": {
2667
+ "install-node": "^18.0.0"
2668
+ },
2669
+ "peerDependencies": {
2670
+ "@node-rs/jieba": "^1.6.0",
2671
+ "nodejieba": "^3.4.4",
2672
+ "segmentit": "^2.0.3"
2673
+ },
2674
+ "peerDependenciesMeta": {
2675
+ "@node-rs/jieba": {
2676
+ "optional": true
2677
+ },
2678
+ "nodejieba": {
2679
+ "optional": true
2680
+ },
2681
+ "segmentit": {
2682
+ "optional": true
2683
+ }
2684
+ }
2685
+ },
2686
+ "node_modules/pinyin/node_modules/commander": {
2687
+ "version": "1.1.1",
2688
+ "resolved": "https://registry.npmjs.org/commander/-/commander-1.1.1.tgz",
2689
+ "integrity": "sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA==",
2690
+ "dependencies": {
2691
+ "keypress": "0.1.x"
2692
+ },
2693
+ "engines": {
2694
+ "node": ">= 0.6.x"
2695
+ }
2696
+ },
2648
2697
  "node_modules/pofile": {
2649
2698
  "version": "1.1.4",
2650
2699
  "resolved": "https://registry.npmjs.org/pofile/-/pofile-1.1.4.tgz",
@@ -33,6 +33,7 @@
33
33
  "jsonpath": "^1.1.1",
34
34
  "markdown-it": "^14.1.1",
35
35
  "pinia": "^3.0.3",
36
+ "pinyin": "^4.0.0",
36
37
  "pofile": "^1.1.4",
37
38
  "querystring": "^0.2.1",
38
39
  "spacingjs": "^1.0.8",
@@ -0,0 +1 @@
1
+ []
@@ -10,12 +10,6 @@
10
10
  :icon="['fas', 'face-grin-wide']"
11
11
  :title="$t('表情')"
12
12
  class="emoji-face" />
13
- <img v-else-if="emoji.type === 'apng'"
14
- class="emoji-face"
15
- loading="lazy"
16
- :alt="emoji.description"
17
- :title="emoji.description"
18
- :src="emoji.value">
19
13
  <span v-else
20
14
  :title="emoji.description"
21
15
  class="emoji-face">
@@ -26,18 +26,6 @@
26
26
  </template>
27
27
  </div>
28
28
  </template>
29
- <div class="title">
30
- <span>{{ $t('小黄脸表情') }}</span>
31
- </div>
32
- <div class="face">
33
- <template v-for="num in Emoji.normalList" :key="num">
34
- <div>
35
- <EmojiFace
36
- :emoji="Emoji.get(num)"
37
- @click="addBaseFace(num)" />
38
- </div>
39
- </template>
40
- </div>
41
29
  <div class="title">
42
30
  <span>{{ $t('emoji 表情') }}</span>
43
31
  </div>
@@ -81,9 +81,9 @@
81
81
  <!-- 超级表情 -->
82
82
  <template v-else-if="isSuperFaceMsg()">
83
83
  <div class="msg-img face lottie-face alone">
84
- <LazyLottie
85
- :animation-link="Emoji.get(Number(data.message[0].id))!.superValue!"
86
- :title="Emoji.get(Number(data.message[0].id))!.description" />
84
+ <EmojiFace
85
+ :emoji="Emoji.get(Number(data.message[0].id))!"
86
+ class="msg-face" />
87
87
  </div>
88
88
  </template>
89
89
  <template v-else-if="!hasCard()">
@@ -436,7 +436,6 @@ const chatStore = useChatStore()
436
436
  const settingsStore = useSettingsStore()
437
437
  import Emoji from '../function/model/emoji'
438
438
  import EmojiFace from './EmojiFace.vue'
439
- import LazyLottie from './LazyLottie.vue'
440
439
  import { Img } from '../function/model/img'
441
440
  import { dbGetImage, hashUrl } from '../function/utils/localHistoryUtil'
442
441
  import JsonSegComp from './msg-component/JsonSegComp.vue'
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <!-- 设置页专用选项卡,避免 BcTab 在多实例/HMR 下取错 tab body -->
3
+ <div class="tab-main">
4
+ <Card>
5
+ <ul v-if="tabs.length" class="tab-bar">
6
+ <span v-if="title">{{ title }}</span>
7
+ <li
8
+ v-for="(tab, index) in tabs"
9
+ :key="tab.name"
10
+ :class="{ select: activeIndex === index }"
11
+ @click="selectTab(index)">
12
+ <span>{{ tab.name }}</span>
13
+ <div
14
+ v-if="index === tabs.length - 1"
15
+ :style="getTabLineStyle(index)" />
16
+ </li>
17
+ </ul>
18
+ </Card>
19
+ <div ref="bodyRef" class="tab-body">
20
+ <slot />
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script setup lang="ts">
26
+ import { computed, nextTick, onMounted, ref, useSlots, watch } from 'vue'
27
+ import Card from 'vue3-bcui/packages/ss-card'
28
+
29
+ const props = defineProps<{
30
+ title?: string
31
+ }>()
32
+
33
+ const slots = useSlots()
34
+ const bodyRef = ref<HTMLElement>()
35
+ const activeIndex = ref(0)
36
+
37
+ const tabs = computed(() => {
38
+ const nodes = slots.default?.() ?? []
39
+ return nodes.filter((node) => {
40
+ const props = node.props as Record<string, unknown> | undefined
41
+ return Boolean(props?.name)
42
+ }).map((node) => {
43
+ const props = node.props as Record<string, unknown>
44
+ return {
45
+ name: String(props.name ?? ''),
46
+ }
47
+ })
48
+ })
49
+
50
+ function selectTab(index: number) {
51
+ activeIndex.value = index
52
+ nextTick(() => {
53
+ const children = bodyRef.value?.children
54
+ if (!children) return
55
+ const activeName = tabs.value[index]?.name
56
+ for (let i = 0; i < children.length; i++) {
57
+ const child = children[i] as HTMLElement
58
+ if (child.nodeName === 'DIV' && child.hasAttribute('name')) {
59
+ child.style.display = child.getAttribute('name') === activeName
60
+ ? 'block'
61
+ : 'none'
62
+ }
63
+ }
64
+ })
65
+ }
66
+
67
+ function getTabLineStyle(maxIndex: number) {
68
+ const offset = maxIndex - activeIndex.value
69
+ return `transform: translateX(calc(-${offset}00% - (var(--bc-tab-margin) * 2 + 10px) * ${offset}))`
70
+ }
71
+
72
+ onMounted(() => {
73
+ selectTab(0)
74
+ })
75
+
76
+ watch(tabs, () => {
77
+ nextTick(() => selectTab(activeIndex.value))
78
+ })
79
+ </script>
80
+
81
+ <style scoped>
82
+ .tab-main > div:first-child {
83
+ margin-bottom: 10px;
84
+ }
85
+ .tab-bar {
86
+ --bc-tab-margin: 20px;
87
+
88
+ margin: -17px -20px -17px -40px;
89
+ justify-content: center;
90
+ align-items: center;
91
+ position: relative;
92
+ display: flex;
93
+ }
94
+ .tab-bar > span {
95
+ font-weight: bold;
96
+ flex: 0 0 auto;
97
+ margin-right: 20px;
98
+ }
99
+ .tab-bar > li {
100
+ margin: 0 var(--bc-tab-margin);
101
+ justify-content: center;
102
+ flex-direction: column;
103
+ list-style-type: none;
104
+ align-items: center;
105
+ border-radius: 3px;
106
+ min-width: 30px;
107
+ cursor: pointer;
108
+ padding: 10px;
109
+ display: flex;
110
+ }
111
+ .tab-bar > li span,
112
+ .tab-bar > li svg {
113
+ color: var(--color-font);
114
+ transition: color 0.3s;
115
+ font-size: 0.9rem;
116
+ }
117
+
118
+ .tab-bar > li > div {
119
+ width: calc(100% + 10px);
120
+ margin-bottom: -10px;
121
+ transition: all .35s;
122
+ border-radius: 7px;
123
+ margin-top: 6px;
124
+ height: 3px;
125
+ }
126
+ .tab-bar > li:last-child > div {
127
+ background: var(--color-main);
128
+ }
129
+ .tab-bar > li.select span,
130
+ .tab-bar > li.select svg {
131
+ color: var(--color-main);
132
+ }
133
+ </style>
@@ -25,7 +25,11 @@ import { useChatStore } from '../state/chat'
25
25
  import { useContactStore } from '../state/contact'
26
26
  import { useSettingsStore } from '../state/settings'
27
27
  import { getMsgRawTxt, hasAtMe, updateBaseOnMsgList } from './utils/msgUtil'
28
- import { normalizeSessionId } from './utils/sessionUtil'
28
+ import {
29
+ getSessionDedupKey,
30
+ normalizeSessionId,
31
+ setSessionContact,
32
+ } from './utils/sessionUtil'
29
33
  import { buildQqGroupAvatar } from './utils/avatarUtil'
30
34
  import type { ConnectionHistoryItem, LoginCacheElem } from './elements/system'
31
35
  import type { UserFriendElem, UserGroupElem } from './elements/information'
@@ -350,9 +354,9 @@ function updateBotStateGroup(
350
354
  const session = state?.onMsgList.find((item) => String(item.group_id) === sessionId)
351
355
  if (!state || !session) return
352
356
  apply(session as unknown as Record<string, unknown>)
353
- const key = normalizeSessionId(String(sessionId))
357
+ const key = normalizeSessionId(String(session.channel_id || session.channelId || sessionId))
354
358
  const baseList = [...state.baseList]
355
- const baseIndex = baseList.findIndex(([baseKey]) => normalizeSessionId(String(baseKey)) === key)
359
+ const baseIndex = baseList.findIndex(([, value]) => value === session)
356
360
  const typedSession = session as unknown as UserFriendElem & UserGroupElem
357
361
  if (baseIndex >= 0) {
358
362
  baseList[baseIndex] = [key, typedSession]
@@ -550,6 +554,7 @@ function recordBotMessage(platform: string, selfId: string, msg: Record<string,
550
554
  identityDebug('recordBotMessage: skipped invalid session', { sessionId, msg })
551
555
  return
552
556
  }
557
+ const sessionKey = String(channelId || sessionId)
553
558
  identityDebug('recordBotMessage: session', { sessionId })
554
559
  const sender = getObject(msg.sender)
555
560
  const hasSenderAvatar = hasUsableAvatar(sender.avatar)
@@ -597,6 +602,14 @@ function recordBotMessage(platform: string, selfId: string, msg: Record<string,
597
602
  guild_id: typeof msg.guild_id === 'string' ? msg.guild_id : undefined,
598
603
  }
599
604
  const existing = state.onMsgList.find((item) => {
605
+ const itemChannelId = String(item.channel_id || item.channelId || '')
606
+ if (itemChannelId) {
607
+ if (isGroup) {
608
+ return normalizeGroupId(itemChannelId) === normalizeGroupId(channelId || sessionId)
609
+ }
610
+ return itemChannelId.replace(/^(?:private|direct):/i, '')
611
+ === String(sessionId).replace(/^(?:private|direct):/i, '')
612
+ }
600
613
  return isGroup
601
614
  ? String(item.group_id) === sessionId
602
615
  : String(item.user_id) === sessionId
@@ -628,9 +641,9 @@ function recordBotMessage(platform: string, selfId: string, msg: Record<string,
628
641
  } else {
629
642
  state.onMsgList.unshift(session)
630
643
  }
631
- const baseKey = normalizeSessionId(String(sessionId))
644
+ const baseKey = normalizeSessionId(sessionKey)
632
645
  const baseList = [...state.baseList]
633
- const baseIndex = baseList.findIndex(([key]) => normalizeSessionId(String(key)) === baseKey)
646
+ const baseIndex = baseList.findIndex(([, value]) => value === session)
634
647
  const typedSession = session as unknown as UserFriendElem & UserGroupElem
635
648
  if (baseIndex >= 0) {
636
649
  baseList[baseIndex] = [baseKey, typedSession]
@@ -644,12 +657,9 @@ function recordBotMessage(platform: string, selfId: string, msg: Record<string,
644
657
  })
645
658
  if (
646
659
  isActiveBot({ platform, selfId }) &&
647
- !contactStore.baseOnMsgList.has(String(sessionId))
660
+ !contactStore.baseOnMsgList.has(normalizeSessionId(sessionKey))
648
661
  ) {
649
- contactStore.baseOnMsgList.set(
650
- String(sessionId),
651
- session as unknown as UserFriendElem & UserGroupElem,
652
- )
662
+ setSessionContact(contactStore.baseOnMsgList, session as unknown as UserFriendElem & UserGroupElem)
653
663
  updateBaseOnMsgList()
654
664
  }
655
665
 
@@ -678,7 +688,8 @@ function recordBotMessage(platform: string, selfId: string, msg: Record<string,
678
688
  // 实时消息直接写入当前聊天窗口,避免依赖旧的消息解析链路
679
689
  chatStore.messageList.push(msg)
680
690
  }
681
- const knownSessionAvatar = contactStore.baseOnMsgList.get(String(sessionId))
691
+ const knownSessionAvatar = contactStore.baseOnMsgList.get(normalizeSessionId(sessionKey))
692
+ ?? contactStore.baseOnMsgList.get(normalizeSessionId(sessionId))
682
693
  const knownWithAvatar = hasUsableAvatar(session.avatar)
683
694
  || Boolean(
684
695
  knownSessionAvatar &&
@@ -774,20 +785,28 @@ export function restoreBotStateFromMessageCache(platform: string, selfId: string
774
785
  baseList: [],
775
786
  onMsgList: [],
776
787
  }
777
- const baseList = [...state.baseList]
778
- const baseKeys = new Set(baseList.map(([key]) => normalizeSessionId(key)))
779
- const existing = new Set(state.onMsgList.map((item) => {
780
- return String(item.user_id ?? item.group_id ?? '')
781
- }))
788
+ const baseMap = new Map<string, UserFriendElem & UserGroupElem>()
789
+ for (const [, value] of state.baseList) {
790
+ const id = getSessionDedupKey(value)
791
+ if (!id.endsWith(':0') && !id.endsWith(':')) baseMap.set(id, value)
792
+ }
793
+ const baseList = [...baseMap.entries()]
794
+ const baseKeys = new Set(baseList.map(([key]) => key))
795
+ const existing = new Set(
796
+ state.onMsgList.map((item) => {
797
+ const id = getSessionDedupKey(item)
798
+ return !id.endsWith(':0') && !id.endsWith(':') ? id : ''
799
+ }).filter(Boolean),
800
+ )
782
801
  for (const session of sessions) {
783
- const id = String(session.user_id ?? session.group_id ?? '')
784
- if (id && !existing.has(id)) {
802
+ const id = getSessionDedupKey(session)
803
+ if (!id.endsWith(':0') && !id.endsWith(':') && !existing.has(id)) {
785
804
  state.onMsgList.unshift(session)
786
805
  existing.add(id)
787
806
  }
788
- if (id && !baseKeys.has(normalizeSessionId(id))) {
789
- baseList.push([normalizeSessionId(id), session])
790
- baseKeys.add(normalizeSessionId(id))
807
+ if (!id.endsWith(':0') && !id.endsWith(':') && !baseKeys.has(id)) {
808
+ baseList.push([normalizeSessionId(String(session.channel_id || session.channelId || session.user_id || session.group_id || '')), session])
809
+ baseKeys.add(id)
791
810
  }
792
811
  }
793
812
  contactStore.botStates.set(selfId, {
@@ -1360,6 +1379,7 @@ async function loadAllBotsCache() {
1360
1379
  for (const raw of groupRaws) {
1361
1380
  const id = normalizeGroupId(getString(raw.group_id) || getString(raw.id))
1362
1381
  if (!id) continue
1382
+ raw.group_id = id
1363
1383
  const name = getString(raw.group_name) || getString(raw.name)
1364
1384
  const avatar = hasUsableAvatar(raw.avatar)
1365
1385
  ? getString(raw.avatar)
@@ -1492,6 +1512,7 @@ function buildGroupItem(
1492
1512
  const channel = getObject(root.channel)
1493
1513
  const item = { ...getObject(raw) }
1494
1514
  const id = normalizeGroupId(getString(item.group_id) || getString(item.id) || getString(item.guild_id) || '')
1515
+ item.group_id = id
1495
1516
  const name = getString(guild.name)
1496
1517
  || getString(channel.name)
1497
1518
  || getString(item.group_name)
@@ -3,30 +3,7 @@ export default class Emoji {
3
3
  static readonly descMap = new Map<string, string>()
4
4
  static readonly allList = new Set<number>()
5
5
  static readonly allSuperList = new Set<number>()
6
-
7
- static readonly superList: readonly number[] = [
8
- 5, 311, 312, 314, 317, 318, 319, 320, 324, 325, 337,
9
- 338, 339, 341, 342, 343, 344, 345, 346, 181, 74, 75,
10
- 351, 349, 350, 395, 114, 326, 53, 137, 333, 424, 415,
11
- 392, 425, 427, 426, 419, 429, 472, 474, 475, 476, 477,
12
- 478, 479,
13
- ]
14
-
15
- static readonly normalList: readonly number[] = [
16
- 14, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 0, 15, 16,
17
- 96, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
18
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 97, 98, 99, 100,
19
- 101, 102, 103, 104, 105, 106, 107, 108, 305, 109, 110,
20
- 111, 172, 182, 179, 173, 174, 212, 175, 178, 177, 176,
21
- 183, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
22
- 272, 277, 307, 306, 281, 282, 283, 284, 285, 293, 286,
23
- 287, 289, 294, 297, 298, 299, 300, 323, 332, 336, 353,
24
- 355, 356, 354, 352, 357, 428, 334, 347, 303, 302, 295,
25
- 49, 66, 63, 64, 187, 146, 116, 67, 60, 185, 76, 124,
26
- 118, 78, 119, 79, 120, 121, 77, 123, 201, 273, 46, 112,
27
- 56, 169, 171, 59, 144, 147, 148, 89, 41, 125, 42, 43, 86, 129,
28
- 85,
29
- ]
6
+ static readonly normalList: readonly number[] = []
30
7
 
31
8
  static readonly emojiList: readonly number[] = [
32
9
  128522, 128524, 128538, 128531, 128560, 128541, 128513, 128540,
@@ -40,19 +17,6 @@ export default class Emoji {
40
17
  10068, 128299, 128147, 127978,
41
18
  ]
42
19
 
43
- static readonly responseApngId: readonly number[] = [
44
- 5, 314, 318, 319, 320, 324, 337, 338, 339, 341, 342, 343, 344,
45
- 345, 346, 181, 74, 75, 351, 349, 350, 395, 326, 53, 333, 424,
46
- 425, 427, 426, 14, 4, 8, 9, 10, 12, 16, 96, 21, 23, 24, 25, 26,
47
- 27, 28, 29, 30, 32, 33, 34, 38, 39, 97, 98, 99, 100, 101, 102,
48
- 103, 104, 106, 305, 109, 111, 182, 179, 173, 174, 212, 175, 176,
49
- 183, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 277, 307,
50
- 306, 281, 282, 284, 285, 293, 287, 289, 294, 297, 298, 299, 332,
51
- 336, 353, 355, 356, 354, 352, 357, 428, 334, 347, 303, 302, 295,
52
- 49, 66, 63, 116, 60, 76, 124, 118, 78, 79, 120, 123, 201, 273,
53
- 171, 144, 147, 89, 41, 125, 42, 43, 129, 85,
54
- ]
55
-
56
20
  static readonly responseEmojiId: readonly number[] = [
57
21
  128522, 128524, 128538, 128531, 128560, 128541, 128513, 128540,
58
22
  9786, 128532, 128516, 128527, 128530, 128563, 128536, 128557,
@@ -67,7 +31,7 @@ export default class Emoji {
67
31
 
68
32
  private constructor(
69
33
  public id: number,
70
- public type: 'apng' | 'emoji',
34
+ public type: 'emoji',
71
35
  public hasSuper: boolean,
72
36
  public superSuffix: number[],
73
37
  ) {
@@ -77,28 +41,16 @@ export default class Emoji {
77
41
  }
78
42
 
79
43
  static get(id: number): Emoji | undefined {
80
- if (id < 5000) {
81
- const value = this.apngMap.get(id)
82
- return value ? new Emoji(id, 'apng', value.super, value.suffix) : undefined
83
- }
44
+ if (id < 5000) return undefined
84
45
  return new Emoji(id, 'emoji', false, [])
85
46
  }
86
47
 
87
48
  static has(id: number): boolean {
88
- return id >= 5000 || this.apngMap.has(id)
89
- }
90
-
91
- static init() {
92
- for (const id of [...this.superList, ...this.normalList, ...this.responseApngId]) {
93
- const isSuper = this.superList.includes(id)
94
- this.apngMap.set(id, { super: isSuper, suffix: [] })
95
- if (isSuper) this.allSuperList.add(id)
96
- this.allList.add(id)
97
- }
49
+ return id >= 5000
98
50
  }
99
51
 
100
52
  static get responseId(): readonly number[] {
101
- return [...this.responseApngId, ...this.responseEmojiId]
53
+ return this.responseEmojiId
102
54
  }
103
55
 
104
56
  get description(): string {
@@ -106,22 +58,10 @@ export default class Emoji {
106
58
  }
107
59
 
108
60
  get value(): string {
109
- return this.type === 'apng' ? this.getNormalUrl(this.id) : String.fromCodePoint(this.id)
61
+ return String.fromCodePoint(this.id)
110
62
  }
111
63
 
112
64
  get superValue(): string | undefined {
113
- if (!this.hasSuper) return undefined
114
- return this.getSuperUrl(this.id, this.suffixId)
115
- }
116
-
117
- private getNormalUrl(id: number): string {
118
- return `https://lib.stapxs.cn/download/stapxs-qq-lite/qq_emoji/${id}/apng/${id}.png`
119
- }
120
-
121
- private getSuperUrl(id: number, suffix?: number): string {
122
- const name = suffix ? `${id}_${suffix}` : `${id}`
123
- return `https://lib.stapxs.cn/download/stapxs-qq-lite/qq_emoji/${id}/lottie/${name}.json`
65
+ return undefined
124
66
  }
125
67
  }
126
-
127
- setTimeout(Emoji.init.bind(Emoji), 0)