From 25d5d9d10994fdb2af05727d5a9611087becf937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E5=8C=97=E2=80=B3?= <9778566@qq.com> Date: Mon, 20 Nov 2023 19:42:35 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B8=A3=E7=94=B7=E8=AF=AD=E5=BD=95...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\347\276\244\347\272\242\345\214\205.lua" | 39 ++++++++++++++++++- ...3\347\224\267\350\257\255\345\275\225.lua" | 39 +++++++++++++++++++ ...7\346\261\202\345\244\204\347\220\206.lua" | 4 +- 3 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 "Plugins/\346\270\243\347\224\267\350\257\255\345\275\225.lua" diff --git "a/Plugins/\346\212\242\347\276\244\347\272\242\345\214\205.lua" "b/Plugins/\346\212\242\347\276\244\347\272\242\345\214\205.lua" index 3c3fe34..c7a04c2 100644 --- "a/Plugins/\346\212\242\347\276\244\347\272\242\345\214\205.lua" +++ "b/Plugins/\346\212\242\347\276\244\347\272\242\345\214\205.lua" @@ -13,7 +13,44 @@ end function ReceiveGroupMsg(CurrentQQ, data) if data.MsgBody.SubMsgType == 24 then --红包类型 - Go.openGroupRedBag(CurrentQQ, data) + info = Go.openGroupRedBag(CurrentQQ, data) + + math.randomseed(os.time()) + + successIndex = math.random(1, 6) + failIndex = math.random(1, 4) + successArray = { + "谢谢老板~🙏", + "老板发财💰", + "谢谢🙏", + "谢谢大佬的红包", + "发红包的好帅😂", + "老板大发特发💰" + } + failArray = { + "群里有外挂吧?😂😂😂😂", + "卧槽 ,好多外挂.....", + "外挂可耻", + "这都是什么手速😂😂😂😂" + } + + if (info.ResponseData.GetMoney == 0) then + log.notice("没抢到%s", "===========") + Go.sendGroupMsg(CurrentQQ, data, failArray[failIndex]) + return 1 + end + + if (info.ResponseData.GetMoney > 0) then + Go.sendGroupMsg(CurrentQQ, data, successArray[successIndex]) + end + + + str = + string.format( + "刚刚抢到了 %d", + info.ResponseData.GetMoney + ) + log.notice("%s", str) end return 1 diff --git "a/Plugins/\346\270\243\347\224\267\350\257\255\345\275\225.lua" "b/Plugins/\346\270\243\347\224\267\350\257\255\345\275\225.lua" new file mode 100644 index 0000000..5ff15bf --- /dev/null +++ "b/Plugins/\346\270\243\347\224\267\350\257\255\345\275\225.lua" @@ -0,0 +1,39 @@ +package.path = package.path .. ";./Plugins/lib/?.lua;" +local log = require("log") +local Api = require("coreApi") +local json = require("json") +local http = require("http") +local mysql = require("mysql") +local Go = require("Fans") + +function ReceiveFriendMsg(CurrentQQ, data) + return 1 +end + +function ReceiveGroupMsg(CurrentQQ, data) + + if data.MsgHead.SenderUin == 88888888 then--防止自我复读 + return 1 + end + + if data.MsgHead.MsgType == 82 then + if string.find(data.MsgBody.Content, "!渣男语录") then + local msg = nil + local response, error_message = + http.request( + "GET", + "https://api.lovelive.tools/api/SweetNothings/Web/1" + ) + local html = response.body + local info = json.decode(html) + local msg = info.returnObj.content + Go.sendGroupMsg(CurrentQQ, data, msg) + msg = nil + end + end + return 1 +end + +function ReceiveEvents(CurrentQQ, data) + return 1 +end diff --git "a/Plugins/\350\257\267\346\261\202\345\244\204\347\220\206.lua" "b/Plugins/\350\257\267\346\261\202\345\244\204\347\220\206.lua" index 4d7acad..5ca3b93 100644 --- "a/Plugins/\350\257\267\346\261\202\345\244\204\347\220\206.lua" +++ "b/Plugins/\350\257\267\346\261\202\345\244\204\347\220\206.lua" @@ -47,7 +47,7 @@ function ReceiveEvents(CurrentQQ, data) if data.EventData.MsgHead.MsgType == 33 then local res = Go.queryUinByUid(CurrentQQ, data.EventData.Event.Uid) Go.Sleep(math.random(2, 5)) - sendGroupMsg(CurrentQQ, 88888888, "⬅让我一起欢迎这货入坑吧"..res.ResponseData[1].Nick) + sendGroupMsg(CurrentQQ, data.EventData.MsgHead.FromUin, res.ResponseData[1].Nick.."⬅让我一起欢迎这货入坑吧") end end @@ -56,7 +56,7 @@ function ReceiveEvents(CurrentQQ, data) if data.EventData.MsgHead.MsgType == 34 then local res = Go.queryUinByUid(CurrentQQ, data.EventData.Event.Uid) Go.Sleep(math.random(2, 5)) - sendGroupMsg(CurrentQQ, 88888888, "这货离开了我们"..res.ResponseData[1].Nick) + sendGroupMsg(CurrentQQ, data.EventData.MsgHead.FromUin, res.ResponseData[1].Nick.."这货离开了我们") end end