diff --git a/apps/chat.js b/apps/chat.js index ec8e36d..9dbde61 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -74,6 +74,14 @@ export class chatgpt extends plugin { { reg: '#chatgpt文本模式', fnc: 'switch2Text' + }, + { + reg: '#清空(chat)?队列', + fnc: 'emptyQueue' + }, + { + reg: '#移出(chat)?队列首位', + fnc: 'removeQueueFirst' } ] }) @@ -309,4 +317,18 @@ export class chatgpt extends plugin { await this.reply(`与OpenAI通信异常,请稍后重试:${e}`, true, { recallMsg: e.isGroup ? 10 : 0 }) } } + + async emptyQueue (e) { + await redis.lTrim('CHATGPT:CHAT_QUEUE', 1, 0) + await this.reply('已清空当前等待队列') + } + + async removeQueueFirst (e) { + let uid = await redis.lPop('CHATGPT:CHAT_QUEUE', 0) + if (!uid) { + await this.reply('当前等待队列为空') + } else { + await this.reply('已移出等待队列首位: ' + uid) + } + } } diff --git a/apps/help.js b/apps/help.js index 5d76247..a75d79c 100644 --- a/apps/help.js +++ b/apps/help.js @@ -45,6 +45,16 @@ let helpData = [ title: '#结束对话 @某人', desc: '结束该用户当前对话,下次开启对话机器人将遗忘掉本次对话内容。' }, + { + icon: 'destroy', + title: '#清空chat队列', + desc: '清空当前对话等待队列。仅建议前方卡死时使用。' + }, + { + icon: 'destroy-other', + title: '#移出chat队列首位', + desc: '移出当前对话等待队列中的首位。若前方对话卡死可使用本命令。' + }, { icon: 'help', title: '#chatgpt帮助',