-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmouse.js
More file actions
65 lines (62 loc) · 1.82 KB
/
Copy pathmouse.js
File metadata and controls
65 lines (62 loc) · 1.82 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
61
62
63
64
65
const tg = require('node-telegram-bot-api')
const config = require('./config.json')
const child_process = require('child_process')
const robot = require('robotjs')
var bot = new tg(config.token, { polling: true })
var mouse_step = 3
bot.on('message', (msg) => {
const pos = robot.getMousePos()
switch(msg.text) {
case 'start':
bot.sendMessage(msg.chat.id, 'Mouse Move', {
reply_markup: {
keyboard: [
[{ text: '↖️' }, { text: '⬆️' }, { text: '↗️' }],
[{ text: '⬅️' }, { text: '🔴'}, { text: '➡️' }],
[{ text: '↙️' }, { text: '⬇️' }, { text: '↘️' }],
[{ text: 'Smaller steps' }, { text: 'Bigger steps' }],
[{ text: '📸' }]
]
}
})
break;
case '↖️':
robot.moveMouse(pos.x - mouse_step, pos.y - mouse_step)
break;
case '⬆️':
robot.moveMouse(pos.x, pos.y - mouse_step)
break;
case '↗️':
robot.moveMouse(pos.x + mouse_step, pos.y - mouse_step)
break;
case '⬅️':
robot.moveMouse(pos.x - mouse_step, pos.y)
break;
case '🔴':
robot.mouseClick()
break;
case '➡️':
robot.moveMouse(pos.x + mouse_step, pos.y)
break;
case '↙️':
robot.moveMouse(pos.x - mouse_step, pos.y + mouse_step)
break;
case '⬇️':
robot.moveMouse(pos.x, pos.y + mouse_step)
break;
case '↘️':
robot.moveMouse(pos.x + mouse_step, pos.y + mouse_step)
break;
case 'Bigger steps':
mouse_step = mouse_step + 3
break;
case 'Smaller steps':
mouse_step = mouse_step - 3
break;
case '📸':
child_process.exec('screencapture -C -t jpg -r ./monitor.jpg', () => {
bot.sendPhoto(msg.chat.id, 'monitor.jpg', { caption: '🖥' })
})
break;
}
})