diff --git a/DecalUploader/Uploader.py b/DecalUploader/Uploader.py index 059ee3e..eaf6af9 100644 --- a/DecalUploader/Uploader.py +++ b/DecalUploader/Uploader.py @@ -64,7 +64,7 @@ def upload(self, file:bytes, title:str, description:str): sleepy(0.2) class Functions: - def send_discord_message(webhook,name_value,decal_value,img_value): + def send_discord_message(webhook:str, name_value:str, decal_value, img_value): # sourcery skip: instance-method-first-arg-name decal_value = int(decal_value) img_value = int(img_value) @@ -89,23 +89,20 @@ def send_discord_message(webhook,name_value,decal_value,img_value): WEBHOOK = '' # Webhook doesn't exist so don't keep sending stuff def get_image_id(decal_id): - # sourcery skip: inline-immediately-returned-variable, instance-method-first-arg-name, last-if-guard, remove-unnecessary-else, swap-if-else-branches - if decal_id: - url = f"https://assetdelivery.roblox.com/v1/asset/?id={decal_id}" - try: - response = requests.get(url) - if response.status_code == 200: - xml_data = xmltodict.parse(response.text) - result_url = xml_data['roblox']['Item']['Properties']['Content']['url'] - result = result_url.split("=")[1] - return result - else: - return "failed to get Imgid" - except Exception as e: - print(e) - return "failed to get Imgid" - else: + # sourcery skip: instance-method-first-arg-name + if not decal_id: return "no decal id passed???" + url = f"https://assetdelivery.roblox.com/v1/asset/?id={decal_id}" + try: + response = requests.get(url) + if response.status_code != 200: + return "failed to get Imgid" + xml_data = xmltodict.parse(response.text) + result_url = xml_data['roblox']['Item']['Properties']['Content']['url'] + return result_url.split("=")[1] + except Exception as e: + print(e) + return "failed to get Imgid" if __name__ == '__main__': input('you don\' run this file') diff --git a/FolderUploader.py b/FolderUploader.py index 035254c..1076247 100644 --- a/FolderUploader.py +++ b/FolderUploader.py @@ -10,7 +10,8 @@ DESCRIPTION:str = CONFIG['description'] class ThreadShit: - def upload(self, creator:DecalClass, filename:str, barrier:threading.Barrier): + def upload(creator:DecalClass, filename:str, barrier:threading.Barrier): + # sourcery skip: instance-method-first-arg-name with open(f'decals/{filename}', "rb") as file: barrier.wait() while True: # keep uploading till one works :) @@ -34,7 +35,8 @@ def upload(self, creator:DecalClass, filename:str, barrier:threading.Barrier): a.write(f'{clean_filename},{asset.id},{img_id}\n') Checker(asset.id, img_id, WEBHOOK) - def start(self, files: list, ROBLOSECURITY:str): + def start(files: list, ROBLOSECURITY:str): + # sourcery skip: instance-method-first-arg-name creator = DecalClass(ROBLOSECURITY) barrier = threading.Barrier(len(files)+1) threads = []