66import json
77import datetime
88from PIL import ImageGrab
9+ import time
910
1011DATA_JSON_PATH = "D:\Coding\Discord bots\python-windows-bot\data\data.json"
1112SCREENSHOT_PATH = "D:\Coding\Discord bots\python-windows-bot\data\mouse-ss.png"
@@ -47,18 +48,19 @@ async def monitor_mouse_movement(client, config, starting_mouse_position):
4748 current_mouse_position = pyautogui .position ()
4849
4950 if current_mouse_position != previous_mouse_position :
51+ current_time = int (time .time ())
5052 print (f"[mouse_movement_LOG] - { last_movement_time } : Mouse Movement Detected." )
51- message = f"Mouse moved to `{ current_mouse_position [0 ]} `, `{ current_mouse_position [1 ]} `"
53+ message = f"Mouse moved to `{ current_mouse_position [0 ]} `, `{ current_mouse_position [1 ]} ` at " + f'<t: { current_time } >'
5254 last_movement_time = datetime .datetime .now ().strftime ("%d-%m-%Y %H:%M:%S" )
5355
5456 try :
5557 screenshot = ImageGrab .grab (
56- bbox = (
57- current_mouse_position [0 ] - 400 ,
58- current_mouse_position [1 ] - 300 ,
59- current_mouse_position [0 ] + 400 ,
60- current_mouse_position [1 ] + 300 ,
61- )
58+ # bbox=(
59+ # current_mouse_position[0] - 400,
60+ # current_mouse_position[1] - 300,
61+ # current_mouse_position[0] + 400,
62+ # current_mouse_position[1] + 300,
63+ # )
6264 )
6365
6466 screenshot .save (SCREENSHOT_PATH )
@@ -69,12 +71,12 @@ async def monitor_mouse_movement(client, config, starting_mouse_position):
6971
7072
7173
72- # Check if image_message is not None and attempt to delete it if it exists
73- if image_message :
74- try :
75- await image_message .delete ()
76- except discord .NotFound :
77- pass # Message already deleted or not found
74+ # # Check if image_message is not None and attempt to delete it if it exists
75+ # if image_message:
76+ # try:
77+ # await image_message.delete()
78+ # except discord.NotFound:
79+ # pass # Message already deleted or not found
7880
7981 image_message = await log_channel .send (
8082 message , file = discord .File (SCREENSHOT_PATH )
0 commit comments