-
Notifications
You must be signed in to change notification settings - Fork 0
/
系统截屏.lua
75 lines (66 loc) · 2.06 KB
/
系统截屏.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
local log = require("log")
local Api = require("coreApi")
local json = require("json")
local http = require("http")
--本插件运行在linux 有桌面环境 下请安装 scrot截图工具
--[[
在 Debian,Ubuntu 或 Linux Mint 上安装Scrot:
$ sudo apt-get install scrot
在 Fedora 上安装Scrot:
$ sudo yum install scrot
]]
function ReceiveFriendMsg(CurrentQQ, data)
log.notice("From Lua Log ReceiveFriendMsg %s", CurrentQQ)
return 1
end
function ReceiveGroupMsg(CurrentQQ, data)
if CurrentQQ ~= "845324058" then --响应消息的QQ机器人
return 1
end
if string.find(data.Content, "服务器截图") then --指令
res, err = readAll("./running.png")
if err == nil then --判断框架根目录是否有历史截图有则上传 无则截图
return 1
end
os.execute("scrot ./running.png") --执行 截图操作
Sleep(1)--等待截图
res = readAll("./running.png") --读入截图文件
base64 = PkgCodec.EncodeBase64(res)
Api.Api_SendMsg(
CurrentQQ,
{
toUser = data.FromGroupId,
sendToType = 2,
sendMsgType = "PicMsg",
content = "[PICFLAG]✅当前正在运行Running😄\r",
atUser = 0,
voiceUrl = "",
voiceBase64Buf = "",
picUrl = "",
picBase64Buf = base64,--发送图片内容
fileMd5 = ""
}
)
os.remove("./running.png") --删除截图(伪仿刷屏 懒人代码)
end
return 1
end
function ReceiveEvents(CurrentQQ, data, extData)
return 1
end
function readAll(filePath)
local f, err = io.open(filePath, "rb")
if err ~= nil then
return nil, err
end
local content = f:read("*all")
f:close()
return content, err
end
function Sleep(n)
log.notice("==========Sleep==========\n%d", n)
local t0 = os.clock()
while os.clock() - t0 <= n do
end
log.notice("==========over Sleep==========\n%d", n)
end