From 97bffe8290a38aa652dd6cc94c8ede182dad0f7b Mon Sep 17 00:00:00 2001 From: dustoair <107600816+dustoair@users.noreply.github.com> Date: Thu, 28 Jul 2022 18:31:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global/cmds.go | 1 + handle/replyText.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/global/cmds.go b/global/cmds.go index ea6541e..2ca568c 100644 --- a/global/cmds.go +++ b/global/cmds.go @@ -6,4 +6,5 @@ var CMDList = []string{ "free -m", "history", "last", + "删除图片", } diff --git a/handle/replyText.go b/handle/replyText.go index c5f24af..e018ecb 100644 --- a/handle/replyText.go +++ b/handle/replyText.go @@ -11,7 +11,7 @@ import ( func replyText(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) { var replyContent string - if global.EnableCmdExec && utils.SliceContain(global.CMDList, msgContent.Content) { + if global.EnableCmdExec && utils.SliceContain(global.CMDList, msgContent.Content) && msgContent.FromUsername == "QiaoYang" { //开启了命令执行功能,并且消息内容包含了命令 log.Println("收到命令消息") var cmdString string @@ -19,6 +19,9 @@ func replyText(msgContent MsgContent, timestamp, nonce string, w http.ResponseWr cmdString = global.HistoryCmds[len(global.HistoryCmds)-1] } else if msgContent.Content == "history" { cmdString = utils.SlicePrint(global.HistoryCmds) + } else if msgContent.Content == "删除图片" { + log.Println("删除图片") + return } else { cmdString = msgContent.Content }