add bnb and trx prcie
continuous-integration/drone/push Build is passing Details

master
dustoair 3 years ago
parent 492dad6be0
commit 8706dda303

@ -8,11 +8,7 @@ var CMDList = []string{
"last",
"删除图片",
"删除文本",
"ETH",
"eth",
"BTC",
"btc",
"虚拟货币",
"虚拟货币", "ETH", "eth", "BTC", "btc", "trx", "TRX", "BNB", "bnb",
"gold",
"黄金",
"ip",

@ -36,10 +36,12 @@ func cmdExec(msgContent MsgContent) (replyContent string) {
textMd5 := utils.Md5String(lastText.Content)
go RecordWechatBlockWords(lastText.Content, textMd5, msgContent.FromUsername)
return
case "eth", "btc", "ETH", "BTC", "虚拟货币":
case "虚拟货币", "ETH", "eth", "BTC", "btc", "trx", "TRX", "BNB", "bnb":
priceBTC := api.GetBinanceLatestPrice("BTCUSDT")
priceETH := api.GetBinanceLatestPrice("ETHUSDT")
replyContent = fmt.Sprintf("BTC价格: %f \n ETH价格: %f", priceBTC, priceETH)
priceTRX := api.GetBinanceLatestPrice("TRXUSDT")
priceBNB := api.GetBinanceLatestPrice("BNBUSDT")
replyContent = fmt.Sprintf("BTC价格: %f \n ETH价格: %f \n TRX价格: %f \n BNB价格: %f", priceBTC, priceETH, priceTRX, priceBNB)
return
case "gold", "黄金":
@ -87,42 +89,6 @@ func replyText(msgContent MsgContent, timestamp, nonce string, w http.ResponseWr
//开启了命令执行功能,并且消息内容包含了命令
log.Println("收到命令消息")
replyContent = cmdExec(msgContent)
//cmdString := cmdExec(msgContent)
//var cmdString string
//if msgContent.Content == "last" {
// cmdString = global.HistoryCmds[len(global.HistoryCmds)-1]
//} else if msgContent.Content == "history" {
// cmdString = utils.SlicePrint(global.HistoryCmds)
//} else if msgContent.Content == "删除图片" {
// //通过文本消息删除上一张图片
// lastImg := GetLastWechatLog(msgContent.FromUsername, "image")
// err := utils.DeleteFile(lastImg.Content)
// if err != nil {
// log.Println("删除图片失败: ", lastImg.Content)
// return
// } else {
// log.Println("图片已删除: ", lastImg.Content)
// return
// }
//
//} else if msgContent.Content == "删除文本" {
// //通过文本消息删除上一条文本消息
// lastText := GetLastWechatLog(msgContent.FromUsername, "text")
// textMd5 := utils.Md5String(lastText.Content)
// go RecordWechatBlockWords(lastText.Content, textMd5, msgContent.FromUsername)
// return
//
//} else {
// cmdString = msgContent.Content
//}
//global.HistoryCmds = append(global.HistoryCmds, msgContent.Content)
//replyContent, err := utils.CMDShellTrick(cmdString)
//if err != nil {
// replyContent = "/:,@!执行失败:\n" + msgContent.Content
//} else {
// replyContent = "/::D执行成功\n" + replyContent
// //aiAnswer = "执行命令:" + msgContent.Content
//}
} else {
log.Println("ai msg")
replyContent = aiReply(msgContent)

Loading…
Cancel
Save