LennyPhoenix / py-discord-sdk

Discord Game SDK for Python
MIT License
26 stars 7 forks source link

Running program opens Discord Games Library and closes #13

Closed balt-dev closed 2 years ago

balt-dev commented 2 years ago

I tried to run this code:

import discordsdk as dsdk
import time

APP_ID = 123456789 # Fake ID
START_TIME = time.time()

app = dsdk.Discord(APP_ID,dsdk.CreateFlags.default)
activity_manager = app.get_activity_manager()

activity = dsdk.Activity()
activity.state = "Testing discordsdk"

def callback(result):
    if result == dsdk.Result.ok:
        print("Set")
    else:
        raise Exception(result)

activity_manager.update_activity(activity,callback)

while 1:
    time.sleep(15)
    app.run_callbacks()

but instead of actually doing anything, it closed the program and brought my Discord app to this screen: image Why is this happening??

LennyPhoenix commented 2 years ago

The SDK can be quite temperamental at times. Try using no_require_discord instead of default in the create flags, and if that doesn't work you might want to try just restarting your PC

balt-dev commented 2 years ago

Using no_require_discord ends up with internal_error: result 4.

LennyPhoenix commented 2 years ago

Code runs fine on my end: I set the APP_ID to 771366171110932490 and changed the time.sleep interval to 0.1 seconds instead of 15. The SDK is incredibly buggy and sadly there isn't a huge amount I can do about it, just make sure you are using the DLL from version 2.5.6.

balt-dev commented 2 years ago

Seems to work fine after restarting my computer. Weird.

LennyPhoenix commented 2 years ago

Something must have been broken in the IPC pipe, glad it works now