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) {
|
async handleSearch(e) {
|
||||||
try {
|
try {
|
||||||
|
if (!ConfigControl.get()?.config?.music) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const keyword = e.msg.replace(/^#?点歌\s*/, '').trim();
|
const keyword = e.msg.replace(/^#?点歌\s*/, '').trim();
|
||||||
if (!keyword) {
|
if (!keyword) {
|
||||||
return await e.reply('请输入要点的歌名,例如:#点歌夜曲');
|
return await e.reply('请输入要点的歌名,例如:#点歌夜曲');
|
||||||
@ -73,6 +76,9 @@ export class CrystelfMusic extends plugin {
|
|||||||
*/
|
*/
|
||||||
async handleDirectPlay(e) {
|
async handleDirectPlay(e) {
|
||||||
try {
|
try {
|
||||||
|
if (!ConfigControl.get()?.config?.music) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const content = e.msg.replace(/^#?听\s*/, '').trim();
|
const content = e.msg.replace(/^#?听\s*/, '').trim();
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return await e.reply('请输入要听的歌名或序号,例如:#听 夜曲 或 #听 1', true);
|
return await e.reply('请输入要听的歌名或序号,例如:#听 夜曲 或 #听 1', true);
|
||||||
@ -114,6 +120,9 @@ export class CrystelfMusic extends plugin {
|
|||||||
*/
|
*/
|
||||||
async handleIndexSelection(e) {
|
async handleIndexSelection(e) {
|
||||||
try {
|
try {
|
||||||
|
if (!ConfigControl.get()?.config?.music) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const index = parseInt(e.msg);
|
const index = parseInt(e.msg);
|
||||||
if (isNaN(index) || index < 1 || index > 20) {
|
if (isNaN(index) || index < 1 || index > 20) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -15,5 +15,6 @@
|
|||||||
"welcome": true,
|
"welcome": true,
|
||||||
"faceReply": true,
|
"faceReply": true,
|
||||||
"ai": true,
|
"ai": true,
|
||||||
"blackWords": true
|
"blackWords": true,
|
||||||
|
"music": true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user