-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTyphoonMessage.lua
More file actions
31 lines (27 loc) · 867 Bytes
/
Copy pathTyphoonMessage.lua
File metadata and controls
31 lines (27 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- 台风报文
local Api = require("coreApi")
local http = require("http")
function ReceiveFriendMsg(CurrentQQ, data) return 1 end
function ReceiveEvents(CurrentQQ, data, extData) return 1 end
function ReceiveGroupMsg(CurrentQQ, data)
if data.FromUserId == tonumber(CurrentQQ) then
return 1
end
if data.Content == '台风报文' then
local body = http.request('GET', 'http://m.nmc.cn/publish/typhoon/message.html').body
local msg = body:match([[<p align=left>(.+)<br></p>]]):gsub('<br>', '\n')
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromGroupId,
sendToType = 2,
sendMsgType = "TextMsg",
content = msg,
groupid = 0,
atUser = 0,
}
)
return 2
end
return 1
end