Skip to content
Sankarsan Kampa edited this page Mar 21, 2018 · 3 revisions

Welcome to the discoIPC wiki! Getting started with this library is a piece of cake.

discoIPC

Constructor

from discoIPC import ipc

client = ipc.DiscordIPC(client_id)
Parameter Type Optional Default Description
client_id string - The Discord Application's Client/Application ID.

Example

from discoIPC import ipc

client = ipc.DiscordIPC('425989775451750401')

Methods

Available Methods

.connect()

Connect to Discord Client via IPC.

Returns: void

Example:

client.connect()

.update_activity(activity)

Update User's Discord activity.

Activity Object

Field Type Description Example
state string the user's current party status "Looking to Play", "Playing Solo", "In a Group"
details string what the player is currently doing "Competitive - Captain's Mode", "In Queue", "Unranked PvP"
timestamps object
timestamps.start integer epoch seconds for game start - including will show time as "elapsed" 1507665886
timestamps.end integer epoch seconds for game end - including will show time as "remaining" 1507665886
assets object
assets.large_image string name of the uploaded image for the large profile artwork "default"
assets.large_text string tooltip for the large_image "Blade's Edge Arena", "Numbani", "Danger Zone"
assets.small_image string name of the uploaded image for the small profile artwork "rogue"
assets.small_text string tootltip for the small_image "Rogue - Level 100"
party object
party.id string id of the player's party, lobby, or group "ae488379-351d-4a4f-ad32-2b9b01c91657"
party.size array array of current size of the player's party, lobby, or group and maximum size of the player's party, lobby, or group [ 1, 5 ]
secrets object
secrets.match string unique hashed string for Spectate and Join "MmhuZToxMjMxMjM6cWl3amR3MWlqZA=="
secrets.spectate string unique hashed string for Spectate button "MTIzNDV8MTIzNDV8MTMyNDU0"
secrets.join string unique hashed string for chat invitations and Ask to Join "MTI4NzM0OjFpMmhuZToxMjMxMjM="
instance boolean marks the matchSecret as a game session with a specific beginning and end True

Returns: void

Example:

activity = {
    'state': 'In the white house.',
    'details': 'The player has to find the secret item that\'s hidden inside the white house, before the time ends.',
    'timestamps': {
        'start': 1521630000,
        'end': 1521631337,
    },
    'assets': {
        'large_image': '32db72f5-826b-4cd7-bfed-a72c3890eccd',
        'large_text': 'Level 4',
        'small_image': 'e76c00bd-a8d7-41e8-aa34-92a843e03e5e',
        'small_text': 'Salvation',
    },
    'party': {
        'id': 'dcb5c08f-0bae-4e1c-98c0-09343939c965',
        'size': [1, 2]
    },
    'secrets': {
        'match': 'MmhuZToxMjMxMjM6cWl3amR3MWlqZA==',
        'spectate': 'MTIzNDV8MTIzNDV8MTMyNDU0',
        'join': 'MTI4NzM0OjFpMmhuZToxMjMxMjM=',
    },
    'instance': True,
}

client.update_activity(activity)

.disconnect()

Terminate connection to Discord IPC Socket.

Returns: void

Example:

client.disconnect()

Working Examples

For complete working examples, see: https://github.com/k3rn31p4nic/discoIPC#examples