Update discord_richpresence.py

This commit is contained in:
brostos 2023-07-21 23:56:30 +03:00 committed by GitHub
parent 81abddff28
commit 3c83efcc05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,11 +227,11 @@ if not ANDROID:
except: except:
pass pass
# Make modifications for it to work on windows # Make modifications for it to work on windows
if babase.app.classic.platform == "windows": if babase.app.classic.platform == "windows":
with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "r") as file: with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "r") as file:
data = file.readlines() data = file.readlines()
data[45] = """ data[45] = """
def get_event_loop(force_fresh=False): def get_event_loop(force_fresh=False):
loop = asyncio.ProactorEventLoop() if sys.platform == 'win32' else asyncio.new_event_loop() loop = asyncio.ProactorEventLoop() if sys.platform == 'win32' else asyncio.new_event_loop()
if force_fresh: if force_fresh:
@ -250,11 +250,11 @@ def get_event_loop(force_fresh=False):
return running return running
else: else:
return loop""" return loop"""
with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "w") as file: with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "w") as file:
for number, line in enumerate(data): for number, line in enumerate(data):
if number not in range(46, 56): if number not in range(46, 56):
file.write(line) file.write(line)
get_module() get_module()
from pypresence import PipeClosed, DiscordError, DiscordNotFound from pypresence import PipeClosed, DiscordError, DiscordNotFound