-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputa.py
More file actions
528 lines (454 loc) · 21.1 KB
/
computa.py
File metadata and controls
528 lines (454 loc) · 21.1 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
import asyncio
from discord.ext import commands
import discord
import sys, time, os
import webbrowser as wb
import pyautogui
from discord import FFmpegPCMAudio
from gtts import gTTS
import requests
import win32gui
from tkinter import messagebox
import movetotxt, view_screen
import conf
activity = discord.Activity(type=discord.ActivityType.watching, name=f"Wextra's PC||{conf.PREFIX}help")
bot = commands.Bot(command_prefix=conf.PREFIX,
activity = activity,
help_command=None,
case_insensitive=True,
intents=discord.Intents.all())
host = conf.HOSTNAME # ex: C:/Users/QwertyL0L/Downloads/computa.py
def focus_window(URL=str):
wb.WindowsDefault().open_new(URL)
# Get handles of all top-level windows
windows = []
win32gui.EnumWindows(lambda hwnd, windows: windows.append(hwnd), windows)
# Find the window with a title containing Microsoft Edge
edge_window = next((hwnd for hwnd in windows if "Edge" in win32gui.GetWindowText(hwnd)), None)
if edge_window:
# Bring the window to the front and give it focus
win32gui.ShowWindow(edge_window, 5) # 5 corresponds to SW_SHOW
win32gui.SetForegroundWindow(edge_window)
else:
wb.WindowsDefault().open_new(URL)
def restart_bot():
os.execv(sys.executable, ['python'] + sys.argv)
@bot.event
async def on_ready():
print(f"Logged In As {bot.user.name}")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def rickroll(ctx: commands.Context):
focus_window("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
await ctx.reply("***Opened a rickroll link***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def msgbox(ctx: commands.Context, * ,text: str):
if text == "":
await ctx.reply("***Please enter some text for the message box***")
else:
messagebox.showinfo(title=f'Message from {ctx.author.display_name}', message=text)
time.sleep(1)
await ctx.reply("***Opened a message box***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def cmdprompt(ctx: commands.Context):
os.startfile("cmd.exe")
await ctx.reply("***Opened Command Prompt***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def calc(ctx: commands.Context):
os.startfile("calc.exe")
await ctx.reply("***Opened calculator***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def youtube(ctx: commands.Context):
focus_window("https://www.youtube.com")
await ctx.reply("***Opened Youtube.com***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def roblox(ctx: commands.Context):
focus_window("https://www.roblox.com")
await ctx.reply("***Opened roblox.com***")
@bot.command()
async def uselessfacts(ctx: commands.Context):
url = "https://uselessfacts.jsph.pl/api/v2/facts/random?language=en"
response = requests.get(url)
await ctx.reply(response.json()["text"])
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def google(ctx: commands.Context, *, text: str):
wb.open(f"https://www.google.com/search?q={text}", new=2)
if text == "":
await ctx.reply("***Please enter a search term***")
else:
await ctx.reply("***Searched for {} on Google.***".format(text))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def translate(ctx: commands.Context, lang1: str, lang2: str, *, text: str):
focus_window(f"https://translate.google.com/?sl={lang1}&tl={lang2}&text={text}&op=translate")
await ctx.reply("***Opened Google Translate.***")
@bot.command(pass_context = True)
@commands.cooldown(1, 10, commands.BucketType.user)
async def speak(ctx: commands.Context, *, text: str):
if text == "":
await ctx.reply("***Please enter some text to speak***")
else:
language = 'en'
tts = gTTS(text=f'{text}', lang=language, slow=False)
tts.save("tts.mp3")
source = FFmpegPCMAudio('tts.mp3')
channel = ctx.message.author.voice.channel
voice = await channel.connect()
player = voice.play(source)
await ctx.reply("playing audio...")
while voice.is_playing(): #Checks if voice is playing
await asyncio.sleep(1) #While it's playing it sleeps for 1 second
else:
await asyncio.sleep(1) #If it's not playing it waits 15 seconds
while voice.is_playing(): #and checks once again if the bot is not playing
break #if it's playing it breaks
else:
await voice.disconnect() #if not it disconnects
await os.remove("tts.mp3") # deletes tts.mp3
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def ytsearch(ctx: commands.Context, *, text: str):
focus_window(f"https://www.youtube.com/results?search_query={text}")
if text == "":
await ctx.reply("***Please enter a search term***")
else:
await ctx.reply("***Opened Youtube Search***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def error(ctx: commands.Context, *, text: str):
if text == "":
await ctx.reply("***Please enter some text for the error window***")
else:
pyautogui.alert(text=text, title='Error 404', button='OK')
await ctx.reply("***Opened an Error Window***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def lunarclient(ctx: commands.Context):
os.startfile(f"C:/Users/{host}/Desktop/Lunar Client.lnk")
await ctx.reply("***Opened Lunar Client***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def autoclicker(ctx: commands.Context):
os.startfile(f"C:/Users/{host}/Downloads/AutoClicker.exe")
await ctx.reply("***Opened AutoClicker***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def browser(ctx: commands.Context):
wb.WindowsDefault().open()
await ctx.reply("***Opened new Browser window***")
# os.startfile("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def history(ctx: commands.Context):
pyautogui.hotkey("ctrl", "h")
await ctx.reply("***Opened Search History***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def snake(ctx: commands.Context):
focus_window("https://www.google.com/search?q=snake+google")
await ctx.reply("***Opened Google Snake***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def notepad(ctx: commands.Context, * , text: str):
if text == "":
await ctx.reply("***Please enter some text for the notepad***")
else:
os.startfile("notepad.exe")
time.sleep(0.3)
pyautogui.press('enter')
time.sleep(1)
pyautogui.write(f'{text}')
await ctx.reply("***Opened NotePad***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def tab(ctx: commands.Context):
focus_window()
await ctx.reply("***Opened New Tab***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def devtools(ctx: commands.Context):
focus_window()
pyautogui.hotkey("ctrl", "shift", "i")
await ctx.reply("***Opened Dev Tools***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def minecraft(ctx: commands.Context):
await ctx.reply("***Opened Minecraft Launcher***")
os.startfile(f"C:/Users/{host}/Downloads/Minecraft Installer.exe")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def screenshot(ctx: commands.Context):
ss = pyautogui.screenshot()
ss.save('user_screenshot.png')
file = discord.File("user_screenshot.png")
await ctx.send(file=file, content=f"{ctx.author.mention}'s Screenshot of Wextra's PC")
time.sleep(1)
await os.remove("user_screenshot.png")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def robloxsearch(ctx: commands.Context, ID: str):
focus_window(f"https://www.roblox.com/users/{ID}/profile")
await ctx.reply("***Opened Roblox Search***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def maps(ctx: commands.Context):
await ctx.reply("***removed due to potential privacy issues (might come back in future update idk)***")
#focus_window(f"https://www.google.com/maps/dir///{address}")
# await ctx.reply("***Opened Google Maps***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def url(ctx: commands.Context, page_url: str):
focus_window(url=page_url)
await ctx.reply(f"***Opened {page_url}***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def vup(ctx: commands.Context, *, amount: int):
for _ in range(amount / 2):
pyautogui.hotkey("volumeup")
await ctx.reply("***Increased Volume by {}***".format(amount))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def vdown(ctx: commands.Context, *, amount: int):
for _ in range(amount / 2):
pyautogui.hotkey("volumedown")
await ctx.reply("***Decreased Volume by {}***".format(amount))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def downloads(ctx: commands.Context):
pyautogui.hotkey("ctrl","j")
await ctx.reply("***Opened Downloads***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def pcdownloads(ctx: commands.Context):
os.startfile(f"C:/Users/{host}/Downloads")
await ctx.reply("***Opened Downloads***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def bup(ctx: commands.Context, *, amount: int):
for _ in range(amount / 2):
pyautogui.hotkey("f3")
await ctx.reply("***Increased Brightness by {}***".format(amount))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def bdown(ctx: commands.Context, *, amount: int):
for _ in range(amount / 2):
pyautogui.hotkey("f2")
await ctx.reply("***Decreased Brightness by {}***".format(amount))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def taskmgr(ctx: commands.Context):
await ctx.reply("***Opened Task Manager***")
os.startfile("taskmgr.exe")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def bcalc(ctx: commands.Context, * , firstnumber: str, secondnumber: str):
focus_window(f"https://www.google.com/search?q={firstnumber}+{secondnumber}")
if firstnumber == "" or secondnumber == "":
await ctx.reply("***Please enter some numbers***")
else:
await ctx.reply("***Opened Browser Calculator***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def close(ctx: commands.Context):
await ctx.reply("***Closed the current window***")
pyautogui.hotkey("alt", "f4")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def hotkey(ctx: commands.Context,*,k1: str, k2: str):
await ctx.reply(f"***Successfully Pressed {k1} + {k2}***")
if k1 == "" or k2 == "":
await ctx.reply("***Please enter some keys***")
else:
pyautogui.hotkey(f"{k1}",f"{k2}")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def type(ctx: commands.Context, *, text: str):
pyautogui.write(text)
pyautogui.hotkey("enter")
await ctx.reply(f"***Made The Host Type {text}***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def ngrams(ctx: commands.Context, * , text: str):
focus_window(f"https://books.google.com/ngrams/graph?content={text}")
await ctx.reply("***Opened Google Ngrams***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def clock(ctx: commands.Context):
os.system('explorer.exe shell:Appsfolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App')
await ctx.reply("***Opened Clock***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def restart(ctx: commands.Context):
author_id = str(ctx.author.id)
if author_id == conf.USER_ID or 898358037239201812:
await ctx.reply('Restarting...')
restart_bot()
else:
await ctx.send("You arent the owner of the bot!")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def ytvideo(ctx: commands.Context, id: str):
focus_window(f"https://www.youtube.com/watch?v={id}")
if id == "":
await ctx.reply("***Please enter a video id***")
else:
await ctx.reply("***Opened A Youtube Video***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def rule34(ctx: commands.Context, *, tag: str):
focus_window(f"https://rule34.xxx/index.php?page=post&s=list&tags={tag}")
if tag == "":
await ctx.reply("***Please enter a tag***")
else:
await ctx.reply(f"***Searched {tag} on rule34.xxx***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def pornhub(ctx: commands.Context, *, query: str):
focus_window(f"https://www.pornhub.com/video/search?search={query}")
if query == "":
await ctx.reply("***Please enter a search query***")
else:
await ctx.reply(f"***Searched {query} On pornhub.com***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def moveto(ctx: commands.Context, *, text: str):
if text == "":
await ctx.reply("***Please enter a word to move to...***")
else:
movetotxt.move_to_text(text, 60)
time.sleep(1.5)
await ctx.reply(f"***Clicked on {text}***")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def viewpc(ctx: commands.Context):
view_screen.update_screenshot.start(ctx)
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def stopview(ctx: commands.Context):
view_screen.update_screenshot.stop()
await ctx.reply("Stopped viewing the Host's PC")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def help(ctx: commands.Context):
embed = discord.Embed(color=0x0BA8B4, title="Help")
embed.add_field(name="help", value="shows this page", inline=True)
embed1 = discord.Embed(color=0x0BA8B4, title="App Commands")
embed1.add_field(name="autoclicker", value="opens autoclicker", inline=True)
embed1.add_field(name="cmdprompt", value="opens command prompt", inline=True)
embed1.add_field(name="devtools", value="opens devtools", inline=True)
embed1.add_field(name="error", value="opens a error window", inline=True)
embed1.add_field(name="minecraft", value="opens minecraft", inline=True)
embed1.add_field(name="roblox launcher", value="opens roblox launcher", inline=True)
embed1.add_field(name="lunarclient", value="opens lunarclient", inline=True)
embed1.add_field(name="calc", value="opens calculator", inline=True)
embed1.add_field(name="clock", value="opens the clock app", inline=True)
embed1.set_footer(text="Page 1/6")
embed2 = discord.Embed(color=0x0BA8B4, title="System Commands")
embed2.add_field(name="vup", value="turn up pc volume", inline=True)
embed2.add_field(name="vdown", value="turn down pc volume", inline=True)
embed2.add_field(name="bup", value="turn up brightness", inline=True)
embed2.add_field(name="bdown", value="turn down brightness", inline=True)
embed2.add_field(name="msgbox", value="opens msgbox", inline=True)
embed2.add_field(name="screenshot", value="takes a screenshot of pc", inline=True)
embed2.add_field(name="pcdownloads", value="checks pc downloads folder", inline=True)
embed2.set_footer(text="Page 2/6")
embed3 = discord.Embed(color=0x0BA8B4, title="Browser Commands")
embed3.add_field(name="maps", value="opens google maps (removed for now)", inline=True)
embed3.add_field(name="browser", value="opens new Browser window", inline=True)
embed3.add_field(name="roblox", value="opens roblox.com", inline=True)
embed3.add_field(name="robloxsearch", value="search any roblox user with their ID", inline=True)
embed3.add_field(name="snake", value="opens google snake (idk why i added this)", inline=True)
embed3.add_field(name="tab", value="opens new tab", inline=True)
embed3.add_field(name="translate", value="opens google translate in a new tab/window", inline=True)
embed3.add_field(name="url", value="opens any url in a new tab (rip my search history)", inline=True)
embed3.add_field(name="ytsearch", value="search youtube for videos", inline=True)
embed3.add_field(name="uselessfacts", value="opens useless facts api website", inline=True)
embed3.add_field(name="devtools", value="opens devtools", inline=True)
embed3.add_field(name="bcalc", value="opens calculator in Browser", inline=True)
embed3.add_field(name="ngrams", value="opens google ngrams", inline=True)
embed3.add_field(name="downloads", value="checks browser downloads", inline=True)
embed3.set_footer(text="Page 3/6")
embed4 = discord.Embed(color=0x0BA8B4, title="Trolling Commands")
embed4.add_field(name="poosay", value="calls you a poosay (suggested by an old friend)", inline=True)
embed4.add_field(name="rickroll", value="opens a rickroll", inline=True)
embed4.add_field(name="history", value="opens browser history", inline=True)
embed4.add_field(name="close", value="closes active window", inline=True)
embed4.add_field(name="hotkey", value="presses hotkeys", inline=True)
embed4.add_field(name="type", value="makes the host type anything", inline=True)
embed4.set_footer(text="Page 4/6")
embed5 = discord.Embed(color=0x0BA8B4, title="NSFW Commands")
embed5.add_field(name="r34", value="searches rule34.xxx for images", inline=True)
embed5.add_field(name="pornhub", value="searches pornhub.com for videos", inline=True)
embed5.set_footer(text="Page 5/6")
embed6 = discord.Embed(color=0x0BA8B4, title="Mouse Commands")
embed6.add_field(name="moveto", value="moves the mouse to some text on screen", inline=True)
embed6.add_field(name="click", value="clicks at the current position", inline=True)
embed6.add_field(name="viewpc", value="lets you view the pc and see whats going on", inline=True)
embed6.add_field(name="stopview", value="stops viewing the pc", inline=True)
embed6.set_footer(text="Page 6/6")
reactions = ("◀️", "🛑", "▶️")
current_page = 0
if current_page == 0:
page = await ctx.send(embed=embed)
for emoji in reactions:
await page.add_reaction(emoji)
while True:
try:
reaction, user = await bot.wait_for('reaction_add', timeout=45.0, check=lambda reaction, user: user == ctx.author)
if str(reaction.emoji) == "◀️":
current_page -= 1
elif str(reaction.emoji) == "▶️":
current_page += 1
elif str(reaction.emoji) == "🛑":
await reaction.remove(user)
await page.delete(delay=2.5)
break # Exit the loop if the stop button is clicked
# Ensure current_page is within bounds
current_page = max(0, min(current_page, 6))
if current_page == -1:
await page.edit(embed=embed6)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 0:
await page.edit(embed=embed)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 1:
await page.edit(embed=embed1)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 2:
await page.edit(embed=embed2)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 3:
await page.edit(embed=embed3)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 4:
await page.edit(embed=embed4)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 5:
await page.edit(embed=embed5)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 6:
await page.edit(embed=embed6)
await reaction.remove(user) # Remove the user's reaction after processing
elif current_page == 7:
await page.edit(embed=embed)
await reaction.remove(user) # Remove the user's reaction after processing
except asyncio.TimeoutError:
await page.edit("Timed out.")
await page.delete(delay=2.5)
break # Exit the loop on timeout
@bot.event
async def on_command_error(ctx: commands.Context, error):
if isinstance(error, commands.CommandNotFound):
await ctx.reply(f"Invalid Command. Type **{conf.PREFIX}help** to see all commands")
elif isinstance(error, commands.CommandOnCooldown):
await ctx.send(f"Slow down! Try again in **{round(error.retry_after)}s.**")
elif isinstance(ctx.channel, discord.channel.DMChannel):
await ctx.send(f"You cant use the bot in DMs. Please run the command in a server.")
return
bot.run(conf.TOKEN)