From 518cadf7c137efe693edef77686d291b70452849 Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:22:32 +0530 Subject: [PATCH 1/7] Add files via upload --- pwrpc.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/pwrpc.py b/pwrpc.py index 9e73c98..f69d81d 100644 --- a/pwrpc.py +++ b/pwrpc.py @@ -62,7 +62,7 @@ def rpcData(): "type": "list", "name": "subject", "message": "Select the subject you are studying: ", - "choices": ['Physics', 'Chemistry', 'Mathematics', 'Biology', 'Attempting Test'] + "choices": ['Physics', 'Chemistry', 'Mathematics', 'Biology', 'Attempting Test',"Doing DPP's"] }, { "type": "input", @@ -73,9 +73,17 @@ def rpcData(): } ] data = prompt(dataIn, style=stylesheet) - return data['batch'], "test" if data['subject'].startswith("At") else data['subject'].lower(), data['topic'] + if data['subject'].startswith("Attempting"): + return data['batch'], "test", data['topic'] + if data['subject'].startswith("Doing"): + return data['batch'], "dpp", data['topic'] + else: + return data['batch'],data['subject'].lower(), data['topic'] + RPC = Presence(CLIENT_ID) + + RPC.connect() def update_presence(): @@ -84,15 +92,28 @@ def update_presence(): RPC.clear() except Exception: RPC.connect() # This means that the connection already got disconnected, so attempt to start a new one + + if data[1] == "test": + large_image="test" + large_text = "Attempting Test" + elif data[1] == "dpp": + large_image="test" + large_text = "Doing Dpp" + + + + RPC.update( state=data[2].title(), details=data[0].title(), start=LOG_TIME, - large_image=data[1], - large_text="Attempting Test" if data[1] == "test" else data[1].title(), + large_image=large_image, + large_text=large_text, + + small_image="pw", small_text="Physics Wallah!", - buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}, { "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] + buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}] ) print(f"{Fore.GREEN} >>> Updated Rich Presence :)") print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") @@ -109,3 +130,4 @@ def update_presence(): pass print(f"{Fore.GREEN} >>> Closed Rich Presence :)") break + From 4d4a19021f2863388a87e3ea27c0dcae97bd107c Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:23:44 +0530 Subject: [PATCH 2/7] Update pwrpc.py --- pwrpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwrpc.py b/pwrpc.py index f69d81d..74c74bd 100644 --- a/pwrpc.py +++ b/pwrpc.py @@ -113,7 +113,7 @@ def update_presence(): small_image="pw", small_text="Physics Wallah!", - buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}] + buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}, { "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] ) print(f"{Fore.GREEN} >>> Updated Rich Presence :)") print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") From 56028dd32aa5ba3c1f77e6cdff6773a7ca6d732c Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:27:08 +0530 Subject: [PATCH 3/7] Delete pwrpc.py --- pwrpc.py | 133 ------------------------------------------------------- 1 file changed, 133 deletions(-) delete mode 100644 pwrpc.py diff --git a/pwrpc.py b/pwrpc.py deleted file mode 100644 index 74c74bd..0000000 --- a/pwrpc.py +++ /dev/null @@ -1,133 +0,0 @@ -import os -import time -try: - from pypresence import Presence # pip install pypresence - from InquirerPy import prompt # pip install InquirerPy - from colorama import init, Fore # pip install colorama -except ImportError: - os.system("pip install pypresence InquirerPy colorama") - from pypresence import Presence - from InquirerPy import prompt - from colorama import init, Fore - -init(autoreset=True) - -clsr = lambda: os.system('cls' if os.name == 'nt' else 'clear') -clsr() - -CLIENT_ID = "987287937467170846" - -def pp(): - clsr() - print(f""" - {Fore.RED} _______ _______ - {Fore.RED} | __ \ \ / / __ \ - {Fore.YELLOW} | |__) \ \ /\ / /| |__) |_ __ ___ - {Fore.YELLOW} | ___/ \ \/ \/ / | _ /| '_ \ / __| - {Fore.GREEN} | | \ /\ / | | \ \| |_) | (__ - {Fore.GREEN} |_| \/ \/ |_| \_\ .__/ \___| - {Fore.GREEN} | | - {Fore.GREEN} |_| - - {Fore.WHITE}---------------------------------------- - {Fore.RED}Developer: {Fore.BLUE}FireHead90544 - {Fore.RED}Discord: {Fore.BLUE}#2022 - {Fore.RED}Client ID: {Fore.BLUE}{CLIENT_ID} - {Fore.RED}Version: {Fore.BLUE}1.0.3 - {Fore.WHITE}---------------------------------------- - - """) -pp() - -stylesheet = { - "questionmark": "#16C60C bold", - "question": "#E74856 bold", - "pointer": "#3A96DD", - "answer": "#E5E512" -} - -LOG_TIME = time.time() - -def rpcData(): - pp() - dataIn = [ - { - "type": "input", - "name": "batch", - "message": "Which batch are you studying from: ", - "validate": lambda res: len(res) > 0, - "invalid_message": "Input Cannot be empty." - }, - { - "type": "list", - "name": "subject", - "message": "Select the subject you are studying: ", - "choices": ['Physics', 'Chemistry', 'Mathematics', 'Biology', 'Attempting Test',"Doing DPP's"] - }, - { - "type": "input", - "name": "topic", - "message": "What chapter/topic are you studying: ", - "validate": lambda res: len(res) > 0, - "invalid_message": "Input Cannot be empty." - } - ] - data = prompt(dataIn, style=stylesheet) - if data['subject'].startswith("Attempting"): - return data['batch'], "test", data['topic'] - if data['subject'].startswith("Doing"): - return data['batch'], "dpp", data['topic'] - else: - return data['batch'],data['subject'].lower(), data['topic'] - - -RPC = Presence(CLIENT_ID) - - -RPC.connect() - -def update_presence(): - data = rpcData() - try: - RPC.clear() - except Exception: - RPC.connect() # This means that the connection already got disconnected, so attempt to start a new one - - if data[1] == "test": - large_image="test" - large_text = "Attempting Test" - elif data[1] == "dpp": - large_image="test" - large_text = "Doing Dpp" - - - - - RPC.update( - state=data[2].title(), - details=data[0].title(), - start=LOG_TIME, - large_image=large_image, - large_text=large_text, - - - small_image="pw", - small_text="Physics Wallah!", - buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}, { "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] - ) - print(f"{Fore.GREEN} >>> Updated Rich Presence :)") - print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") - -while True: - print("\n") - data = prompt({"type": "list", "name": "dat", "message": "What do you want to do?", "choices": ["Update RPC", "Stop & Close"]}, style=stylesheet) - if data['dat'] == "Update RPC": - update_presence() - else: - try: - RPC.close() - except Exception: - pass - print(f"{Fore.GREEN} >>> Closed Rich Presence :)") - break - From 30188893b2c674e69559023f299e9dd937c51bae Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:27:52 +0530 Subject: [PATCH 4/7] Add files via upload --- pwrpc.py | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 pwrpc.py diff --git a/pwrpc.py b/pwrpc.py new file mode 100644 index 0000000..d4e7b96 --- /dev/null +++ b/pwrpc.py @@ -0,0 +1,125 @@ +import os +import time +try: + from pypresence import Presence # pip install pypresence + from InquirerPy import prompt # pip install InquirerPy + from colorama import init, Fore # pip install colorama +except ImportError: + os.system("pip install pypresence InquirerPy colorama") + from pypresence import Presence + from InquirerPy import prompt + from colorama import init, Fore + +init(autoreset=True) + +clsr = lambda: os.system('cls' if os.name == 'nt' else 'clear') +clsr() + +CLIENT_ID = "987287937467170846" + +def pp(): + clsr() + print(f""" + {Fore.RED} _______ _______ + {Fore.RED} | __ \ \ / / __ \ + {Fore.YELLOW} | |__) \ \ /\ / /| |__) |_ __ ___ + {Fore.YELLOW} | ___/ \ \/ \/ / | _ /| '_ \ / __| + {Fore.GREEN} | | \ /\ / | | \ \| |_) | (__ + {Fore.GREEN} |_| \/ \/ |_| \_\ .__/ \___| + {Fore.GREEN} | | + {Fore.GREEN} |_| + + {Fore.WHITE}---------------------------------------- + {Fore.RED}Developer: {Fore.BLUE}FireHead90544 + {Fore.RED}Discord: {Fore.BLUE}#2022 + {Fore.RED}Client ID: {Fore.BLUE}{CLIENT_ID} + {Fore.RED}Version: {Fore.BLUE}1.0.3 + {Fore.WHITE}---------------------------------------- + + """) +pp() + +stylesheet = { + "questionmark": "#16C60C bold", + "question": "#E74856 bold", + "pointer": "#3A96DD", + "answer": "#E5E512" +} + +LOG_TIME = time.time() + +def rpcData(): + pp() + dataIn = [ + { + "type": "input", + "name": "batch", + "message": "Which batch are you studying from: ", + "validate": lambda res: len(res) > 0, + "invalid_message": "Input Cannot be empty." + }, + { + "type": "list", + "name": "subject", + "message": "Select the subject you are studying: ", + "choices": ['Physics', 'Chemistry', 'Mathematics', 'Biology', 'Attempting Test',"Doing DPP's"] + }, + { + "type": "input", + "name": "topic", + "message": "What chapter/topic are you studying: ", + "validate": lambda res: len(res) > 0, + "invalid_message": "Input Cannot be empty." + } + ] + data = prompt(dataIn, style=stylesheet) + + if data['subject'].startswith("Attempting"): + return data['batch'], "test", data['topic'] + if data['subject'].startswith("Doing"): + return data['batch'], "dpp", data['topic'] + else: + return data['batch'],data['subject'].lower(), data['topic'] + +RPC = Presence(CLIENT_ID) +RPC.connect() + +def update_presence(): + data = rpcData() + try: + RPC.clear() + except Exception: + RPC.connect() # This means that the connection already got disconnected, so attempt to start a new one + + if data[1] == "test": + large_image="test" + large_text = "Attempting Test" + elif data[1] == "dpp": + large_image="test" + large_text = "Doing Dpp" + RPC.update( + state=data[2].title(), + details=data[0].title(), + start=LOG_TIME, + large_image=large_image, + large_text=large_text, + small_image="pw", + small_text="Physics Wallah!", + buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}] + ) + print(f"{Fore.GREEN} >>> Updated Rich Presence :)") + print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") + +while True: + print("\n") + data = prompt({"type": "list", "name": "dat", "message": "What do you want to do?", "choices": ["Update RPC", "Stop & Close"]}, style=stylesheet) + if data['dat'] == "Update RPC": + update_presence() + else: + try: + RPC.close() + except Exception: + pass + print(f"{Fore.GREEN} >>> Closed Rich Presence :)") + break + From 5b9a09b8f64a17e9cfdb9a18018474e86f08975f Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:30:16 +0530 Subject: [PATCH 5/7] Update pwrpc.py --- pwrpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwrpc.py b/pwrpc.py index d4e7b96..b36ddeb 100644 --- a/pwrpc.py +++ b/pwrpc.py @@ -105,7 +105,7 @@ def update_presence(): large_text=large_text, small_image="pw", small_text="Physics Wallah!", - buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}] + buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"},{ "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] ) print(f"{Fore.GREEN} >>> Updated Rich Presence :)") print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") From 1b6358171476a789550c2165aef39b879a66ccb0 Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:30:57 +0530 Subject: [PATCH 6/7] Update pwrpc.py --- pwrpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwrpc.py b/pwrpc.py index b36ddeb..8151ab4 100644 --- a/pwrpc.py +++ b/pwrpc.py @@ -105,7 +105,7 @@ def update_presence(): large_text=large_text, small_image="pw", small_text="Physics Wallah!", - buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"},{ "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] + buttons=[{"label": "Physics Wallah 💖", "url": "https://discord.gg/physicswallah"}, { "label": "PW Utils ⭐", "url": "https://github.com/FireHead90544/PWUtils"}] ) print(f"{Fore.GREEN} >>> Updated Rich Presence :)") print(f"{Fore.CYAN} >>> Now just leave this window open (maybe just minimize it), you can update/close whenever you want by selecting the below options.") From 34cefb3183091f59c0af84dd4cdda7957960feb2 Mon Sep 17 00:00:00 2001 From: Adil Haneef <99606693+A0D1I2L3@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:48:59 +0530 Subject: [PATCH 7/7] Update pwrpc.py --- pwrpc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pwrpc.py b/pwrpc.py index 8151ab4..e158607 100644 --- a/pwrpc.py +++ b/pwrpc.py @@ -97,6 +97,10 @@ def update_presence(): elif data[1] == "dpp": large_image="test" large_text = "Doing Dpp" + else: + large_image=data[1] + large_text = data[1].title() + RPC.update( state=data[2].title(), details=data[0].title(),