Skip to content

Discord IPC

Shell edited this page Jan 17, 2024 · 8 revisions

Introduction to Discord IPC

It's currently like really barebones at the time of writing this. It's basically another way to create custom presences and get some data for the client, you need a running discord client on your pc for this to work properly. The full documentation for discord IPC stuff is over here. Not sure why they call it DiscordRPC but oke!

These methods and attributes are all part of the DiscordIPC class.

Initialises DiscordIPC

DiscordIPC(application_id: str, pid: int = os.getpid() )

Opens unix socket connection the discord ipc path.

async def connect(self)

Presences

Updates presence with this.

async def update_presence(
        self,
        state: Optional[str] = None,
        details: Optional[str] = None,
        start: Optional[int] = None,
        end: Optional[int] = None,
        large_image: Optional[str] = None,
        large_text: Optional[str] = None,
        small_image: Optional[str] = None,
        small_text: Optional[str] = None,
        party_id: Optional[str] = None,
        party_size: Optional[list] = None,
        join: Optional[str] = None,
        match: Optional[str] = None,
        spectate: Optional[str] = None,
        buttons: Optional[list] = None,
        instance: bool = True, payload_override: Optional[dict] = None
    )

Here's an example for presences. And also to my knowledge this sort of presence is the only type that supports GIFs.

from selfcord import DiscordIPC

ipc = DiscordIPC("application_id")
await ipc.connect()
await ipc.update_presence(
  large_image="https://media1.tenor.com/m/lkNibumAgF4AAAAC/omega-omega-sing.gif",
  large_text="wow so omega",
  small_image="https://media.tenor.com/1ktJJbUielEAAAAi/opgamingmx.gif"
  buttons=[{"label": "Join here!", "url": "https://discord.gg/ZYyjdjacNF"}, {"label": "Auth", "url": "https://restorecord.com/verify/OMEGA-PENIS"}]
)
Clone this wiki locally