Discord Game SDK for Python
A Python wrapper around Discord's Game SDK.
NOTE: This is entirely experimental, and may not work as intended. Please report all bugs to the GitHub issue tracker.
Credit to NathaanTFM for creating the original library.
Installation
- Install the module:
- With
PIP:- Stable:
python -m pip install discordsdk - Latest:
python -m pip install git+https://github.com/LennyPhoenix/py-discord-sdk.git
- Stable:
- With
setup.py(latest):git clone https://github.com/LennyPhoenix/py-discord-sdk.gitcd py-discord-sdkpython -m setup install
- With
- Download Discord Game SDK (2.5.6).
- Grab the DLL from
discord_game_sdk.zipin thelibdirectory and put it in your project'slibdirectory.
Documentation
If you need documentation, look at the official Game SDK docs; this was made following the official documentation. We also have some work-in-progress wiki docs.
Features
-
Should be working:
- ActivityManager
- ImageManager
- NetworkManager
- RelationshipManager
- StorageManager
- UserManager
-
Should be working, but need more testing:
- AchievementManager (not tested at all)
- ApplicationManager (especially the functions
GetTicketandValidateOrExit) - LobbyManager
- OverlayManager
- StoreManager (not tested at all)
- VoiceManager
Contributing
The code needs more comments, type hinting. You can also implement the missing features, or add more tests. Feel free to open a pull request!
You can also report issues. Just open an issue and I will look into it!
Todo List
- Better organisation of submodules.
- CI/CD.
- Update sdk.py to use type annotations.
- Update to Discord SDK 3.2.0.
Examples
You can find more examples in the examples/ directory.
Create a Discord instance
import time
import discordsdk as dsdk
app = dsdk.Discord(APPLICATION_ID, dsdk.CreateFlags.default)
# Don't forget to call run_callbacks
while 1:
time.sleep(1/10)
app.run_callbacks()
Get current user
import time
import discordsdk as dsdk
app = dsdk.Discord(APPLICATION_ID, dsdk.CreateFlags.default)
user_manager = app.get_user_manager()
def on_curr_user_update():
user = user_manager.get_current_user()
print(f"Current user : {user.username}#{user.discriminator}")
user_manager.on_current_user_update = on_curr_user_update
# Don't forget to call run_callbacks
while 1:
time.sleep(1/10)
app.run_callbacks()
Set activity
import time
import discordsdk as dsdk
app = dsdk.Discord(APPLICATION_ID, dsdk.CreateFlags.default)
activity_manager = app.get_activity_manager()
activity = dsdk.Activity()
activity.state = "Testing Game SDK"
activity.party.id = "my_super_party_id"
activity.party.size.current_size = 4
activity.party.size.max_size = 8
activity.secrets.join = "my_super_secret"
def callback(result):
if result == dsdk.Result.ok:
print("Successfully set the activity!")
else:
raise Exception(result)
activity_manager.update_activity(activity, callback)
# Don't forget to call run_callbacks
while 1:
time.sleep(1/10)
app.run_callbacks()
Metadata
Release files for discordsdk 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| discordsdk-0.2.5.tar.gz | 23.1 kB | Without provenance | Details for discordsdk-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| discordsdk-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for discordsdk-0.2.5-py3-none-any.whl |
Total release size: 52.5 kB
Release files / discordsdk-0.2.5.tar.gz
| Download URL | discordsdk-0.2.5.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f14f97534bdc2eb9f4d59008e2f741f221437322e9d870b2413c29ac94fbd97c
|
|
BLAKE2b-256 checksum How to use checksums |
e934645093f0001e73f6fc11e779fdcae18d7ac558315565826c73c48cdcaae3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Release files / discordsdk-0.2.5-py3-none-any.whl
| Download URL | discordsdk-0.2.5-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
558255cc8e973c7dcd5a4d9e8dc077103665d3191869abf73c8006e4576f3476
|
|
BLAKE2b-256 checksum How to use checksums |
99137a2a7adacd2f8f1e86ca3b5eb5e3acd0e30f4e49cb5785f1487164c9defa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Security for discordsdk 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.