-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path5000choyen.lua
More file actions
60 lines (57 loc) · 1.8 KB
/
Copy path5000choyen.lua
File metadata and controls
60 lines (57 loc) · 1.8 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
local log = require("log")
local Api = require("coreApi")
local json = require("json")
local http = require("http")
function ReceiveFriendMsg(CurrentQQ, data)
return 1
end
function ReceiveGroupMsg(CurrentQQ, data)
if data.FromUserId ==2986807981 then--防止自我复读
return 1 end
if string.find(data.Content, "#") and string.find(data.Content, ".jpg") then
toptext = ""
bottomtext = ""
toptext = string.sub(data.Content, 1, string.find(data.Content, "#")-1)
bottomtext = string.sub(data.Content,string.find(data.Content, "#")+1, -5)
--print(toptext.." ")
--print(bottomtext)
toptext = urlEncode(toptext)
bottomtext = urlEncode(bottomtext)
if toptext == "" then
toptext =" "
end
if bottomtext == "" then
bottomtext =" "
end
ApiRet =
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromGroupId,
sendToType = 2,
sendMsgType = "PicMsg",
content = "本群已内置傻屌图生成器:http://yurafuca.com/5000choyen/index_cn.html",
atUser = 0,
voiceUrl = "",
voiceBase64Buf = "",
picUrl = "http://5000choyen.app.cyberrex.ml/image?top="..toptext.."&bottom="..bottomtext, --感谢dalao的API https://github.com/CyberRex0/5000choyen-api
picBase64Buf = "",
fileMd5 = ""
}
)
end
toptext=nil
bottomtext=nil
return 1
end
function ReceiveEvents(CurrentQQ, data, extData)
return 1
end
function urlEncode(s) --url编码解码
s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end)
return string.gsub(s, " ", "+")
end
function urlDecode(s)
s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end)
return s
end