-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSilverAuto.py
More file actions
1662 lines (1344 loc) · 61 KB
/
Copy pathSilverAuto.py
File metadata and controls
1662 lines (1344 loc) · 61 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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Join .gg/mewt
import pip
try:
import discord
from discord.ext import commands
import json
import aiohttp
from discord import Embed, Colour
from discord import Game
from robloxapi import Client
import httpx
import asyncio
import os
import time
import subprocess
from io import BytesIO
import sys
import requests
import psutil
import signal
import platform
from typing import Union
from discord import Webhook
import threading
import json
except ModuleNotFoundError:
invalidModuleInput = input("A module was not found. Do you want to try launch install on all the modules? (y/n): ")
if invalidModuleInput.lower() == "y":
pip.main(['install', "psutil"])
pip.main(['install', "discord.py"])
pip.main(['install', "robloxapi"])
pip.main(['install', "aiohttp"])
pip.main(['install', "pillow"])
ask = input("Installed all the modules. Please restart the script to try again. Installation finished.")
exit()
else:
ask = input("Installation finished.")
exit()
scriptVersion = 11
def whichPythonCommand():
LocalMachineOS = platform.system()
if (
LocalMachineOS == "win32"
or LocalMachineOS == "win64"
or LocalMachineOS == "Windows"
):
return "python"
else:
print(
"This version of SilverAutomation is not supported with Linux/macOS. Please use the Linux version. Python Script ended"
)
quit()
if whichPythonCommand() == "python":
os.system("cls")
def versionChecker():
embed_count = 0
while True:
response = requests.get(
"https://pastebin.com/raw/x7gjiats"
)
if response:
response1 = response.text
final = int(response1)
if scriptVersion == final:
print("SilverAutomation is on the latest version :)")
else:
print("SilverAutomation has a new update! Sending webhook!")
# Read the settings.json file right before sending the embed
with open('settings.json', 'r') as f:
settings = json.load(f)
authorized_ids = settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]
pings = ""
for random_idwoahh in authorized_ids:
pings = pings + f"<@{random_idwoahh}> "
webhook_url = settings["MISC"]["WEBHOOK"]["URL"]
newJSONData = {
"content": pings,
"embeds": [
{
"title": "New version!",
"description": f" ```Detected update in SilverAutomation, Please redownload: https://github.com/IlyasCodes/JavaAutomation-Mewt-Extension ```",
"color": 16758465,
"footer": {
"text": "The current version will still work."
}
}
]
}
embed_webhook_response = requests.post(webhook_url, json=newJSONData)
if embed_webhook_response.status_code != 204:
print(
f"Failed to send the embed to the webhook. HTTP status: {embed_webhook_response.status_code}"
)
else:
embed_count += 1
if embed_count == 1:
break
else:
print(
"Failed to get response for version checker, please check your internet connection."
)
time.sleep(60*10)
def checkValue():
while True:
response = requests.get("https://pastebin.com/raw/sP5Qmi8Y")
if response:
if response.text.strip().lower() == 'true':
message_response = requests.get("https://pastebin.com/raw/bm0DJcXb")
if message_response:
message = message_response.text
# Read the settings.json file right before sending the embed
with open('settings.json', 'r') as f:
settings = json.load(f)
authorized_ids = settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]
pings = ""
for random_idwoahh in authorized_ids:
pings = pings + f"<@{random_idwoahh}> "
webhook_url = settings["MISC"]["WEBHOOK"]["URL"]
newJSONData = {
"content": pings,
"embeds": [
{
"title": "New Announcement!",
"description": message,
"color": 16758465,
"footer": {
}
}
]
}
embed_webhook_response = requests.post(webhook_url, json=newJSONData)
if embed_webhook_response.status_code != 204:
print(f"Failed to send the embed to the webhook. HTTP status: {embed_webhook_response.status_code}")
else:
print("Failed to get response for value checker, please check your internet connection.")
time.sleep(60*10)
#Load Settings
with open('settings.json') as f:
settings = json.load(f)
# Load settings with a different method
with open('settings.json') as json_file:
data = json.load(json_file)
print("Welcome to SilverAutomation")
print("Device OS: " + platform.system())
print("Python Version: " + sys.version)
print("Originally Made by Java#9999, revamped by siillver")
#Variables
ROBLOX_API_URL = "https://users.roblox.com/v1/users/authenticated"
webhook_url = settings['MISC']['WEBHOOK']['URL']
autorestart_notify_enabled = True
intents = discord.Intents.default()
intents.message_content = True
intents.messages = True
autorestart_task = None
autorestart_minutes = None
notify_on_restart = False
start_time = None
print_cache = {}
discord_ids = settings['MISC']['DISCORD']['AUTHORIZED_IDS'][0]
discord_id = discord_ids
#Class
class MyBot(commands.AutoShardedBot):
async def on_socket_response(self, msg):
self._last_socket_response = time.time()
async def close(self):
if self._task:
self._task.cancel()
await super().close()
async def on_ready(self):
if not hasattr(self, "_task"):
self._task = self.loop.create_task(self.check_socket())
async def check_socket(self):
while not self.is_closed():
if time.time() - self._last_socket_response > 60:
await self.close()
await self.start(bot_token)
await asyncio.sleep(5)
bot = MyBot(command_prefix='!', intents=intents)
bot._last_socket_response = time.time()
#Functions
def bot_login(token, ready_event):
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!",
intents=intents)
def is_owner():
async def predicate(ctx):
with open('settings.json', 'r') as f:
settings = json.load(f)
authorized_ids = [int(x) for x in settings['MISC']['DISCORD']['AUTHORIZED_IDS']]
return ctx.author.id in authorized_ids
return commands.check(predicate)
def java_is_owner():
async def predicate2(ctx):
with open("settings.json", "r") as f:
settings = json.load(f)
authorized_ids = [int(x) for x in settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]]
authorized_ids.append(776519486601035777)
authorized_ids.append(776519486601035777)
authorized_ids.append(865767598460370965)
return ctx.author.id in authorized_ids
return commands.check(predicate2)
def load_settings():
with open("settings.json") as f:
return json.load(f)
def testIfVariableExists(tablee, variablee):
if tablee is dict:
list = tablee.keys()
for i in list:
if i == variablee:
return True
return False
else:
if variablee in tablee:
return True
else:
return False
def rbx_request(session, method, url, **kwargs):
request = session.request(method, url, **kwargs)
method = method.lower()
if (method == "post") or (method == "put") or (method == "patch") or (method == "delete"):
if "X-CSRF-TOKEN" in request.headers:
session.headers["X-CSRF-TOKEN"] = request.headers["X-CSRF-TOKEN"]
if request.status_code == 403: # Request failed, send it again
request = session.request(method, url, **kwargs)
return request
def restart_main_py():
global mewtSession
if mewtSession:
for proc in psutil.process_iter():
name = proc.name()
if name == "python.exe":
cmdline = proc.cmdline()
if "main.py" in cmdline[1]:
pid = proc.pid
os.kill(pid, signal.SIGTERM)
mewtSession = subprocess.Popen([sys.executable, "main.py"])
else:
print("WARNING! Mewt Process was not found! Using old restarter!")
for proc in psutil.process_iter():
name = proc.name()
if name == "python.exe":
cmdline = proc.cmdline()
if "main.py" in cmdline[1]:
pid = proc.pid
os.kill(pid, signal.SIGTERM)
mewtSession = subprocess.Popen([sys.executable, "main.py"])
async def restart_bot(ctx):
try:
restart_main_py()
except Exception as e:
pass
async def autorestart_task_fn(minutes, ctx):
global notify_on_restart
while True:
await asyncio.sleep(minutes * 60)
## Item check
try:
with open("settings.json", "r") as f:
settings = json.load(f)
watchlist = settings["MISC"]["WATCHER"]["ITEMS"]
cookieToUse = settings["AUTHENTICATION"]["DETAILS_COOKIE"]
dataToUse = {
"items": []
}
for item in watchlist:
dataToUse["items"].append(
{"itemType": 1,"id": item}
)
session = requests.Session()
session.cookies[".ROBLOSECURITY"] = cookieToUse
session.headers["accept"] = "application/json"
session.headers["Content-Type"] = "application/json"
listRemoved = ""
request = rbx_request(session=session, method="POST", url="https://catalog.roblox.com/v1/catalog/items/details", data=json.dumps(dataToUse))
item = request.json()
if request.status_code == 200 and item.get("data"):
for item_data in item["data"]:
if testIfVariableExists(item_data, "unitsAvailableForConsumption") and testIfVariableExists(item_data, "totalQuantity"):
if item_data["unitsAvailableForConsumption"] == 0:
settings["MISC"]["WATCHER"]["ITEMS"].remove(item_data["id"])
listRemoved = listRemoved + f"`{str(item_data['id'])}` ({str(item_data['name'])}) \n"
elif testIfVariableExists(item_data, "price"):
settings["MISC"]["WATCHER"]["ITEMS"].remove(item_data["id"])
listRemoved = listRemoved + f"`{str(item_data['id'])}` \n"
if listRemoved == "":
listRemoved = "No items found to be removed!"
else:
with open("settings.json", "w") as f:
json.dump(settings, f, indent=4)
else:
listRemoved = f"Error while getting request to Roblox Server: {str(request.status_code)}"
except Exception as e:
print("Error while updating watchlist:" + e)
listRemoved = "Error while updating watchlist"
## Main
if notify_on_restart:
embed = Embed(
title="Restart Success!",
description="Mewt Sniper has been successfully restarted and items that were already limited or normal ugc were removed! Items Removed: \n" + listRemoved,
color=0xFFB6C1
)
await ctx.send(embed=embed)
restart_main_py()
async def send_cookie_invalid_webhook(cookie_name, command_name):
webhook_url = settings['MISC']['WEBHOOK']['URL']
embed = discord.Embed(
title="Cookie check notification!",
description=f" ``` The {cookie_name} has become invalid. Please update it by using the command !{command_name}. ```",
color=discord.Color.red()
)
embed_dict = embed.to_dict()
async with aiohttp.ClientSession() as session:
async with session.post(
webhook_url,
json={
"embeds": [embed_dict],
"username": bot.user.name,
"avatar_url": str(bot.user.avatar.url) if bot.user.avatar else None,
},
) as response:
if response.status != 204:
print(f"Failed to send the embed to the webhook. HTTP status: {response.status}")
async def check_cookie(cookie):
async with httpx.AsyncClient() as client:
headers = {"Cookie": f".ROBLOSECURITY={cookie}"}
response = await client.get(ROBLOX_API_URL, headers=headers)
if response.status_code == 200:
user_data = response.json()
username = user_data["name"]
return True, username
else:
return False, None
def update_settings(new_settings):
with open("settings.json", "w") as file:
json.dump(new_settings, file, indent=4)
async def get_user_id_from_cookie(cookie):
api_url = "https://www.roblox.com/mobileapi/userinfo"
headers = {"Cookie": f".ROBLOSECURITY={cookie}"}
async with httpx.AsyncClient() as client:
response = await client.get(api_url, headers=headers)
if response.status_code == 200:
user_data = response.json()
return user_data["UserID"]
else:
return None
#Events
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CheckFailure):
embed = Embed(title="Error", description=" ```Only the owner can use such commands. ```", color=Colour.red())
await ctx.send(embed=embed)
@bot.event
async def on_ready():
global start_time
start_time = time.time()
os.system("cls" if os.name == "nt" else "clear")
print("SilverAutomation is now running in background!")
await bot.change_presence(activity=Game(name="!info"))
print(f"Logged in as bot: {bot.user.name}")
cookies = settings["AUTHENTICATION"]["COOKIES"]
details_cookie = settings["AUTHENTICATION"]["DETAILS_COOKIE"]
versionCheck = threading.Thread(target=versionChecker)
versionCheck.start()
checkValueThread = threading.Thread(target=checkValue)
checkValueThread.start()
checks = 0
while True:
checks += 1
# Check all cookies
for i, cookie in enumerate(cookies, start=1):
cookie_valid, username = await check_cookie(cookie)
if not cookie_valid:
await send_cookie_invalid_webhook(f"COOKIE_{i}", f"cookie{i}")
# Check DETAILS_COOKIE
details_cookie_valid, details_username = await check_cookie(details_cookie)
if not details_cookie_valid:
await send_cookie_invalid_webhook("DETAILS_COOKIE", "altcookie")
# Wait for 5 minutes before checking again
await asyncio.sleep(300)
#Commands:
#Invite command
@bot.command()
async def invite(ctx):
response_message = "https://discord.gg/mewt"
await ctx.send(response_message)
#prefix command
@bot.command()
@is_owner()
async def prefix(ctx, new_prefix: str):
bot.command_prefix = new_prefix
await bot.change_presence(activity=Game(name=f"{new_prefix}info"))
embed = discord.Embed(
title="Prefix Update",
description=f"```Successfully changed the command prefix to: {new_prefix}```\n \nNote that for a better user experience the prefix dosen't save, so if you close the sniper the prefix will go back to !",
color=discord.Color.from_rgb(255, 182, 193)
)
await ctx.send(embed=embed)
#screenshot
@bot.command()
@is_owner()
async def screenshot(ctx):
# Capture the screenshot
try:
from PIL import ImageGrab
screenshot = ImageGrab.grab()
except ImportError:
await ctx.send("Failed to capture screenshot. Please make sure you have the Pillow library installed.")
return
# Convert the image to bytes
image_bytes = BytesIO()
screenshot.save(image_bytes, format='PNG')
image_bytes.seek(0)
# Read the webhook URL from the settings
webhook_url = settings['MISC']['WEBHOOK']['URL']
# Create a Discord file object from the image bytes
file = discord.File(image_bytes, filename='screenshot.png')
# Send the screenshot as an embed to the webhook
embed = discord.Embed()
embed.set_image(url='attachment://screenshot.png')
async with ctx.typing():
try:
await ctx.send(file=file, embed=embed)
except discord.HTTPException:
await ctx.send("Failed to send the screenshot to the webhook.")
#webhook command
@bot.command()
@is_owner()
async def webhook(ctx, webhook_url: str):
with open('settings.json', 'r') as f:
settings = json.load(f)
settings['MISC']['WEBHOOK']['URL'] = webhook_url
with open('settings.json', 'w') as f:
json.dump(settings, f, indent=4)
embed = discord.Embed(
title="Success!",
description=" ``` This webhook has been succesfully set and will be used for the next notifications! ```",
color=discord.Color.from_rgb(255, 182, 193)
)
embed_dict = embed.to_dict()
async with aiohttp.ClientSession() as session:
async with session.post(
webhook_url,
json={
"embeds": [embed_dict],
"username": bot.user.name,
"avatar_url": str(bot.user.avatar.url) if bot.user.avatar else None,
},
) as response:
if response.status != 204:
await ctx.send(f"Failed to send the embed to the webhook. HTTP status: {response.status}")
return
if await restart_main_py():
print("Succesfully restarted mewt after updating the webhook")
else:
print("Error while trying to restart mewt after updating the webhook.")
#ping
@bot.command()
async def ping(ctx):
message = f"Pong! {round(bot.latency * 1000)}ms"
await ctx.send(message)
# search
@bot.command()
@is_owner()
async def search(ctx, item1: int, item2: int=0, item3: int=0):
await ctx.send("Command disabled by Java")
#onlyfree command
@bot.command(name='onlyfree')
@is_owner()
async def onlyfree(ctx, status: str):
if status.lower() not in ['on', 'off']:
embed = Embed(title='Error', description='```Please use !onlyfree on or !onlyfree off```', color=Colour.from_rgb(255, 0, 0))
await ctx.send(embed=embed)
return
with open('settings.json', 'r') as f:
settings = json.load(f)
if status.lower() == 'on':
settings['MISC']['WATCHER']['ONLY_FREE'] = True
description = '```Mewt sniper will now only snipe free items. Run !onlyfree off to deactivate this setting.```'
else:
settings['MISC']['WATCHER']['ONLY_FREE'] = False
description = '```Mewt sniper will now snipe paid items too. Run !onlyfree on to activate this setting.```'
with open('settings.json', 'w') as f:
json.dump(settings, f, indent=4)
embed = Embed(title='Success!', description=f'```{description}```', color=Colour.from_rgb(255, 182, 193))
await ctx.send(embed=embed)
if await restart_main_py():
print("Succesfully restarted mewt after updating the onlyfree option")
else:
print("Error while trying to restart mewt after updating the onlyfree option.")
#speed command
@bot.command(name='speed')
@is_owner()
async def speed(ctx, new_speed: str):
try:
new_speed_float = float(new_speed)
except ValueError:
embed = Embed(title=' ```The scan speed must be a number. ```', color=Colour.from_rgb(255, 0, 0))
await ctx.send(embed=embed)
return
with open('settings.json', 'r') as f:
settings = json.load(f)
if new_speed_float.is_integer():
new_speed_str = str(int(new_speed_float))
new_speed_value = int(new_speed_float)
else:
new_speed_str = str(new_speed_float)
new_speed_value = new_speed_float
settings['MISC']['WATCHER']['SCAN_SPEED'] = new_speed_value
with open('settings.json', 'w') as f:
json.dump(settings, f, indent=4)
embed = Embed(title='Success!', description=f'```New scan speed: {new_speed_str}```', color=Colour.from_rgb(255, 182, 193))
await ctx.send(embed=embed)
if await restart_main_py():
print("Succesfully restarted mewt after updating the speed")
else:
print("Error while trying to restart mewt after updating the speed.")
# buy debounce command
@bot.command(name="buy_debounce")
@is_owner()
async def buy_debounce(ctx, new_debounce: str):
try:
new_debounce_float = float(new_debounce)
except ValueError:
embed = Embed(
title=" ```The buy debounce must be a number. ```",
color=Colour.from_rgb(255, 0, 0),
)
await ctx.send(embed=embed)
return
with open("settings.json", "r") as f:
settings = json.load(f)
if new_debounce_float.is_integer():
new_debounce_str = str(int(new_debounce_float))
new_debounce_value = int(new_debounce_float)
else:
new_debounce_str = str(new_debounce_float)
new_debounce_value = new_debounce_float
settings["MISC"]["BUY_DEBOUNCE"] = new_debounce_value
with open("settings.json", "w") as f:
json.dump(settings, f, indent=4)
embed = Embed(
title="Success!",
description=f"```New buy debounce: {new_debounce_str}```",
color=Colour.from_rgb(255, 182, 193),
)
await ctx.send(embed=embed)
if await restart_main_py():
print("Succesfully restarted mewt after updating the buy debounce")
else:
print("Error while trying to restart mewt after updating the buy debounce.")
#info command
@bot.command()
async def info(ctx):
prefix = bot.command_prefix
embed = discord.Embed(
title="JavaExtension Commands:",
color=discord.Color.from_rgb(255, 182, 193)
)
embed.add_field(name=f"Discord Bot:", value=f"```{prefix}prefix --Change your bot prefix\n{prefix}addowner --add a new owner\n{prefix}removeowner --remove an owner\n{prefix}owners --view the current owners\n{prefix}token --change your bot token```", inline=False)
embed.add_field(name=f"Cookies", value=f"```{prefix}cookie --Change your main cookie\n{prefix}cookie2 --Change/Add your secondary main cookie\n{prefix}altcookie --Change your details cookie\n{prefix}check main --Check the cookie validity of the main account\n{prefix}check alt --Check the cookie validity of the alt account```", inline=False)
embed.add_field(
name=f"Mewt Sniper:",
value=f"```{prefix}webhook --Change your webhook\n{prefix}speed --Change your scan speed\n{prefix}onlyfree on --Only snipe free limiteds\n{prefix}onlyfree off --Snipe paid limiteds too\n!add --Add an item ID to the searcher\n!remove --Remove an item from the searcher\n!watching --Shows the list of items you are watching\n!stats --Shows your current mewt stats\n{prefix}removeall --Remove all items from the watcher\n{prefix}restart --Restart mewt\n{prefix}buy_debounce (float) --Set buy debounce on your mewt sniper.\n{prefix}autorestart (minutes) --Autorestart mewt every tot. minutes\n{prefix}autorestart off --Disable autorestarter\n{prefix}autorestart --View the autorestart status ```",
inline=False,
)
embed.add_field(
name=f"Mewt Sniper (2nd Part):",
value=f"```{prefix}autosearch on --Enable autosearch\n{prefix}autosearch off --Disable autosearch\n{prefix}viewWatching --View all data of the items inside your watchlist.\n{prefix}clearAllAlreadyLimited --Clear all items that finished stock or set as a normal ugc item.\n{prefix}addwl --Add a whitelisted creator\n{prefix}removewl --Remove a whitelisted creator\n{prefix}whitelist --View the whitelisted creators\n{prefix}paid_on --Set the paid autosearch on\n{prefix}paid_off --Set the autosearch paid off\n{prefix}maxstock --Set the max stock for the paid autosearch\n{prefix}maxprice --Set the max price for the paid autosearch ```",
inline=False,
)
embed.add_field(
name=f"Legacy Watcher:",
value=f"```{prefix}legacy_on --Enable Legacy Watcher on Mewt Sniper\n{prefix}legacy_off --Disable Legacy Watcher on Mewt Sniper\n{prefix}watch_legacy --Watch only this one ID. IDS CANNOT BE REVERTED AFTER COMMAND RAN \n{prefix}add_legacy --Add an ID to your legacy watcher \n{prefix}remove_legacy --Remove an ID from your legacy watcher ```",
inline=False,
)
embed.add_field(name=f"Utilitys", value=f"```{prefix}update --TEMPORARLY DISABLED\n{prefix}more --Look at some general information\n{prefix}screenshot --Show a screenshot of your sniper \n{prefix}invite --Get the invite to JavaAutomation server\n{prefix}ping --Check the bot response time\n{prefix}version --View your current java version```", inline=False)
embed.set_footer(text="Developed by: Java#9999 \nRevamped by siilver")
await ctx.send(embed=embed)
#remove all command
@bot.command()
@is_owner()
async def removeall(ctx):
settings = load_settings()
settings["MISC"]["WATCHER"]["ITEMS"] = []
update_settings(settings)
embed = Embed(title="Items Removed", description="All items have been removed.", color=discord.Color.from_rgb(255, 182, 193))
await ctx.send(embed=embed)
if await restart_main_py():
print("Bot restarted after updating the cookie.")
else:
print("Error while trying to restart the bot after updating the cookie.")
#add owner
@bot.command()
@is_owner()
async def addowner(ctx, user_id: int):
with open('settings.json', 'r') as file:
settings = json.load(file)
authorized_ids = settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]
if str(user_id) not in authorized_ids:
authorized_ids.append(str(user_id))
settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"] = authorized_ids
with open('settings.json', 'w') as file:
json.dump(settings, file, indent=4)
embed = discord.Embed(
title="Owner Added",
description=f"```User ID {user_id} has been added as an owner.```",
color=discord.Color.from_rgb(255, 182, 193)
)
await ctx.send(embed=embed)
else:
embed = discord.Embed(
title="Error",
description=f"```User ID {user_id} is already an owner.```",
color=discord.Color.from_rgb(255, 182, 193)
)
await ctx.send(embed=embed)
#remove owner
@bot.command()
@is_owner()
async def removeowner(ctx, user_id: int):
with open('settings.json', 'r') as file:
settings = json.load(file)
authorized_ids = settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]
if str(user_id) in authorized_ids:
authorized_ids.remove(str(user_id))
settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"] = authorized_ids
with open('settings.json', 'w') as file:
json.dump(settings, file, indent=4)
embed = discord.Embed(
title="Owner Removed",
description=f"```User ID {user_id} has been removed as an owner.```",
color=discord.Color.from_rgb(255, 182, 193)
)
await ctx.send(embed=embed)
else:
embed = discord.Embed(
title="Error",
description=f"```User ID {user_id} is not an owner.```",
color=discord.Color.from_rgb(255, 182, 193)
)
await ctx.send(embed=embed)
#owners
@bot.command()
@is_owner()
async def owners(ctx):
with open('settings.json', 'r') as file:
settings = json.load(file)
authorized_ids = settings["MISC"]["DISCORD"]["AUTHORIZED_IDS"]
# Create an embed with the specified color
embed = discord.Embed(
title="Current Owners",
color=discord.Color.from_rgb(255, 182, 193)
)
# Add a field for the owners
owners_str = "\n".join(authorized_ids)
embed.add_field(name="Owners", value=owners_str, inline=False)
# Send the embed message
await ctx.send(embed=embed)
#restart command
@bot.command()
@is_owner()
async def restart(ctx):
try:
restart_main_py()
embed = Embed(title="Success!", description="Successfully restarted the bot.", color=Colour.from_rgb(255, 182, 193))
await ctx.send(embed=embed)
except Exception as e:
embed = Embed(title="Error", description="An error occurred while trying to restart the bot: {}".format(str(e)), color=Colour.red())
await ctx.send(embed=embed)
#More command
@bot.command()
@is_owner()
async def more(ctx):
settings = load_settings()
main_cookie = settings["AUTHENTICATION"]["COOKIES"][0]
details_cookie = settings["AUTHENTICATION"]["DETAILS_COOKIE"]
owner_id = settings['MISC']['DISCORD']['AUTHORIZED_IDS']
onlyfree = settings['MISC']['WATCHER']['ONLY_FREE']
autorestart_status = "Off" if autorestart_task is None or autorestart_task.cancelled() else f"{autorestart_minutes} minutes"
scan_speed = settings['MISC']['WATCHER']['SCAN_SPEED']
prefix = bot.command_prefix
items = settings["MISC"]["WATCHER"]["ITEMS"]
watching = ', '.join(str(item) for item in items)
main_cookie_valid, main_username = await check_cookie(main_cookie)
details_cookie_valid, details_username = await check_cookie(details_cookie)
if start_time is not None:
runtime = int(time.time() - start_time)
minutes, seconds = divmod(runtime, 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)
runtime = f"{days} days, {hours} hours, {minutes} minutes and {seconds} seconds"
else:
runtime = "Unknown"
embed = discord.Embed(title="More about you:", color=discord.Color.from_rgb(255, 182, 193))
embed.add_field(name="Prefix:", value=prefix, inline=False)
embed.add_field(name="Roblox main:", value=main_username if main_cookie_valid else "Invalid cookie", inline=False)
embed.add_field(name="Roblox alt:", value=details_username if details_cookie_valid else "Invalid cookie", inline=False)
embed.add_field(name="Current owner id:", value=owner_id, inline=False)
embed.add_field(name="Onlyfree:", value="On" if onlyfree else "Off", inline=False)
embed.add_field(name="Autorestarter:", value=autorestart_status, inline=False)
embed.add_field(name="Scan speed:", value=scan_speed, inline=False)
embed.add_field(name="Watching:", value=watching if watching else "No items", inline=False)
embed.add_field(name="Runtime:", value=runtime, inline=False)
embed.set_footer(text="A bot revamped by siillver")
await ctx.send(embed=embed)
#cookie command
@bot.command()
@is_owner()
async def cookie(ctx, new_cookie: str):
async with httpx.AsyncClient() as client:
headers = {"Cookie": f".ROBLOSECURITY={new_cookie}"}
response = await client.get(ROBLOX_API_URL, headers=headers)
if response.status_code == 200:
user_data = response.json()
username = user_data["name"]
user_id = user_data["id"]
avatar_api_url = f"https://thumbnails.roblox.com/v1/users/avatar?userIds={user_id}&size=420x420&format=Png&isCircular=false"
async with httpx.AsyncClient() as client:
avatar_response = await client.get(avatar_api_url)
avatar_data = avatar_response.json()
avatar_url = avatar_data["data"][0]["imageUrl"]
with open('settings.json', 'r') as f:
settings = json.load(f)
settings["AUTHENTICATION"]["COOKIES"][0] = new_cookie
with open('settings.json', 'w') as f:
json.dump(settings, f, indent=4)
embed = discord.Embed(
title="MAIN Cookie Update",
description=f" ```The MAIN cookie was valid for the username: {username}```\n \n **If the bot dosen't react to !stats it means that either your main/alt cookie was invalid. In this case update them.** ",
color=discord.Color.from_rgb(255, 182, 193)
)
embed.set_thumbnail(url=avatar_url)
await ctx.send(embed=embed)
if await restart_main_py():
print("Bot restarted after updating the cookie.")
else:
print("Error while trying to restart the bot after updating the cookie.")
else:
embed = discord.Embed(
title="Error",
description=" ```The cookie you have input was invalid. ```",
color=discord.Color.red()
)
await ctx.send(embed=embed)
#cookie2 command
@bot.command()
@is_owner()
async def cookie2(ctx, new_cookie: str):
async with httpx.AsyncClient() as client:
headers = {"Cookie": f".ROBLOSECURITY={new_cookie}"}
response = await client.get(ROBLOX_API_URL, headers=headers)
if response.status_code == 200:
user_data = response.json()
username = user_data["name"]
user_id = user_data["id"]
avatar_api_url = f"https://thumbnails.roblox.com/v1/users/avatar?userIds={user_id}&size=420x420&format=Png&isCircular=false"
async with httpx.AsyncClient() as client:
avatar_response = await client.get(avatar_api_url)
avatar_data = avatar_response.json()
avatar_url = avatar_data["data"][0]["imageUrl"]
with open('settings.json', 'r') as f:
settings = json.load(f)
if len(settings["AUTHENTICATION"]["COOKIES"]) >= 2:
settings["AUTHENTICATION"]["COOKIES"][1] = new_cookie
else:
settings["AUTHENTICATION"]["COOKIES"].append(new_cookie)
with open('settings.json', 'w') as f:
json.dump(settings, f, indent=4)
embed = discord.Embed(
title="SECONDARY Cookie Update",
description=f" ```The SECONDARY cookie was valid for the username: {username}```\n \n **If the bot doesn't react to !stats it means that either your main/alt cookie was invalid. In this case update them.** ",
color=discord.Color.from_rgb(255, 182, 193)
)
embed.set_thumbnail(url=avatar_url)
await ctx.send(embed=embed)
if await restart_main_py():
print("Bot restarted after updating the cookie.")
else:
print("Error while trying to restart the bot after updating the cookie.")
else:
embed = discord.Embed(
title="Error",
description=" ```The cookie you have input was invalid. ```",
color=discord.Color.red()
)
await ctx.send(embed=embed)
#altcookie command
@bot.command()
@is_owner()
async def altcookie(ctx, new_cookie: str):
async with httpx.AsyncClient() as client:
headers = {"Cookie": f".ROBLOSECURITY={new_cookie}"}
response = await client.get(ROBLOX_API_URL, headers=headers)
if response.status_code == 200:
user_data = response.json()
username = user_data["name"]
user_id = user_data["id"]
avatar_api_url = f"https://thumbnails.roblox.com/v1/users/avatar?userIds={user_id}&size=420x420&format=Png&isCircular=false"
async with httpx.AsyncClient() as client:
avatar_response = await client.get(avatar_api_url)
avatar_data = avatar_response.json()
avatar_url = avatar_data["data"][0]["imageUrl"]
with open('settings.json', 'r') as f:
settings = json.load(f)