Python wrapper around Discord's Game SDK library.
Project description
Discord Game SDK for Python
This is a Work In Progress: it might not work as expected or not work at all. This was made for testing purposes.
Installation
- Install the module:
- With
PIP
:- Stable:
python -m pip install discordsdk
- Latest:
python -m pip install git+https://github.com/DoAltPlusF4/discord-sdk.git
- Stable:
- With
setup.py
(latest):git clone https://github.com/DoAltPlusF4/discord-sdk.git
cd discord-sdk
python -m setup install
- With
- Download Discord Game SDK (2.5.6).
- Grab the DLL from
discord_game_sdk.zip
in thelib
directory and put it in your project'slib
directory.
Documentation
If you need documentation, look at the official Game SDK docs; this was made following the official documentation.
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
GetTicket
andValidateOrExit
) - 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.
- Docs.
- CI/CD,
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 RunCallbacks
while 1:
time.sleep(1/10)
app.RunCallbacks()
Get current user
import time
import discordsdk as dsdk
app = dsdk.Discord(APPLICATION_ID, dsdk.CreateFlags.Default)
userManager = app.GetUserManager()
def onCurrUserUpdate():
user = userManager.GetCurrentUser()
print(f"Current user : {user.Username}#{user.Discriminator}")
userManager.OnCurrentUserUpdate = onCurrUserUpdate
# Don't forget to call RunCallbacks
while 1:
time.sleep(1/10)
app.RunCallbacks()
Set activity
import time
import discordsdk as dsdk
app = dsdk.Discord(APPLICATION_ID, dsdk.CreateFlags.Default)
activityManager = app.GetActivityManager()
activity = dsdk.Activity()
activity.State = "Testing Game SDK"
activity.Party.Id = "my_super_party_id"
activity.Party.Size.CurrentSize = 4
activity.Party.Size.MaxSize = 8
activity.Secrets.Join = "my_super_secret"
def callback(result):
if result == dsdk.Result.Ok:
print("Successfully set the activity!")
else:
raise Exception(result)
activityManager.UpdateActivity(activity, callback)
# Don't forget to call RunCallbacks
while 1:
time.sleep(1/10)
app.RunCallbacks()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
discordsdk-0.1.0.tar.gz
(22.2 kB
view hashes)
Built Distribution
discordsdk-0.1.0-py3-none-any.whl
(28.7 kB
view hashes)
Close
Hashes for discordsdk-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd21cc738b22a55fbbf8931937c43711e3d6e7257e6f0e5b9090f7ce37d27187 |
|
MD5 | 0d10c4ee0ef477a8a048c4da5ae8828b |
|
BLAKE2b-256 | 766491eb160e01b15c7ee914362aeced8eaae738eaf3cd08dbf05e2615e1738a |