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 }