How to use the pypresence.payloads.Payload function in pypresence

To help you get started, we’ve selected a few pypresence examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qwertyquerty / pypresence / pypresence / presence.py View on Github external
def update(self, pid: int = os.getpid(),
                     state: str = None, details: str = None,
                     start: int = None, end: int = None,
                     large_image: str = None, large_text: str = None,
                     small_image: str = None, small_text: str = None,
                     party_id: str = None, party_size: list = None,
                     join: str = None, spectate: str = None,
                     match: str = None, instance: bool = True,
                     _donotuse=True):

        if _donotuse is True:
            payload = Payload.set_activity(pid, state, details, start, end, large_image, large_text,
                                           small_image, small_text, party_id, party_size, join, spectate,
                                           match, instance, activity=True)
        else:
            payload = _donotuse
        self.send_data(1, payload)
        return self.loop.run_until_complete(self.read_output())
github qwertyquerty / pypresence / pypresence / activity.py View on Github external
def __init__(self, client: Presence, pid: int = os.getpid(),
                 state: str = None, details: str = None,
                 start: int = None, end: int = None,
                 large_image: str = None, large_text: str = None,
                 small_image: str = None, small_text: str = None,
                 party_id: str = None, party_size: list = None,
                 join: str = None, spectate: str = None,
                 match: str = None, instance: bool = True):

        self.payload = Payload.set_activity(pid, state, details, start, end, large_image, large_text,
                                            small_image, small_text, party_id, party_size, join, spectate,
                                            match, instance, _rn=False)

        self.p_properties = ('pid', 'state', 'details', 'start', 'end', 'large_image', 'large_text', 'small_image', 'small_text', 'party_id', 'party_size', 'join', 'spectate', 'match', 'instance')
        self.response = Response.from_dict(self.payload.data)

        if not isinstance(client, Presence):
            raise NotImplementedError
        self.client = client
github qwertyquerty / pypresence / pypresence / presence.py View on Github external
def clear(self, pid: int = os.getpid()):
        payload = Payload.set_activity(pid, activity=None)
        self.send_data(1, payload)
        return self.loop.run_until_complete(self.read_output())
github qwertyquerty / pypresence / pypresence / baseclient.py View on Github external
def send_data(self, op: int, payload: Union[dict, Payload]):
        if isinstance(payload, Payload):
            payload = payload.data
        payload = json.dumps(payload)
        self.sock_writer.write(
            struct.pack(
                '