mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
🎵 feat(music): add music feature toggle in config and prevent actions when disabled(#10)
This commit is contained in:
parent
b6897704c1
commit
68f7a83024
@ -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;
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
"welcome": true,
|
||||
"faceReply": true,
|
||||
"ai": true,
|
||||
"blackWords": true
|
||||
"blackWords": true,
|
||||
"music": true
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user