-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstock.lua
133 lines (114 loc) · 3.55 KB
/
stock.lua
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
local log = require("log")
local Api = require("coreApi")
local json = require("json")
local http = require("http")
function ReceiveFriendMsg(CurrentQQ, data)
if data.FromUin ==2986807981 then--防止自我复读
return 1 end
img_url = " "
keyWord = " "
content = ""
if string.find(data.Content, "上证指数") == 1 then
keyWord ="sh000001"
end
if string.find(data.Content, "创业板指数") == 1 then
keyWord ="sz399006"
end
if keyWord ~=" " then
img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif"
sendfriendstockpic(CurrentQQ,data,img_url,content)
return 1
end
if string.find(data.Content, "股票代码") == 1 then
keyWord = data.Content:gsub("股票代码", "")
if keyWord =="" then return 1 end --关键字为空则退出
img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif"
content = "股票代码以新浪财经为准http://biz.finance.sina.com.cn/suggest/lookup_n.php"
sendfriendstockpic(CurrentQQ,data,img_url,content)
img_url = nil
keyWord = nil
content = nil
return 1
end
return 1
end
function ReceiveGroupMsg(CurrentQQ, data)
if data.FromUserId ==2986807981 then--防止自我复读
return 1 end
img_url = " "
keyWord = " "
content = ""
if string.find(data.Content, "上证指数") == 1 then
keyWord ="sh000001"
end
if string.find(data.Content, "创业板指数") == 1 then
keyWord ="sz399006"
end
if keyWord ~=" " then
img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif"
sendgroupstockpic(CurrentQQ,data,img_url,content)
return 1
end
if string.find(data.Content, "股票代码") == 1 then
keyWord = data.Content:gsub("股票代码", "")
if keyWord =="" then return 1 end --关键字为空则退出
img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif"
ApiRet =
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromGroupId, --回复当前消息的来源群ID
sendToType = 2, --2发送给群1发送给好友3私聊
groupid = 0, --不是私聊自然就为0咯
atUser = 0, --是否 填上data.FromUserId就可以复读给他并@了
sendMsgType = "PicMsg",
content = "股票代码以新浪财经为准http://biz.finance.sina.com.cn/suggest/lookup_n.php",
picUrl = img_url,
picBase64Buf = "",
fileMd5 = ""
}
)
img_url = nil
return 1
end
return 1
end
function ReceiveEvents(CurrentQQ, data, extData)
return 1
end
function sendgroupstockpic(CurrentQQ,data,img_url,content)
if img_url == "" then return 1 end --空则退出
ApiRet =
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromGroupId, --回复当前消息的来源群ID
sendToType = 2, --2发送给群1发送给好友3私聊
groupid = 0, --不是私聊自然就为0咯
atUser = 0, --是否 填上data.FromUserId就可以复读给他并@了
sendMsgType = "PicMsg",
content = content,
picUrl = img_url,
picBase64Buf = "",
fileMd5 = ""
}
)
return 1
end
function sendfriendstockpic(CurrentQQ,data,img_url,content)
if img_url =="" then return 1 end --空则退出
ApiRet =
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromUin, --回复当前消息的来源群ID
sendToType = 1, --2发送给群1发送给好友3私聊
sendMsgType = "PicMsg",
content = content,
picUrl = img_url,
picBase64Buf = "",
fileMd5 = ""
}
)
return 1
end