diff --git a/assets/discord_presence.py b/assets/discord_presence.py index 4f9815138..b1eff732f 100644 --- a/assets/discord_presence.py +++ b/assets/discord_presence.py @@ -2,30 +2,35 @@ import datetime as dt import time - def rich_presence(): client_id = "1144714449563955302" RPC = Presence(client_id) - RPC.connect() - RPC.update( - state="applio.org", - details="Ultimate voice cloning tool.", - buttons=[ - {"label": "Home", "url": "https://applio.org"}, - {"label": "Download", "url": "https://applio.org/download"}, - ], - large_image="logo", - large_text="experimenting with applio", - start=dt.datetime.now().timestamp(), - ) - return RPC - + try: + RPC.connect() + RPC.update( + state="applio.org", + details="Ultimate voice cloning tool.", + buttons=[ + {"label": "Home", "url": "https://applio.org"}, + {"label": "Download", "url": "https://applio.org/download"}, + ], + large_image="logo", + large_text="experimenting with applio", + start=dt.datetime.now().timestamp(), + ) + return RPC + except Exception as e: + print(f"An error occurred: {e}") + return None if __name__ == "__main__": rpc = rich_presence() - try: - while True: - time.sleep(15) - except KeyboardInterrupt: - rpc.close() + if rpc: + try: + while True: + time.sleep(15) + except KeyboardInterrupt: + rpc.close() + else: + print("Failed to initialize Rich Presence.")