-
Notifications
You must be signed in to change notification settings - Fork 4
/
uwu.py
4446 lines (4282 loc) · 200 KB
/
uwu.py
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
# Written by EchoQuill
# Make sure to star the github page.
# I feel sorry for the one reading this code lol
# - EchoQuill
from flask import Flask, request, render_template, jsonify, redirect, url_for
from datetime import datetime, timedelta, timezone
from discord.ext import commands, tasks
from rich.console import Console
from discord import SyncWebhook
from threading import Thread
from rich.panel import Panel
from rich.align import Align
import discord.errors
import subprocess
import threading
import requests
import asyncio
import logging
import discord
import aiohttp
import ctypes
import random
import string
import shutil
import time
import pytz
import json
import sys
import os
import re
# Set AppUserModleId thingy, for tkinter thingy (grouping taskmanager)
try:
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("OwO-Dusk")
except AttributeError:
pass
def clear():
os.system("cls") if os.name == "nt" else os.system("clear")
clear()
# For console.log thingy
console = Console()
console_width = shutil.get_terminal_size().columns
# Owo text art for panel
owoArt = r"""
__ _ _ __ ____ _ _ ____ __ _
/ \ / )( \ / \ ___( \/ )( \/ ___)( / )
( O )\ /\ /( O )(___)) D () \/ (\___ \ ) (
\__/ (_/\_) \__/ (____/\____/(____/(__\_)
"""
# Num:- 5, Font:- Gracefull.
owoPanel = Panel(Align.center(owoArt), style="purple on black", highlight=False)
# Load json file
def resource_path(relative_path):
if hasattr(sys, "_MEIPASS"):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
def clean(msg):
return re.sub(r"[^a-zA-Z]", "", msg)
with open(resource_path("config.json")) as file:
config = json.load(file)
# ----------OTHER VARIABLES----------#
version = "1.7.4"
offline = config["offlineStatus"]
ver_check_url = "https://raw.githubusercontent.com/EchoQuill/owo-dusk/main/version.txt"
saftey_check_url = "https://echoquill.github.io/owo-dusk-api/saftey_check.json"
checkForAlert = config["checkForAlerts"]
stop_code = False
quotesUrl = "https://favqs.com/api/qotd" # ["https://thesimpsonsquoteapi.glitch.me/quotes", "https://favqs.com/api/qotd"]
ver_check = requests.get(ver_check_url).text.strip()
lock = threading.Lock()
typingIndicator = config["typingIndicator"]
list_captcha = ["human", "captcha", "link", "letterword"]
mobileBatteryCheckEnabled = config["termux"]["batteryCheck"]["enabled"]
mobileBatteryStopLimit = config["termux"]["batteryCheck"]["minPercentage"]
batteryCheckSleepTime = config["termux"]["batteryCheck"]["refreshInterval"]
desktopBatteryCheckEnabled = config["desktop"]["batteryCheck"]["enabled"]
desktopBatteryStopLimit = config["desktop"]["batteryCheck"]["minPercentage"]
desktopBatteryCheckSleepTime = config["desktop"]["batteryCheck"]["refreshInterval"]
termuxNotificationEnabled = config["termux"]["notifications"]["enabled"]
notificationCaptchaContent = config["termux"]["notifications"]["captchaContent"]
notificationBannedContent = config["termux"]["notifications"]["bannedContent"]
termuxToastEnabled = config["termux"]["toastOnCaptcha"]["enabled"]
toastBgColor = config["termux"]["toastOnCaptcha"]["backgroundColour"]
toastTextColor = config["termux"]["toastOnCaptcha"]["textColour"]
toastCaptchaContent = config["termux"]["toastOnCaptcha"]["captchaContent"]
toastBannedContent = config["termux"]["toastOnCaptcha"]["bannedContent"]
termuxTtsEnabled = config["termux"]["texttospeech"]["enabled"]
termuxTtsContent = config["termux"]["texttospeech"]["content"]
termuxAudioPlayer = config["termux"]["playAudio"]["enabled"]
termuxAudioPlayerPath = config["termux"]["playAudio"]["path"]
termuxVibrationEnabled = config["termux"]["vibrate"]["enabled"]
termuxVibrationTime = config["termux"]["vibrate"]["time"] * 1000
openCaptchaWebsite = config["termux"]["openCaptchaWebsite"]
desktopNotificationEnabled = config["desktop"]["notifications"]["enabled"]
desktopNotificationCaptchaContent = config["desktop"]["notifications"]["captchaContent"]
desktopNotificationBannedContent = config["desktop"]["notifications"]["bannedContent"]
desktopAudioPlayer = config["desktop"]["playAudio"]["enabled"]
desktopAudioPlayerPath = config["desktop"]["playAudio"]["path"]
websiteEnabled = config["website"]["enabled"]
websitePort = config["website"]["port"]
refresh_interval = config["website"]["refreshInterval"]
captchaConsoleEnabled = config["console"]["runConsoleCommandOnCaptcha"]
banConsoleEnabled = config["console"]["runConsoleCommandOnBan"]
desktopPopup = config["desktop"]["popup"]["enabled"]
captchaPopupMsg = config["desktop"]["popup"]["captchaContent"]
bannedPopupMsg = config["desktop"]["popup"]["bannedContent"]
# Chat commands
chatPrefix = config["textCommands"]["prefix"]
chatCommandToStop = config["textCommands"]["commandToStopUser"]
chatCommandToStart = config["textCommands"]["commandToStartUser"]
chatAllowedUsers = [int(user_id) for user_id in config["textCommands"]["allowedUsers"]]
# print(chatAllowedUsers)
delayCheckApi = config["delayCheck"]["useOwobotApi"]
minPing = config["delayCheck"]["minPing"]
delayCheckMinSleep = config["delayCheck"]["minSleepTime"]
delayCheckMaxSleep = config["delayCheck"]["maxSleepTime"]
delayCheckMinRecheck = config["delayCheck"]["minDelayBetweenRecheck"]
delayCheckMaxRecheck = config["delayCheck"]["maxDelayBetweenRecheck"]
total_seconds_hb = 0
if delayCheckApi:
from utils.delaycheck import delaycheck
if config["commands"][12]["autoHuntBot"]:
from utils.huntBotSolver import solveHbCaptcha
if captchaConsoleEnabled:
captchaConsoleContent = config["console"]["commandToRunOnCaptcha"]
if banConsoleEnabled:
banConsoleContent = config["console"]["commandToRunOnBan"]
# ___Dble check these___
def install_package(package_name):
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
def try_import_or_install(package_name):
try:
__import__(package_name)
print(f"Module {package_name} imported successfully.")
except ImportError:
print(
f"-System[0] {package_name} is not installed, attempting to install automatically..."
)
try:
install_package(package_name)
__import__(package_name)
print(f"{package_name} installed and imported successfully.")
except Exception as e:
print(
f"Failed to install {package_name}. Please run 'pip install {package_name}' and run the script again. Error: {e}"
)
if desktopNotificationEnabled:
try_import_or_install("plyer")
# Import notification from plyer
try:
from plyer import notification
print("Notification module in plyer imported successfully.")
except ImportError as e:
print(f"ImportError: {e}")
if desktopAudioPlayer:
try_import_or_install("playsound3")
# Import playsound from playsound3
try:
from playsound3 import playsound
print("Playsound module in playsound3 imported successfully.")
except ImportError as e:
print(f"ImportError: {e}")
if desktopPopup:
try_import_or_install("tkinter")
try_import_or_install("queue")
try:
import tkinter as tk
from tkinter import PhotoImage
from queue import Queue
print("Queue module in queue imported successfully.")
print("messagebox module in tkinter imported successfully.")
except ImportError as e:
print(f"ImportError: {e}")
if desktopBatteryCheckEnabled:
try_import_or_install("psutil")
try:
import psutil
print("psutil imported successfully")
except Exception as e:
print(f"ImportError: {e}")
webhookEnabled = config["webhook"]["enabled"]
webhook_url = config["webhook"]["webhookUrl"]
webhookUselessLog = config["webhook"]["webhookUselessLog"]
webhookPingId = config["webhook"]["webhookUserIdToPingOnCaptcha"]
webhookCaptchaChnl = config["webhook"]["webhookCaptchaUrl"]
setprefix = config["setprefix"]
# ----------MAIN VARIABLES----------#
listUserIds = []
gem_map = {}
autoHunt = config["commands"][0]["hunt"]
autoBattle = config["commands"][0]["battle"]
useShortForm = config["commands"][0]["useShortForm"]
autoPray = config["commands"][1]["pray"]
autoCurse = config["commands"][1]["curse"]
userToPrayOrCurse = config["commands"][1]["userToPrayOrCurse"]
pingUserOnPrayOrCurse = config["commands"][1]["pingUser"]
autoDaily = config["autoDaily"]
autoOwo = config["commands"][11]["sendOwo"]
autoCrate = config["autoUse"]["autoUseCrate"]
autoLootbox = config["autoUse"]["autoUseLootbox"]
autoHuntGem = config["autoUse"]["autoGem"]["huntGem"]
autoEmpoweredGem = config["autoUse"]["autoGem"]["empoweredGem"]
autoLuckyGem = config["autoUse"]["autoGem"]["luckyGem"]
autoSpecialGem = config["autoUse"]["autoGem"]["specialGem"]
autoGem = autoHuntGem or autoEmpoweredGem or autoLuckyGem or autoSpecialGem
autoSell = config["commands"][2]["sell"]
autoSacrifice = config["commands"][2]["sacrifice"]
autoQuest = config["commands"][4]["quest"]
askForHelpChannel = config["commands"][4]["askForHelpChannel"]
askForHelp = config["commands"][4]["askForHelp"]
doEvenIfDisabled = config["commands"][4]["doEvenIfDisabled"]
animalRarity = ""
for i in config["commands"][2]["rarity"]:
animalRarity = animalRarity + i + " "
autoCf = config["commands"][3]["coinflip"]
coinflipOptions = config["commands"][3]["cfOptions"]
autoSlots = config["commands"][3]["slots"]
doubleOnLose = config["commands"][3]["doubleOnLose"]
gambleAllottedAmount = config["commands"][3]["allottedAmount"]
gambleStartValue = config["commands"][3]["startValue"]
customCommands = config["customCommands"]["enabled"]
lottery = config["commands"][5]["lottery"]
lotteryAmt = config["commands"][5]["amount"]
lvlGrind = config["commands"][6]["lvlGrind"]
useQuoteInstead = config["commands"][6]["useQuoteInstead"]
lvlMinLength = config["commands"][6]["minLengthForRandomString"]
lvlMaxLength = config["commands"][6]["maxLengthForRandomString"]
cookie = config["commands"][7]["cookie"]
cookieUserId = config["commands"][7]["userid"]
pingUserOnCookie = config["commands"][7]["pingUser"]
sleepEnabled = config["commands"][8]["sleep"]
minSleepTime = config["commands"][8]["minTime"]
maxSleepTime = config["commands"][8]["maxTime"]
sleepRandomness = config["commands"][8]["frequencyPercentage"]
giveawayEnabled = config["commands"][9]["giveawayJoiner"]
giveawayChannels = config["commands"][9]["channelsToJoin"]
"""
SHOP-
100-110 - limited time items
200-274 - wallpapers (one time buy)
1-7 - rings
"""
"""shopItemsCash = {
1:10,
2:100,
3:1000,
4:10000,
5:100000,
6:1000000,
7:10000000
}"""
# int(f"1{'0'*i}")
# 10**i ( same as raised to the value i, 10^i)
shopEnabled = config["commands"][10]["shop"]
shopItemsToBuy = config["commands"][10]["itemsToBuy"]
autoHuntBot = config["commands"][12]["autoHuntBot"]
huntbotCashToSpend = config["commands"][12]["cashToSpend"]
skipSpamCheck = shopEnabled == autoSlots == autoCf == autoBattle == autoHunt == False
slashCommandsEnabled = config["useSlashCommands"]
# Logs
logRareHunts = config["logs"]["rareHuntAnimalCatches"]
logLootboxes = config["logs"]["gettingOrOpeningLootboxs"]
logCrates = config["logs"]["gettingOrOpeningCrates"]
customCommandCnt = len(config["customCommands"]["commands"])
if customCommandCnt >= 1:
sorted_zipped_lists = sorted(
zip(
config["customCommands"]["commands"], config["customCommands"]["cooldowns"]
),
key=lambda x: x[1],
)
sorted_list1, sorted_list2 = zip(*sorted_zipped_lists)
else:
sorted_list1 = config["customCommands"]["commands"]
sorted_list2 = config["customCommands"]["cooldowns"]
# lotter amt check:-
if lotteryAmt > 250000:
lotteryAmt = 250000
# Gems.
huntGems = ["057", "056", "055", "054", "053", "052", "051"]
empGems = ["071", "070", "069", "068", "067", "066", "065"]
luckGems = ["078", "077", "076", "075", "074", "073", "072"]
specialGems = ["085", "084", "083", "082", "081", "080", "079"]
if config["autoUse"]["autoGem"]["order"]["lowestToHighest"]:
huntGems.reverse()
empGems.reverse()
luckGems.reverse()
specialGems.reverse()
if autoHuntGem:
gem_map["gem1"] = "autoHuntGem"
if autoLuckyGem:
gem_map["gem4"] = "autoLuckyGem"
if autoEmpoweredGem:
gem_map["gem3"] = "autoEmpoweredGem"
if autoSpecialGem:
gem_map["star"] = "autoSpecialGem"
# print(gem_map)
questsList = []
# Cooldowns
huntBattleR = config["commands"][0]["useReactionBotCooldowns"]
prayCurseR = config["commands"][1]["useReactionBotCooldowns"]
owoR = config["commands"][11]["useReactionBotCooldowns"]
reactionBotEnabled = huntBattleR or prayCurseR or owoR
huntOrBattleCooldown = [
config["commands"][0]["minCooldown"],
config["commands"][0]["maxCooldown"],
]
huntBattleDelay = config["commands"][0]["delayBetweenCommands"]
prayOrCurseCooldown = [
config["commands"][1]["minCooldown"],
config["commands"][1]["maxCooldown"],
]
sellOrSacCooldown = [
config["commands"][2]["minCooldown"],
config["commands"][2]["maxCooldown"],
]
gambleCd = [config["commands"][3]["minCooldown"], config["commands"][3]["maxCooldown"]]
lvlGrindCooldown = [
config["commands"][6]["minCooldown"],
config["commands"][6]["maxCooldown"],
]
shopCd = [config["commands"][10]["minCooldown"], config["commands"][10]["maxCooldown"]]
owoCd = [config["commands"][11]["minCooldown"], config["commands"][11]["maxCooldown"]]
giveawayMaxCooldown = config["commands"][9]["maxCooldown"]
giveawayMixCooldown = config["commands"][9]["minCooldown"]
# version check
def compare_versions(current_version, latest_version):
# current_version = current_version[1:]
# latest_version = latest_version[1:]
current = list(map(int, current_version.split(".")))
latest = list(map(int, latest_version.split(".")))
"""
example output:
current = [1,5,0]
"""
for c, l in zip(current, latest):
if l > c:
return True
elif l < c:
return False
# If all parts are equal, return False (no new version)
return False
# Box print
def printBox(text, color):
test_panel = Panel(text, style=color)
console.print(test_panel)
# For lvl grind
def generate_random_string():
characters = string.ascii_lowercase + " "
length = random.randint(lvlMinLength, lvlMaxLength)
random_string = "".join(random.choice(characters) for _ in range(length))
return random_string
# For battery check
def batteryCheckFunc():
try:
if mobileBatteryCheckEnabled:
while True:
time.sleep(batteryCheckSleepTime)
try:
battery_status = os.popen("termux-battery-status").read()
except Exception as e:
console.print(
f"""-system[0] Battery check failed!!""".center(
console_width - 2
),
style="red on black",
)
battery_data = json.loads(battery_status)
percentage = battery_data["percentage"]
console.print(
f"-system[0] Current battery •> {percentage}".center(
console_width - 2
),
style="blue on black",
)
if percentage < int(mobileBatteryStopLimit):
break
else:
while True:
time.sleep(desktopBatteryCheckSleepTime)
try:
battery = psutil.sensors_battery()
if battery is not None:
percentage = int(battery.percent)
console.print(
f"-system[0] Current battery •> {percentage}".center(
console_width - 2
),
style="blue on black",
)
if percentage < int(mobileBatteryStopLimit):
break
except Exception as e:
console.print(
f"""-system[0] Battery check failed!!.""".center(
console_width - 2
),
style="red on black",
)
except Exception as e:
print("battery check", e)
os._exit(0)
def check_alerts():
global stop_code
if not stop_code:
response = requests.get(saftey_check_url)
response.raise_for_status() # raise exception in case of failute
data = response.json()
# print(data)
if data["enabled"]:
if compare_versions(version, data["version"]) or version == data["version"]:
stop_code = True
printBox(
f"STOPPED CODE FROM SENDING MESSAGES, breaking change detected".center(
console_width - 2
),
"bold red on black",
)
printBox(
f"reason: {data['reason']} , author: {data['author']}".center(
console_width - 2
),
"bold red on black",
)
if termuxNotificationEnabled: # 8ln from here
run_system_command(
f"termux-notification -c 'code stopped!'", timeout=5, retry=True
)
if termuxToastEnabled:
run_system_command(
f"termux-toast -c green -b black 'code stopped!'",
timeout=5,
retry=True,
)
if termuxVibrationEnabled:
run_system_command(
f"termux-vibrate -f -d {termuxVibrationTime}",
timeout=5,
retry=True,
)
if termuxAudioPlayer:
run_system_command(
f"termux-media-player play {termuxAudioPlayerPath}",
timeout=5,
retry=True,
)
if termuxTtsEnabled:
run_system_command(
f"termux-tts-speak alert", timeout=7, retry=False
)
if desktopNotificationEnabled:
notification.notify(
title=f"OWO-DUSK STOPPED!",
message="We have stopped owo-dusk, check console log for more info!",
app_icon=None,
timeout=15,
)
if desktopAudioPlayer:
playsound(desktopAudioPlayerPath, block=False)
else:
pass
# for user to be able to see why the code was stopped, incase if closing causes console messages to disapear.
time.sleep(350) # 5.5 minutes
if mobileBatteryCheckEnabled or desktopBatteryCheckEnabled:
loop_thread = threading.Thread(target=batteryCheckFunc)
loop_thread.start()
if checkForAlert:
loop_thread = threading.Thread(target=check_alerts)
loop_thread.start()
# For emoji names
try:
with open("utils/emojis.json", "r", encoding="utf-8") as file:
emoji_dict = json.load(file)
except FileNotFoundError:
print("The file emojis.json was not found.")
except json.JSONDecodeError:
print("Failed to decode JSON from the file.")
def get_emoji_names(text, emoji_dict=emoji_dict):
pattern = re.compile(
r"<a:[a-zA-Z0-9_]+:[0-9]+>|:[a-zA-Z0-9_]+:|[\U0001F300-\U0001F6FF\U0001F700-\U0001F77F]"
)
emojis = pattern.findall(text)
emoji_names = [emoji_dict[char] for char in emojis if char in emoji_dict]
return emoji_names
def get_emoji_numbers(text, emoji_dict=emoji_dict):
pattern = re.compile(
r"<a:[a-zA-Z0-9_]+:[0-9]+>|[\U0001F300-\U0001F6FF\U0001F700-\U0001F77F]"
)
emojis = pattern.findall(text)
ranges = [
(40, 44, 1, False, "common"),
(35, 39, 3, False, "uncommon"),
(30, 34, 10, False, "rare"),
(25, 29, 250, False, "epic"),
(19, 24, 5000, True, "mythical"),
(14, 18, 30000, True, "gem"),
(9, 13, 15000, True, "legendary"),
(4, 8, 250000, True, "frozen"),
(0, 3, 1000000, True, "hidden"),
]
cash = 0
rare = []
emoji_numbers = [
list(emoji_dict.keys()).index(emoji) for emoji in emojis if emoji in emoji_dict
]
for i in emoji_numbers:
for start, end, value, rank, rankid in ranges:
if start <= i <= end:
cash += value
if rank:
rare.append(
[
emoji_dict[list(emoji_dict.keys())[i]],
rankid,
list(emoji_dict.keys())[i],
]
)
return cash, rare
# Get dm or channel name
def get_channel_name(channel):
if isinstance(channel, discord.DMChannel):
return "owo DMs"
return channel.name
if desktopPopup:
popup_queue = Queue()
# captcha popup desktop ( I have no idea what i did it here but it works, ill read docs later lol)
def show_popup_thread():
root = tk.Tk()
root.withdraw() # Hide the root window
while True:
msg, username, channelname, captchatype = popup_queue.get()
popup = tk.Toplevel(root)
# Set custom icon
icon_path = "imgs/logo.png" # Path to your icon image file
icon = tk.PhotoImage(file=icon_path)
popup.iconphoto(True, icon)
# Dark mode style
popup.configure(bg="#000000")
# Determine screen dimensions
screen_width = popup.winfo_screenwidth()
screen_height = popup.winfo_screenheight()
# Calculate popup window position
popup_width = min(
500, int(screen_width * 0.8)
) # Limit maximum width to 500px or 80% of screen width
popup_height = min(
300, int(screen_height * 0.8)
) # Limit maximum height to 300px or 80% of screen height
x_position = (screen_width - popup_width) // 2
y_position = (screen_height - popup_height) // 2
# Set geometry and position
popup.geometry(f"{popup_width}x{popup_height}+{x_position}+{y_position}")
popup.title("OwO-dusk - Notifs")
# Message label
label_text = msg.format(
username=username, channelname=channelname, captchatype=captchatype
)
label = tk.Label(
popup,
text=label_text,
wraplength=popup_width - 40,
justify="left",
padx=20,
pady=20,
bg="#000000",
fg="#be7dff",
)
label.pack(fill="both", expand=True)
# OK button
button = tk.Button(popup, text="OK", command=popup.destroy)
button.pack(pady=10)
# Make the popup window appear on top and grab focus
popup.grab_set()
popup.focus_set()
popup.lift()
# Wait for the popup window to be destroyed before continuing
popup.wait_window()
if desktopPopup:
# Start the tkinter popup thread
popup_thread = threading.Thread(target=show_popup_thread)
popup_thread.daemon = True # Ensure the thread exits when the main program does
popup_thread.start()
# CAPTCHA NOTIFIER {TERMUX}
def run_system_command(command, timeout, retry=False, delay=5):
def target():
try:
os.system(command)
except Exception as e:
print(f"Error executing command: {command} - {e}")
# Create and start a thread to execute the command
thread = threading.Thread(target=target)
thread.start()
# Wait for the thread to finish, with a timeout
thread.join(timeout)
# If the thread is still alive after the timeout, terminate it
if thread.is_alive():
console.print(
f"-error[0] {command} command failed!".center(console_width - 2),
style="red on black",
)
if retry:
console.print(
f"-system[0] Retrying '{command}' after {delay}s".center(
console_width - 2
),
style="blue on black",
)
time.sleep(delay)
run_system_command(command, timeout, retry=False)
# -------------
# ----------------------
# WEBSITE
# ----------------------
# APP
app = Flask(__name__, static_folder="imgs")
captchas = []
captchaAnswers = []
@app.route("/add_captcha", methods=["POST"])
def add_captcha():
data = request.get_json()
captcha_type = data.get("type")
url = data.get("url")
username = data.get("username")
timestamp = data.get("timestamp")
with lock:
temp_index = len(captchas)
captchaAnswers.append(None)
captchas.append(
{
"type": captcha_type,
"url": url,
"username": username,
"timestamp": timestamp,
}
)
print(captchas)
print(captchaAnswers)
return jsonify({"status": temp_index})
@app.route("/", methods=["GET"])
def index():
try:
with lock:
if not captchas:
return render_template(
"index.html",
no_captchas=True,
version=version,
refresh_interval=refresh_interval,
)
else:
return render_template(
"index.html",
captchas=captchas,
version=version,
refresh_interval=refresh_interval,
)
except Exception as e:
print(f"error in index(): <index.html> :-> {e}")
@app.route("/submit", methods=["POST"])
def submit():
captcha_ans = request.form.get("text")
captcha_index = request.form.get("captcha_index", type=int)
with lock:
captchaAnswers[captcha_index] = captcha_ans
print(captcha_ans)
print(captchaAnswers[captcha_index])
return redirect(url_for("index"))
def web_start():
flaskLog = logging.getLogger("werkzeug")
flaskLog.disabled = True
cli = sys.modules["flask.cli"]
cli.show_server_banner = lambda *x: None
try:
app.run(debug=False, use_reloader=False, port=websitePort)
except Exception as e:
print(e)
if websiteEnabled:
try:
web_thread = threading.Thread(target=web_start)
web_thread.start()
except Exception as e:
print(e)
# ---------------
class MyClient(discord.Client):
def __init__(self, token, channel_id, *args, **kwargs):
super().__init__(*args, **kwargs)
self.token = token
self.channel_id = int(channel_id)
self.list_channel = [self.channel_id]
self.session = None
# send slash commands
async def slashCommandSender(self, msg, **kwargs):
if not (self.captchaDetected or self.sleep or self.sleep2 or stop_code):
try:
for command in self.commands:
if command.name == msg:
await command(**kwargs)
except Exception as e:
print(e)
# log webhooks
async def webhookSender(
self,
msg,
desc=None,
plain_text_msg=None,
colors=None,
webhook_url=webhook_url,
img_url=None,
author_img_url=None,
):
try:
if colors:
color = discord.Color(colors)
else:
color = discord.Color(0x412280)
emb = discord.Embed(title=msg, description=desc, color=color)
if img_url:
emb.set_thumbnail(url=img_url)
if author_img_url:
emb.set_author(name=self.user, icon_url=author_img_url)
# Use the existing session
channel_webhook = discord.Webhook.from_url(
webhook_url, session=self.session
)
# Send both the embed and plain text message if provided
if plain_text_msg:
await channel_webhook.send(
content=plain_text_msg, embed=emb, username="OwO-Dusk - Notifs"
)
else:
await channel_webhook.send(embed=emb, username="OwO-Dusk - Notifs")
except discord.Forbidden as e:
print("Bot does not have permission to execute this command:", e)
except discord.NotFound as e:
print("The specified command was not found:", e)
except Exception as e:
print(e)
# send messages
async def sendCommands(self, channel, message, bypass=False, captcha=False):
try:
if stop_code:
return
checks = (
not self.captchaDetected and not self.sleep and not self.sleep2
) or (bypass and not self.captchaDetected and not self.sleep2)
if typingIndicator and checks:
async with channel.typing():
await channel.send(message)
elif checks or bypass or captcha:
await channel.send(message)
except Exception as e:
print("Error in typing:", e)
print(
f"Channel: {channel}, Message: {message}, Typing Indicator: {typingIndicator}"
)
print(f"Are you sure you're using the correct channel ID for {self.user}?")
async def rSend(self, channel, prayOrCurse=None):
try:
if autoHunt and huntBattleR:
if self.balance == -1 or self.balance > 5:
await asyncio.sleep(random.uniform(0.4, 0.8))
if slashCommandsEnabled:
await self.slashCommandSender("hunt")
else:
if useShortForm:
await self.sendCommands(
channel=self.cm, message=f"{setprefix}h"
)
else:
await self.sendCommands(
channel=self.cm, message=f"{setprefix}hunt"
)
console.print(
f"-{self.user}[+] ran hunt.".center(console_width - 2),
style="purple on black",
)
if webhookUselessLog and webhookEnabled:
await self.webhookSender(
f"-{self.user}[+] ran hunt.", colors=0xAF00FF
)
self.rPrevTime[0] = time.time()
if autoBattle and huntBattleR:
await asyncio.sleep(
random.uniform(huntBattleDelay[0], huntBattleDelay[1])
)
if slashCommandsEnabled:
await self.slashCommandSender("battle")
else:
if useShortForm:
await self.sendCommands(
channel=self.cm, message=f"{setprefix}b"
)
else:
await self.sendCommands(
channel=self.cm, message=f"{setprefix}battle"
)
console.print(
f"-{self.user}[+] ran battle.".center(console_width - 2),
style="purple on black",
)
if webhookUselessLog and webhookEnabled:
await self.webhookSender(
f"-{self.user}[+] ran battle.", colors=0xAF00FF
)
self.rPrevTime[0] = time.time()
if autoOwo and owoR:
await asyncio.sleep(random.uniform(0.4, 0.8))
await self.sendCommands(channel=channel, message="owo")
console.print(
f"-{self.user}[+] ran OwO".center(console_width - 2),
style="light_steel_blue1 on black",
)
if webhookUselessLog and webhookEnabled:
await self.webhookSender(
f"-{self.user}[+] ran OwO.", colors=0xD7D7FF
)
self.rPrevTime[2] = time.time()
if (autoPray or autoCurse) and prayCurseR:
await asyncio.sleep(random.uniform(0.4, 0.8))
if userToPrayOrCurse and self.user.id != userToPrayOrCurse:
if pingUserOnPrayOrCurse:
await self.sendCommands(
channel=channel,
message=f"{setprefix}{prayOrCurse} <@{userToPrayOrCurse}>",
)
else:
await self.sendCommands(
channel=channel,
message=f"{setprefix}{prayOrCurse} {userToPrayOrCurse}",
)
self.rPrevTime[1] = time.time()
else:
await self.sendCommands(
channel=channel, message=f"{setprefix}{prayOrCurse}"
)
self.rPrevTime[1] = time.time()
console.print(
f"-{self.user}[+] ran {self.prayOrCurse}.".center(
console_width - 2
),
style="magenta on black",
)
if webhookUselessLog and webhookEnabled:
await self.webhookSender(
f"-{self.user}[+] ran {self.prayOrCurse}.", colors=0xFF00FF
)
except Exception as e:
print(e)
# custom commands func
async def send_command_custom(self, command, cooldown):
try:
while not self.captchaDetected and not self.sleep and not self.sleep2:
self.current_time = time.time()
await asyncio.sleep(random.uniform(0.2, 0.5) + cooldown)
if self.time_since_last_cmd < 0.5: # Ensure at least 0.3 seconds wait
await asyncio.sleep(
0.5 - self.time_since_last_cmd + random.uniform(0.1, 0.3)
)
self.time_since_last_cmd = self.current_time - self.last_cmd_time
if self.captchaDetected != True and self.sleep != True:
# await self.cm.send(command)
await self.sendCommands(channel=self.cm, message=command)
self.last_cmd_time = time.time()
print(self.user, command)
except Exception as e:
print("send_command error", e)
# Auto gems check
# @tasks.loop()
# async def gemUsageChecker(self):
# self.invCheck
# ----------SENDING COMMANDS----------#
# Solve Captchas
@tasks.loop()
async def captchaSolver(self):
if (
self.websiteIndex != None
and self.webSend == True
and self.tempJsonData != None
):
self.tempListCount = 0
# self.captchaAnswerGot = False
for i in captchas:
if i == self.tempJsonData:
if captchaAnswers[self.tempListCount] != None:
console.print(
f"-{self.user}[0] Attempting to solve image captcha with {captchaAnswers[self.tempListCount]}".center(
console_width - 2
),
style="blue on black",
)
await self.sendCommands(
channel=self.dm,
message=captchaAnswers[self.tempListCount],
captcha=True,
)
await asyncio.sleep(random.uniform(5.5, 9.7))
try:
captchaAnswers[self.tempListCount] = (
None # To prevent spamming wrong ans.
)
except:
pass