Skip to content

Commit

Permalink
Fix for Discord Client RPC not always updating.
Browse files Browse the repository at this point in the history
  • Loading branch information
HotaruBlaze committed Jun 11, 2023
1 parent 06aa9d1 commit db08d6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def connect(self):
# Attempt to connect to Discord. Will wait until it connects
try:
self.rpc.connect()
print(log("Successfully Connected to Discord."))
break
except Exception as e:
fails += 1
Expand Down Expand Up @@ -102,7 +103,11 @@ def update(self):
state = 'Played for %s hours or more' % (int(presence.game.totalPlayTime / 60 / 5) * 5)
if presence.game.totalPlayTime / 60 < 5:
state = 'Played for a little while'
self.rpc.update(details = presence.game.name, large_image = presence.game.imageUri, large_text = presence.game.name, state = state, start = self.start, buttons = [{'label': 'Nintendo eShop', 'url': presence.game.shopUri},])
try:
self.rpc.update(details = presence.game.name, large_image = presence.game.imageUri, large_text = presence.game.name, state = state, start = self.start, buttons = [{'label': 'Nintendo eShop', 'url': presence.game.shopUri},])
except pypresence.exceptions.PipeClosed:
print(log("Discord pipe is closed, Attempting to reconnect."))
self.connect()
else:
self.currentGame = None
self.rpc.clear()
Expand Down
2 changes: 1 addition & 1 deletion client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests
pypresence
pypresence @ git+https://github.com/qwertyquerty/pypresence/@0ddf2c0483224339aff48467db570dd901d4793a
qtpy
autopep8
qtwidgets @ git+https://github.com/MCMi460/python-qtwidgets@e0fdba848725749775aceefc5d29e15865667bf0
Expand Down

0 comments on commit db08d6c

Please sign in to comment.