Discord Game SDK implementation
Project description
BridgeCord
pip install bridgecord
Check SDK Starter Guide to understand how it works.
Example
import bridgecord as bc
bridge = bc.Instance(debugging=False)
bridge.init(clientID=CLIENT_ID)
bridge.activity_info.details = "Hello, Python"
bridge.activity_info.state = "In game"
bridge.activity_info.large_image = "dreampyavatar"
bridge.set_timestamps_start(int(time.time()))
bridge.update_current_activity()
while True:
bridge.run_callbacks()
bridge.run_callbacks() should be always running.
If you set debugging=False, you will not receive some messages in the console. For example, by calling a method that triggers UpdateActivity, you will receive a message containing the result code. You can toggle this option by bridge.is_debugging = True. Note that this option is enabled by default.
Activity
# Set text, which display on user hovers over large image
bridge.activity_info.large_text = "Large text"
# Set small image, which displayed in right bottom corner
bridge.activity_info.small_image = "dreampy1"
# Set text, which display on user hovers over small image
bridge.activity_info.small_text = "Small text"
If you editing any activity info (except timestamps), you should update activity:
bridge.update_current_activity()
You can also set how much time is left:
bridge.set_timestamps_end(1678357800)
Update user profile
You can detect if user change avatar or discord name:
def test_callback() -> None:
ret, user = bridge.current_user()
if ret == 0:
print(user.username)
print(user.discriminator)
print(user.avatar_hash)
print(user.get_avatar_url("jpg"))
print(user.is_bot)
print(user.id)
bridge.on_current_user_update_connect(test_callback)
In this example, current_user()returned result code and user object.
Output result:
onyx1a
3440
c240d87788e9e93464872ac80f047568
https://cdn.discordapp.com/avatars/1052579421875339284/c240d87788e9e93464872ac80f047568.jpg
False
1052579421875339284
Read more about user avatar here.
Callbacks
You can set many callbacks for one action:
token1 = bridge.on_current_user_update_connect(test_callback1)
token2 = bridge.on_current_user_update_connect(test_callback2)
Tokens are needed in order to disable unnecessary callback:
bridge.on_current_user_update_disconnect(token1)
Party info:
bridge.edit_party_info(cur_size=1, max_size=4, id="test", secret="secret", is_private=True)
This feature allows other users to see the button "Ask to Join", when clicked, will send the user an invitation:
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bridgecord-0.4.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aca39a8a5d4d291ed314cd7faf5357fd2075f29906f033b061b85bfe385cde3
|
|
| MD5 |
8cabae700e84f02a00c54ce8df1ad50b
|
|
| BLAKE2b-256 |
0d76c9fb9c21fd83277c63c78d41c4870262aa991560b4d17e41b0101f79c0af
|
File details
Details for the file bridgecord-0.4.0-cp311-cp311-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp311-cp311-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3af06bf6b531241ead5a528f2caacc68f14d8f8bb9ace9a374ba4eb7e756bac1
|
|
| MD5 |
73c41af4d0089984bd23a14ba9f58a8d
|
|
| BLAKE2b-256 |
680e47b065ac8be3fe5f858142b60b047d09b76824f86c9bb2610e3c6d8bf466
|
File details
Details for the file bridgecord-0.4.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37dd448a5ed423b240691c27c93b0b8b403e1ead927e1d9a8db578c572a5bfd1
|
|
| MD5 |
5f2a7b177a2a340baf0d7ac8c87da429
|
|
| BLAKE2b-256 |
2e5ac87bbee0e0a2a0f472be9f6c830b77834265354ff920507ff488d5b84beb
|
File details
Details for the file bridgecord-0.4.0-cp310-cp310-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp310-cp310-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e5b065a7917b22a4e7ddc19e85b97d8d7c21ff115a3c597ad8a964cdda8035
|
|
| MD5 |
1f6a72eb79a8921542e48486b3f098ea
|
|
| BLAKE2b-256 |
da2e95650fabdc2ba2e3d77c913b668d65a08f8cf7736f282d6bd473a08284bc
|
File details
Details for the file bridgecord-0.4.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eebe8176e29620456fa4c479b4a9760d0019f3e00ce8d8680bc0f6c11e583aeb
|
|
| MD5 |
a42425666915f8a09f8fad0e2b95abb7
|
|
| BLAKE2b-256 |
2fda2325426e2431c945b7d93cd28f9d4636f0840a347698305c75a4553b902d
|
File details
Details for the file bridgecord-0.4.0-cp39-cp39-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp39-cp39-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685eb38e4710a01d9766636d5e3eaa9d25d98c2b128dede35eb256d5b595842b
|
|
| MD5 |
41af66befc0596d9505c98d80a62318a
|
|
| BLAKE2b-256 |
90393bbcee8febecf4882fa6d32c4aa620e5ea6282c64c9d7aecad683ab2da47
|
File details
Details for the file bridgecord-0.4.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f20d83b96a2b26994e262b415f538887703f444ddb6c89fbba19eab51a1524b
|
|
| MD5 |
0c0263acc5a7d037740b5b8068f5df88
|
|
| BLAKE2b-256 |
649dffdee67862d0221f5f92ad0635a918e9e395417a2205dbbde00a835c005b
|
File details
Details for the file bridgecord-0.4.0-cp38-cp38-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp38-cp38-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.8, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d92a56ba1ac5510f7811f8c5373f0f4f30b17b6b7f0faac31afa1c283f38ba2f
|
|
| MD5 |
e279369633efab3cc27cad0b03bf3531
|
|
| BLAKE2b-256 |
aba66babe91855034bfde4b57020633865e3b19f84a0575171f7cf715acaea23
|
File details
Details for the file bridgecord-0.4.0-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3dd748d16b2d9c5b06d3a1a349cd42800b99a07b0edd1420fad72d4bd04e85
|
|
| MD5 |
f3de817030df4ef323e3db29fbd8719d
|
|
| BLAKE2b-256 |
32a976099b1034603d8df63aba547bf02054815ac9d3c84c6231494c3e3529a1
|
File details
Details for the file bridgecord-0.4.0-cp37-cp37m-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: bridgecord-0.4.0-cp37-cp37m-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.7m, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592b9e55a5a15b7763a145f7456e03d6f1291e0b38019327b0b73c0e9e0fe9fa
|
|
| MD5 |
e0e0bb37fd09cf2f09e8a2db8e2541bf
|
|
| BLAKE2b-256 |
bfdc938362598e0183c024996f40258828b1221c081f668a9a20b90f316a245e
|