import asyncio import discord import requests from io import BytesIO from ultralytics import YOLO import numpy as np from PIL import Image import aiohttp from colorama import Fore, Back, Style, init import re import configparser import binascii import hashlib import json as jsond import os import platform import subprocess import sys import time from datetime import datetime from uuid import uuid4 from discord import Webhook config = configparser.ConfigParser() config.read('ConfigPokemeow.txt') try: if os.name == 'nt': import win32security import requests from Crypto.Cipher import AES from Crypto.Hash import SHA256 from Crypto.Util.Padding import pad, unpad except ModuleNotFoundError: print("Exception when importing modules") print("Installing necessary modules....") if os.path.isfile("requirements.txt"): os.system("pip install -r requirements.txt") else: os.system("pip install pywin32") os.system("pip install pycryptodome") os.system("pip install requests") print("Modules installed!") time.sleep(1.5) os._exit(1) try: # Connection check s = requests.Session() # Session s.get('https://google.com') except requests.exceptions.RequestException as e: print(e) time.sleep(3) os._exit(1) class api: name = ownerid = secret = version = hash_to_check = "" def __init__(self, name, ownerid, secret, version, hash_to_check): self.name = name self.ownerid = ownerid self.secret = secret self.version = version self.hash_to_check = hash_to_check self.init() sessionid = enckey = "" initialized = False def init(self): if self.sessionid != "": print("You've already initialized!") time.sleep(2) os._exit(1) init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() self.enckey = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("init").encode()), "ver": encryption.encrypt(self.version, self.secret, init_iv), "hash": self.hash_to_check, "enckey": encryption.encrypt(self.enckey, self.secret, init_iv), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) if response == "KeyAuth_Invalid": print("Lỗi Key") os._exit(1) response = encryption.decrypt(response, self.secret, init_iv) json = jsond.loads(response) if json["message"] == "invalidver": if json["download"] != "": print("New Version Available") download_link = json["download"] os.system(f"start {download_link}") os._exit(1) else: print("Lỗi Phiên Bản") os._exit(1) if not json["success"]: print(json["message"]) os._exit(1) self.sessionid = json["sessionid"] self.initialized = True self.__load_app_data(json["appinfo"]) def register(self, user, password, license, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("register").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "pass": encryption.encrypt(password, self.enckey, init_iv), "key": encryption.encrypt(license, self.enckey, init_iv), "hwid": encryption.encrypt(hwid, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: print("successfully registered") self.__load_user_data(json["info"]) else: print(json["message"]) os._exit(1) def upgrade(self, user, license): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("upgrade").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "key": encryption.encrypt(license, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: print("successfully upgraded user") print("please restart program and login") time.sleep(2) os._exit(1) else: print(json["message"]) os._exit(1) def login(self, user, password, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("login").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "pass": encryption.encrypt(password, self.enckey, init_iv), "hwid": encryption.encrypt(hwid, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: self.__load_user_data(json["info"]) print("Đăng Nhập Thành Công") else: print(json["message"]) os._exit(1) def license(self, key, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("license").encode()), "key": encryption.encrypt(key, self.enckey, init_iv), "hwid": encryption.encrypt(hwid, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: self.__load_user_data(json["info"]) print(Fore.LIGHTGREEN_EX,"Key Hoạt Động") else: print(json["message"]) os._exit(1) def var(self, name): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("var").encode()), "varid": encryption.encrypt(name, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return json["message"] else: print(json["message"]) time.sleep(5) os._exit(1) def getvar(self, var_name): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("getvar").encode()), "var": encryption.encrypt(var_name, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return json["response"] else: print(json["message"]) time.sleep(5) os._exit(1) def setvar(self, var_name, var_data): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("setvar").encode()), "var": encryption.encrypt(var_name, self.enckey, init_iv), "data": encryption.encrypt(var_data, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return True else: print(json["message"]) time.sleep(5) os._exit(1) def ban(self): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("ban").encode()), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return True else: print(json["message"]) time.sleep(5) os._exit(1) def file(self, fileid): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("file").encode()), "fileid": encryption.encrypt(fileid, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if not json["success"]: print(json["message"]) time.sleep(5) os._exit(1) return binascii.unhexlify(json["contents"]) def webhook(self, webid, param, body = "", conttype = ""): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("webhook").encode()), "webid": encryption.encrypt(webid, self.enckey, init_iv), "params": encryption.encrypt(param, self.enckey, init_iv), "body": encryption.encrypt(body, self.enckey, init_iv), "conttype": encryption.encrypt(conttype, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return json["message"] else: print(json["message"]) time.sleep(5) os._exit(1) def check(self): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("check").encode()), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return True else: return False def checkblacklist(self): self.checkinit() hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("checkblacklist").encode()), "hwid": encryption.encrypt(hwid, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return True else: return False def log(self, message): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("log").encode()), "pcuser": encryption.encrypt(os.getenv('username'), self.enckey, init_iv), "message": encryption.encrypt(message, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } self.__do_request(post_data) def fetchOnline(self): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("fetchOnline").encode()), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: if len(json["users"]) == 0: return None else: return json["users"] else: return None def chatGet(self, channel): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("chatget").encode()), "channel": encryption.encrypt(channel, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return json["messages"] else: return None def chatSend(self, message, channel): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("chatsend").encode()), "message": encryption.encrypt(message, self.enckey, init_iv), "channel": encryption.encrypt(channel, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) if json["success"]: return True else: return False def checkinit(self): if not self.initialized: print("Initialize first, in order to use the functions") time.sleep(2) os._exit(1) def __do_request(self, post_data): try: rq_out = s.post( "https://keyauth.win/api/1.0/", data=post_data, timeout=30 ) return rq_out.text except requests.exceptions.Timeout: print("Request timed out") class application_data_class: numUsers = numKeys = app_ver = customer_panel = onlineUsers = "" # region user_data class user_data_class: username = ip = hwid = expires = createdate = lastlogin = subscription = subscriptions = "" user_data = user_data_class() app_data = application_data_class() def __load_app_data(self, data): self.app_data.numUsers = data["numUsers"] self.app_data.numKeys = data["numKeys"] self.app_data.app_ver = data["version"] self.app_data.customer_panel = data["customerPanelLink"] self.app_data.onlineUsers = data["numOnlineUsers"] def __load_user_data(self, data): self.user_data.username = data["username"] self.user_data.ip = data["ip"] self.user_data.hwid = data["hwid"] self.user_data.expires = data["subscriptions"][0]["expiry"] self.user_data.createdate = data["createdate"] self.user_data.lastlogin = data["lastlogin"] self.user_data.subscription = data["subscriptions"][0]["subscription"] self.user_data.subscriptions = data["subscriptions"] class others: @staticmethod def get_hwid(): if platform.system() == "Linux": with open("/etc/machine-id") as f: hwid = f.read() return hwid elif platform.system() == 'Windows': winuser = os.getlogin() sid = win32security.LookupAccountName(None, winuser)[0] hwid = win32security.ConvertSidToStringSid(sid) return hwid elif platform.system() == 'Darwin': output = subprocess.Popen("ioreg -l | grep IOPlatformSerialNumber", stdout=subprocess.PIPE, shell=True).communicate()[0] serial = output.decode().split('=', 1)[1].replace(' ', '') hwid = serial[1:-2] return hwid class encryption: @staticmethod def encrypt_string(plain_text, key, iv): plain_text = pad(plain_text, 16) aes_instance = AES.new(key, AES.MODE_CBC, iv) raw_out = aes_instance.encrypt(plain_text) return binascii.hexlify(raw_out) @staticmethod def decrypt_string(cipher_text, key, iv): cipher_text = binascii.unhexlify(cipher_text) aes_instance = AES.new(key, AES.MODE_CBC, iv) cipher_text = aes_instance.decrypt(cipher_text) return unpad(cipher_text, 16) @staticmethod def encrypt(message, enc_key, iv): try: _key = SHA256.new(enc_key.encode()).hexdigest()[:32] _iv = SHA256.new(iv.encode()).hexdigest()[:16] return encryption.encrypt_string(message.encode(), _key.encode(), _iv.encode()).decode() except: print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username") os._exit(1) @staticmethod def decrypt(message, enc_key, iv): try: _key = SHA256.new(enc_key.encode()).hexdigest()[:32] _iv = SHA256.new(iv.encode()).hexdigest()[:16] return encryption.decrypt_string(message.encode(), _key.encode(), _iv.encode()).decode() except: print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username") os._exit(1) if sys.version_info.minor < 10: print("[Security] - Python 3.10 or higher is recommended. The bypass will not work on 3.10+\n" "Phiên Bản Python 3.10 Hoặc Cao Hơn Là Khuyến Nghị. Bypass Sẽ Không Hoạt Động Trên 3.10") print("You are using Python {}.{}".format(sys.version_info.major, sys.version_info.minor)) print("Bạn Đang Sử Dụng Phiên Bản Python {}.{}".format(sys.version_info.major, sys.version_info.minor)) if platform.system() == 'Windows': os.system('cls & title Python Example') elif platform.system() == 'Linux': os.system('clear') # clear console sys.stdout.write("\x1b]0;Python Example\x07") # change title elif platform.system() == 'Darwin': os.system("clear && printf '\e[3J'") # clear console os.system('''echo - n - e "\033]0;Python Example\007"''') # change title def getchecksum(): md5_hash = hashlib.md5() file = open(''.join(sys.argv), "rb") md5_hash.update(file.read()) digest = md5_hash.hexdigest() return digest keyauthapp = api( name = "VKPoke", ownerid = "VyLAxhefyv", secret = "b2b6c47ebe68c85dfc5025c8744949bc72a797cecffa590727bfd3fd75b833f7", version = "1.0", hash_to_check = getchecksum() ) print(f"Status: {keyauthapp.check()}") print(f"Blacklisted? : {keyauthapp.checkblacklist()}") def answer(): try: print('Checking Key') ans = "4" if ans == "4": key = config.get('LOG','Key') keyauthapp.license(key) except KeyboardInterrupt: os._exit(1) answer() '''try: if os.path.isfile('auth.json'): #Checking if the auth file exist if jsond.load(open("auth.json"))["authusername"] == "": #Checks if the authusername is empty or not print(""" 1. Login 2. Register """) ans=input("Select Option: ") #Skipping auto-login bc auth file is empty if ans=="1": user = input('Provide username: ') password = input('Provide password: ') keyauthapp.login(user,password) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) elif ans=="2": user = input('Provide username: ') password = input('Provide password: ') license = input('Provide License: ') keyauthapp.register(user,password,license) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) else: print("\nNot Valid Option") os._exit(1) else: try: #2. Auto login with open('auth.json', 'r') as f: authfile = jsond.load(f) authuser = authfile.get('authusername') authpass = authfile.get('authpassword') keyauthapp.login(authuser,authpass) except Exception as e: #Error stuff print(e) else: #Creating auth file bc its missing try: f = open("auth.json", "a") #Writing content f.write("""{ "authusername": "", "authpassword": "" }""") f.close() print (""" 1. Login 2. Register """)#Again skipping auto-login bc the file is empty/missing ans=input("Select Option: ") if ans=="1": user = input('Provide username: ') password = input('Provide password: ') keyauthapp.login(user,password) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) elif ans=="2": user = input('Provide username: ') password = input('Provide password: ') license = input('Provide License: ') keyauthapp.register(user,password,license) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) else: print("\nNot Valid Option") os._exit(1) except Exception as e: #Error stuff print(e) os._exit(1) except Exception as e: #Error stuff print(e) os._exit(1)''' Webhookid = config.get('Webhook','Webhook') hienthi = config.get('LOG','PrintStatusKey') if hienthi=='True': print("Tạo Vào: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.createdate)).strftime('%Y-%m-%d %H:%M:%S')) print("Lần Cuối Đăng Nhập: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.lastlogin)).strftime('%Y-%m-%d %H:%M:%S')) print("Hết Hạn Vào: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.expires)).strftime('%Y-%m-%d %H:%M:%S')) print(f"Status: {keyauthapp.check()}") thtu = input('Acc ') opf = False channel_id = config.get('Channel','Channel_id'+thtu) channel_id = int(channel_id) fsf = False class MyClient(discord.Client): def __init__(self): super().__init__() self.edit_count = {} async def setup_hook(self) -> None: self.bg_task = self.loop.create_task(self.send_mess()) async def foo(self,rarity,name): async with aiohttp.ClientSession() as session: webhook = Webhook.from_url( Webhookid, session=session) await webhook.send('***'+self.user.name+' Found '+name+' [' + rarity+']'+'***`',username='VKTool') async def on_message_edit(self, before, after): if after.id not in self.edit_count: self.edit_count[after.id] = 1 if after.embeds: embed = after.embeds[0] if embed and embed.color and embed.color.value == 0x87cefa: if after.components: if after.components[0].children: if len(after.components[0].children) >= 3: await after.components[0].children[2].click() elif len(after.components[0].children) >= 2: await after.components[0].children[1].click() else: await after.components[0].children[0].click() else: print('Nothing') else: self.edit_count[after.id] += 1 if self.edit_count[after.id] == 2: if after.embeds: if after.embeds[0].description and 'fished' in after.embeds[0].description: ball = config.get('Pokeball','FishThrow') button = [_ for _ in after.components[0].children if _.custom_id == ball+'_fish'] x = None if after.embeds and len(after.embeds) > 0: x = after.embeds[0].description if x is not None: x = x[:len(x) - 3] name = '' for i in range(len(x) - 1, 0, -1): if x[i] == '*': break else: name += x[i] x = x[:len(x) - 1] name = name[::-1] print(Fore.LIGHTBLUE_EX, 'Câu Được ' + name + '....') if button: await button[0].click() elif self.edit_count[after.id] == 3: if after.embeds: if after.embeds and after.embeds[0].description: if 'You caught' in after.embeds[0].description or 'broke out' in after.embeds[0].description: if after.embeds[0].description and after.embeds[0].description[:3] == 'You': print(Fore.LIGHTGREEN_EX,'[Bắt Thành Công !!]') else: print(Fore.LIGHTRED_EX,'[Thất Bại]') channel = self.get_channel(channel_id) await asyncio.sleep(1) sub_lists = [] await asyncio.sleep(1) async for message in channel.history(limit=1): j = message.embeds[0].footer.text sub_lists.extend(re.split(r'\n|\|', j)) pba = "" gba = "" uba = "" mba = "" for element in sub_lists: if "Pokeballs:" in element: pba = re.search(r'\b\d+\b', element).group() elif "Greatballs:" in element: gba = re.search(r'\b\d+\b', element).group() elif "Ultraballs:" in element: match = re.search(r'\b\d+\b', element) uba = match.group() if match else "" elif "Masterballs:" in element: match = re.search(r'\b\d+\b', element) mba = match.group() if match else "" pbbuy = config.get('Buy', 'PBall') ubbuy = config.get('Buy', 'UBall') gbbuy = config.get('Buy', 'GBall') mbbuy = config.get('Buy', 'Mball') if pba == '0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='1 ' + pbbuy) await asyncio.sleep(8) if gba == '0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='2 ' + gbbuy) await asyncio.sleep(8) if uba == '0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='3 ' + ubbuy) await asyncio.sleep(8) if mbbuy == 'True': if mba == '0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='4 1') await asyncio.sleep(8) async def fish(self): channel = self.get_channel(channel_id) print(Fore.LIGHTBLUE_EX,'Câu Pokemon') command = [_ async for _ in channel.slash_commands(query='fish')][0] sub_command = [_ for _ in command.children if _.name == 'spawn'][0] await sub_command() await asyncio.sleep(2) async for message in channel.history(limit=1): if message.embeds: if message.embeds[0].footer.text == 'You have 1 min 30s to respond correctly to the captcha image above before your account receives a ban': print(Fore.LIGHTRED_EX,'Xuất Hiện Captcha') cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad,channel,thtu) await asyncio.sleep(3) async for message in channel.history(limit=2): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad, channel, thtu) await asyncio.sleep(3) async for message in channel.history(limit=3): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad, channel, thtu) await asyncio.sleep(3) async for message in channel.history(limit=4): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad, channel, thtu) await asyncio.sleep(3) async for message in channel.history(limit=4): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad, channel, thtu) await asyncio.sleep(3) async for message in channel.history(limit=4): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 await self.solvecap(cad, channel, thtu) else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') async def inv(self, string): number = '' if string is not None: number_position = string.index("**") + 2 for i in range(number_position, len(string)): if string[i] == '*': break else: number += string[i] return number else: return None async def stad(self, channel): option = False await asyncio.sleep(1) print(Fore.LIGHTYELLOW_EX,'Đang Check Inventory..') command = [_ async for _ in channel.slash_commands(query='items')][0] sub_command = [_ for _ in command.children if _.name == 'view'][0] await sub_command() await asyncio.sleep(1) async for message in channel.history(limit=1): await asyncio.sleep(3) sub_lists = [] for item in message.embeds[0].fields: sub_lists.extend(item.value.split("\n")) pbbuy = config.get('Buy', 'PBall') ubbuy = config.get('Buy', 'UBall') gbbuy = config.get('Buy', 'GBall') mbbuy = config.get('Buy','MBall') for li in sub_lists: if 'Pokeballs' in li: pba = await self.inv(li) print('Pokeballs: ' + pba) if 'Greatballs' in li: gba = await self.inv(li) print('Greatballs: ' + gba) if 'Ultraballs' in li: uba = await self.inv(li) print('Ultraballs: ' + uba) if 'Diveballs' in li: dba = await self.inv(li) print('Diveballs: ' + dba) if 'Masterballs' in li: mba = await self.inv(li) print('Masterballs: ' + mba) await asyncio.sleep(2) async for message in channel.history(limit =1): await asyncio.sleep(1) await message.components[0].children[1].click() sub_lists = [] async for new in channel.history(limit=1): for field in new.embeds[0].fields: sub_lists.extend(field.value.split("\n")) if '<:oldrod:741837762700902421> Old rod' in sub_lists: option = True await asyncio.sleep(1) print(Fore.LIGHTWHITE_EX,'Mở LootBox') command = [_ async for _ in channel.slash_commands(query='lootbox')][0] sub_command = [_ for _ in command.children if _.name == 'all'][0] await sub_command() await asyncio.sleep(2) command = [_ async for _ in channel.slash_commands(query='grazz')][0] sub_command = [_ for _ in command.children if _.name == 'all'][0] await sub_command() print(Fore.LIGHTWHITE_EX,'Grazz All') await asyncio.sleep(2) command = [_ async for _ in channel.slash_commands(query='release')][0] sub_command = [_ for _ in command.children if _.name == 'duplicates'][0] await sub_command() print(Fore.LIGHTWHITE_EX,'Release Duplication') await asyncio.sleep(2) command = [_ async for _ in channel.slash_commands(query='quest')][0] sub_command = [_ for _ in command.children if _.name == 'info'][0] await sub_command() print(Fore.LIGHTWHITE_EX,'Quest') await asyncio.sleep(2) return option async def download_image(self, url, folder, custom_filename): for filename in os.listdir(folder): if filename == custom_filename: file_path = os.path.join(folder, filename) os.remove(file_path) async with aiohttp.ClientSession() as session: async with session.get(url) as resp: image_data = await resp.read() img = Image.open(BytesIO(image_data)) width_percent = (640 / float(img.size[0])) new_height = int((float(img.size[1]) * float(width_percent))) img = img.resize((640, new_height), Image.LANCZOS) img_path = os.path.join(folder, custom_filename + '.png') img.save(img_path) print(Fore.LIGHTBLUE_EX,'Đã tải ảnh Captcha') async def solvecap(self,cad,channel,thtu): link = config.get('IMG','Lin') await self.download_image(cad, link, thtu) model = YOLO('best (1).pt') img = (link + thtu + '.png/') results = model(img) for result in results: Macaptcha = '' bboxes_xyxy = result.boxes.xyxy.numpy() indices = np.argsort(bboxes_xyxy[:, 0]) bboxes_sorted = bboxes_xyxy[indices] classes = result.boxes.cls.numpy() classes_sorted = classes[indices] for cls in classes_sorted: Macaptcha = Macaptcha + str(int(cls)) await channel.send(Macaptcha) async def catch(self, message: discord.Message, channel): if message.author.id == 664508672713424926: await asyncio.sleep(1) x = message.embeds[0].description x = x[:len(x) - 3] name = '' for i in range(len(x) - 1, 0, -1): if x[i] == '*': break else: name += x[i] x = x[:len(x) - 1] name = name[::-1] if name == ' :exclamation: :exclamation: :exclamati': print(Fore.LIGHTWHITE_EX,'Xuất Hiện Captcha') await asyncio.sleep(1) async for message in channel.history(limit=1): if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 print(cad) await self.solvecap(cad,channel,thtu) await asyncio.sleep(3) async for message in channel.history(limit=2): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 print(cad) await self.solvecap(cad,channel,thtu) await asyncio.sleep(3) async for message in channel.history(limit=3): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 print(cad) await self.solvecap(cad,channel,thtu) await asyncio.sleep(3) async for message in channel.history(limit=4): if message != channel.last_message: if message.embeds: cad = '' d = str(message.embeds[0].image) i = 16 while d[i] != "'": cad += d[i] i += 1 print(cad) await self.solvecap(cad, channel, thtu) else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: print(Fore.LIGHTGREEN_EX, 'Giải Thành Công') else: Commonwe = config.get('Webhook','Common') UnCommonwe = config.get('Webhook','Uncommon') Rarewe = config.get('Webhook','Rare') SRwe = config.get('Webhook','SuperRare') Legendwe = config.get('Webhook','Legend') Shinywe = config.get('Webhook','Shiny') if message.embeds: if message.embeds[0].color == discord.Color.from_rgb(8, 85, 251): colored_name = '\033[38;2;8;85;251m' + name + '\033[0m' colored_type = '\033[38;2;8;85;251m' + 'Common' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if Commonwe == 'True': await self.foo('Common',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'Common') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'ub'] if button: await button[0].click() else: print('Không Có Bóng Phù ') elif message.embeds[0].color == discord.Color.from_rgb(19, 180, 231): colored_name = '\033[38;2;19;180;231m' + name + '\033[0m' colored_type = '\033[38;2;19;180;231m' + 'Uncommon' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if UnCommonwe == 'True': await self.foo('Uncommon',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'Uncommon') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'ub'] if button: await button[0].click() else: print('Không Có Bóng Phù ') elif message.embeds[0].color == discord.Color.from_rgb(251, 137, 8): colored_name = '\033[38;2;251;137;8m' + name + '\033[0m' colored_type = '\033[38;2;251;137;8m' + 'Rare' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if Rarewe == 'True': await self.foo('Rare',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'Rare') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'pb'] if button: await button[0].click() else: print('Không Có Bóng Phù Hợp') elif message.embeds[0].color == discord.Color.from_rgb(248, 244, 7): colored_name = '\033[38;2;248;244;7m' + name + '\033[0m' colored_type = '\033[38;2;248;244;7m' + 'SuperRare' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if SRwe == 'True': await self.foo('SuperRare',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'SuperRare') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'pb'] if button: await button[0].click() else: print('Không Có Bóng Phù Hợp') elif message.embeds[0].color == discord.Color.from_rgb(160, 7, 248): colored_name = '\033[38;2;160;7;248m' + name + '\033[0m' colored_type = '\033[38;2;160;7;248m' + 'Legendary' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if Legendwe == 'True': await self.foo('Legendary',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'Legend') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'ub'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'pb'] if button: await button[0].click() else: await message.components[0].children[0].click() elif message.embeds[0].color == discord.Color.from_rgb(255, 153, 204): colored_name = '\033[38;2;255;153;204m' + name + '\033[0m' colored_type = '\033[38;2;255;153;204m' + 'Shiny' + '\033[0m' print(Fore.LIGHTWHITE_EX,'Đang Bắt ' + colored_name) print('['+colored_type+']') if Shinywe == 'True': await self.foo('Shiny',name) await asyncio.sleep(1) fsf = True z = config.get('Pokeball', 'Shiny') button = [_ for _ in message.components[0].children if _.custom_id == z] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'ub'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'gb'] if button: await button[0].click() else: button = [_ for _ in message.components[0].children if _.custom_id == 'pb'] if button: await button[0].click() else: await message.components[0].children[0].click() channel = self.get_channel(channel_id) async for message in channel.history(limit=1): if message.embeds: if message.embeds[0].description[:3] == 'You': print(Fore.LIGHTGREEN_EX,'[Bắt Thành Công] ' + colored_name + '!!') else: print(Fore.LIGHTRED_EX,'[Thất Bại]') sub_lists = [] await asyncio.sleep(1) async for message in channel.history(limit=1): j = message.embeds[0].footer.text sub_lists.extend(re.split(r'\n|\|', j)) pba = "" gba = "" uba = "" mba = "" for element in sub_lists: if "Pokeballs:" in element: pba = re.search(r'\b\d+\b', element).group() elif "Greatballs:" in element: gba = re.search(r'\b\d+\b', element).group() elif "Ultraballs:" in element: match = re.search(r'\b\d+\b', element) uba = match.group() if match else "" elif "Masterballs:" in element: match = re.search(r'\b\d+\b', element) mba = match.group() if match else "" pbbuy = config.get('Buy', 'PBall') ubbuy = config.get('Buy', 'UBall') gbbuy = config.get('Buy', 'GBall') mbbuy = config.get('Buy', 'Mball') if pba=='0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='1 '+pbbuy) await asyncio.sleep(8) if gba=='0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='2 '+gbbuy) await asyncio.sleep(8) if uba=='0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='3 '+ubbuy) await asyncio.sleep(8) if mbbuy=='True': if mba=='0': command = [_ async for _ in channel.slash_commands(query='shop')][0] sub_command = [_ for _ in command.children if _.name == 'buy'][0] await sub_command(item='4 1') await asyncio.sleep(8) else: await asyncio.sleep(2) async for message in channel.history(limit=1): if message == channel.last_message: await asyncio.sleep(7) await self.send_mess() async def on_ready(self): print(Fore.LIGHTGREEN_EX,'Đã Đăng Nhập Vào Tài Khoản', self.user) async def send_mess(self): await self.wait_until_ready() channel = self.get_channel(channel_id) afterco = config.get('StartCommand','after') opf = await self.stad(channel) print(Fore.LIGHTBLUE_EX,'Fish = '+str(opf)) fish_count = 0 while True: async for cmd in channel.slash_commands(query='pokemon'): if cmd.name == 'pokemon': await cmd(option='pokemon') await asyncio.sleep(1) async for message in channel.history(limit=1): if message == 'You can now catch Pokemon again.': async for cmd in channel.slash_commands(query='pokemon'): if cmd.name == 'pokemon': await cmd(option='pokemon') async for message in channel.history(limit=1): await self.catch(message, channel) if opf: if fish_count%2==0: await asyncio.sleep(1) await self.fish() await asyncio.sleep(6) fish_count+=1 await asyncio.sleep(6) client = MyClient() client.run(config.get('TOKEN','Acc'+thtu))