From 68f7a830245c39607008cdeab01e43979d19be1f Mon Sep 17 00:00:00 2001 From: Jerrypluay Date: Sat, 29 Nov 2025 16:39:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=B5=20feat(music):=20add=20music=20fea?= =?UTF-8?q?ture=20toggle=20in=20config=20and=20prevent=20actions=20when=20?= =?UTF-8?q?disabled(#10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/music.js | 9 +++++++++ config/config.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/music.js b/apps/music.js index 55daea4..02d0a5a 100644 --- a/apps/music.js +++ b/apps/music.js @@ -46,6 +46,9 @@ export class CrystelfMusic extends plugin { */ async handleSearch(e) { try { + if (!ConfigControl.get()?.config?.music) { + return; + } const keyword = e.msg.replace(/^#?点歌\s*/, '').trim(); if (!keyword) { return await e.reply('请输入要点的歌名,例如:#点歌夜曲'); @@ -73,6 +76,9 @@ export class CrystelfMusic extends plugin { */ async handleDirectPlay(e) { try { + if (!ConfigControl.get()?.config?.music) { + return; + } const content = e.msg.replace(/^#?听\s*/, '').trim(); if (!content) { return await e.reply('请输入要听的歌名或序号,例如:#听 夜曲 或 #听 1', true); @@ -114,6 +120,9 @@ export class CrystelfMusic extends plugin { */ async handleIndexSelection(e) { try { + if (!ConfigControl.get()?.config?.music) { + return; + } const index = parseInt(e.msg); if (isNaN(index) || index < 1 || index > 20) { return; diff --git a/config/config.json b/config/config.json index ebbe6ab..10e17e2 100644 --- a/config/config.json +++ b/config/config.json @@ -15,5 +15,6 @@ "welcome": true, "faceReply": true, "ai": true, - "blackWords": true + "blackWords": true, + "music": true }