From 37e43bdd61846b1784ea03e10a76f9b42450a07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Wed, 22 Mar 2023 17:35:07 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=9B=9E=E5=A4=8D=E9=85=8D=E7=BD=AE=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auto-danmaku-setting-dialog/index.vue | 66 +++++++++++++++++++ src/views/Robot/message/robot.ts | 4 ++ src/views/Robot/room.vue | 6 +- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 src/views/Robot/auto-danmaku-setting-dialog/index.vue diff --git a/src/views/Robot/auto-danmaku-setting-dialog/index.vue b/src/views/Robot/auto-danmaku-setting-dialog/index.vue new file mode 100644 index 0000000..a3e95ed --- /dev/null +++ b/src/views/Robot/auto-danmaku-setting-dialog/index.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/views/Robot/message/robot.ts b/src/views/Robot/message/robot.ts index 0cd9f97..d289efa 100644 --- a/src/views/Robot/message/robot.ts +++ b/src/views/Robot/message/robot.ts @@ -34,9 +34,13 @@ export const manage = reactive({ robotName: await (getStore(MANAGE.robotName)) || '闹闹', hostName: await (getStore(MANAGE.hostName)) || '条条', like: await (getStore(MANAGE.like)) || false, + likeText: '感谢{user}的点赞', follow: await (getStore(MANAGE.follow)) || false, + followText: '感谢{user}关注{up}', gift: await (getStore(MANAGE.gift)) || false, + giftText: '感谢{user}投喂的{gift}', welcome: await (getStore(MANAGE.welcome)) || false, + welcomeText: '欢迎{user}来到{up}直播间', gptToken: await getStore(MANAGE.gptToken) || '' }); diff --git a/src/views/Robot/room.vue b/src/views/Robot/room.vue index 3fd6464..48e8541 100644 --- a/src/views/Robot/room.vue +++ b/src/views/Robot/room.vue @@ -7,6 +7,7 @@ import { newRecorder, testFfmpge, recordPath } from '@/utils/cmd' import { type Child, type Command } from "@tauri-apps/api/shell"; import Danmaku from './message/index.vue' import Video from "./video.vue"; +import AutoDanmakuSettingDialog from './auto-danmaku-setting-dialog/index.vue'; import { message } from "@tauri-apps/api/dialog"; import { open } from "@tauri-apps/api/shell"; @@ -126,10 +127,7 @@ const stopRecord = async () => {
- - - - +
From 9daad1158c4a4541e7df28ff3199081c725202a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Thu, 23 Mar 2023 20:18:08 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E6=8C=81=E4=B9=85=E5=8C=96?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=87=AA=E5=8A=A8=E5=BC=B9=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/index.ts | 6 +++++- src/views/Robot/message/robot.ts | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/constants/index.ts b/src/constants/index.ts index 607acdf..ec21bb8 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -14,7 +14,11 @@ export const MANAGE = { follow: 'manage.follow', gift: 'manage.gift', welcome: 'manage.welcome', - gptToken: 'manage.gptToken' + gptToken: 'manage.gptToken', + likeText: 'manage.likeText', + followText: 'manage.followText', + giftText: 'manage.giftText', + welcomeText: 'manage.welcomeText' }; export const MESSAGE_TYPE = { diff --git a/src/views/Robot/message/robot.ts b/src/views/Robot/message/robot.ts index d289efa..e3c7599 100644 --- a/src/views/Robot/message/robot.ts +++ b/src/views/Robot/message/robot.ts @@ -34,13 +34,13 @@ export const manage = reactive({ robotName: await (getStore(MANAGE.robotName)) || '闹闹', hostName: await (getStore(MANAGE.hostName)) || '条条', like: await (getStore(MANAGE.like)) || false, - likeText: '感谢{user}的点赞', + likeText: await (getStore(MANAGE.likeText)) || '感谢{user}的点赞', follow: await (getStore(MANAGE.follow)) || false, - followText: '感谢{user}关注{up}', + followText: await (getStore(MANAGE.followText)) || '感谢{user}关注{up}', gift: await (getStore(MANAGE.gift)) || false, - giftText: '感谢{user}投喂的{gift}', + giftText: await (getStore(MANAGE.giftText)) || '感谢{user}投喂的{gift}', welcome: await (getStore(MANAGE.welcome)) || false, - welcomeText: '欢迎{user}来到{up}直播间', + welcomeText: await (getStore(MANAGE.welcomeText)) || '欢迎{user}来到{up}直播间', gptToken: await getStore(MANAGE.gptToken) || '' }); From 6106e74f93b22802adbcf97a783de49d447bbe65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Thu, 23 Mar 2023 20:21:48 +0800 Subject: [PATCH 3/9] =?UTF-8?q?style:=20=E8=87=AA=E5=8A=A8=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=E7=AA=97=E5=8F=A3=E5=8F=AF=E6=8B=96?= =?UTF-8?q?=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Robot/auto-danmaku-setting-dialog/index.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/views/Robot/auto-danmaku-setting-dialog/index.vue b/src/views/Robot/auto-danmaku-setting-dialog/index.vue index a3e95ed..3dd4b1b 100644 --- a/src/views/Robot/auto-danmaku-setting-dialog/index.vue +++ b/src/views/Robot/auto-danmaku-setting-dialog/index.vue @@ -8,12 +8,18 @@ transition-hide="slide-down" > - + - - - + + 缩小 + + + 全屏 + + + 收起 + From 18848228350b644b17014a0b282d659212a7dd5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Thu, 23 Mar 2023 20:38:53 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=E7=94=A8=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E6=9B=BF=E6=8D=A2=E6=88=90=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Robot/message/robot.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/views/Robot/message/robot.ts b/src/views/Robot/message/robot.ts index e3c7599..82b401e 100644 --- a/src/views/Robot/message/robot.ts +++ b/src/views/Robot/message/robot.ts @@ -150,14 +150,16 @@ const init_listener = async () => { // 关注事件 if (!manage.follow) return; - sendMessage(`感谢${formatUname(item.uname)}关注${manage.hostName}~`); + const message = manage.followText.replaceAll('{user}', formatUname(item.uname)).replaceAll('{up}', manage.hostName); + messages.push(...autoSlice(message)); } else if (item.msg_type === "entry") { if (!active.value) return; // 大佬欢迎词 if (bossList.findIndex(boss => boss.uid === "" + item.uid) !== -1) { if (!manage.welcome) return; - messages.push(...autoSlice(`欢迎${formatUname(item.uname)}来到${manage.hostName}的直播间~`)); + const message = manage.welcomeText.replaceAll('{user}', formatUname(item.uname)).replaceAll('{up}', manage.hostName); + messages.push(...autoSlice(message)); } enter_num.value += 1; @@ -224,7 +226,8 @@ const init_listener = async () => { if (item.barrageType === "like") { // 点赞事件 if (!manage.like) return; - messages.push(...autoSlice(`感谢${formatUname(uname)}的点赞~`)); + const message = manage.likeText.replaceAll('{user}', formatUname(item.uname)).replaceAll('{up}', manage.hostName); + messages.push(...autoSlice(message)); } else { !isEmoji && create_danmu_sql({ ...item, roomid: manage.roomid }); } @@ -241,7 +244,11 @@ const init_listener = async () => { create_gift_sql({ ...item, roomid: manage.roomid }); if (!manage.gift) return; const { uname, giftName, giftId } = item.barrage; - giftId !== 1 && messages.push(...autoSlice(`感谢${formatUname(uname)}赠送的${giftName || "礼物"}~`)); + const message = manage.giftText.replaceAll('{user}', formatUname(uname)) + .replaceAll('{up}', manage.hostName) + .replaceAll('{gift}', giftName || "礼物") + + giftId !== 1 && messages.push(...autoSlice(message)); }); }); From 6eed3eab0fcdf1851191cace445585ca2e372aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Thu, 23 Mar 2023 21:35:44 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E5=90=8E=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=B2=A1=E6=9C=89=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Robot/message/robot.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/Robot/message/robot.ts b/src/views/Robot/message/robot.ts index 82b401e..5dd1db6 100644 --- a/src/views/Robot/message/robot.ts +++ b/src/views/Robot/message/robot.ts @@ -201,7 +201,7 @@ const init_listener = async () => { return; } // 主人命令 - if (uid === 405579368) { + if (uid === 405579368 || uid === 8212729) { switch (question) { case '下线': active.value = false; @@ -226,7 +226,7 @@ const init_listener = async () => { if (item.barrageType === "like") { // 点赞事件 if (!manage.like) return; - const message = manage.likeText.replaceAll('{user}', formatUname(item.uname)).replaceAll('{up}', manage.hostName); + const message = manage.likeText.replaceAll('{user}', formatUname(uname)).replaceAll('{up}', manage.hostName); messages.push(...autoSlice(message)); } else { !isEmoji && create_danmu_sql({ ...item, roomid: manage.roomid }); @@ -339,8 +339,12 @@ export const startWebsocket = async () => { return; } // 获取直播间信息 - const { by_room_ids } = await getLiveStatusApi(manage.roomid); + const data = await getLiveStatusApi(manage.roomid); + const { by_room_ids } = data; + const { [manage.roomid]: {live_status}} = by_room_ids const roomid = Object.keys(by_room_ids)[0]; + // XXX 这里可能改的不对,但是如果不改变 active,无法触发自动回复 + active.value = live_status === 1; if (!roomid) { Notify.create("直播间不存在"); return; From 17abdbcb6e68d34f0b29be5bd0674321b0dbf98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AC=E7=81=B0=E6=9D=A1?= <326633131@qq.com> Date: Fri, 24 Mar 2023 18:06:33 +0800 Subject: [PATCH 6/9] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E4=BA=86UI?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Robot/auto-danmaku-setting-dialog/index.vue | 17 ++++++++++++++--- src/views/Robot/message/robot.ts | 16 +++++++++++++++- src/views/Robot/room.vue | 15 +-------------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/views/Robot/auto-danmaku-setting-dialog/index.vue b/src/views/Robot/auto-danmaku-setting-dialog/index.vue index 3dd4b1b..e80ca73 100644 --- a/src/views/Robot/auto-danmaku-setting-dialog/index.vue +++ b/src/views/Robot/auto-danmaku-setting-dialog/index.vue @@ -24,9 +24,13 @@
设置自动发送的弹幕
+
+ + +
- +
输入框中的特殊标记会自动替换成指定的文本
@@ -37,7 +41,7 @@
- +
@@ -54,6 +58,13 @@
+
+ + +
+ +
+
@@ -61,7 +72,7 @@