API reference

Client

class pluralkit.Client(token=None, *, async_mode=True, user_agent=None)

Represents a client that interacts with the PluralKit API.

Parameters

token (Optional[str]) – The PluralKit authorization token, received by the pk;token command.

Keyword Arguments
  • async_mode – Whether the client runs asynchronously (True, default) or not (False).

  • user_agent – The User-Agent header to use with the API.

token

The client’s PluralKit authorization token.

Type

Optional[str]

async_mode

Whether the client runs asynchronously (True) or not (False).

Type

bool

user_agent

The User-Agent header used with the API.

Type

Optional[str]

id

The five-letter lowercase ID of one’s system if an authorization token is provided.

Type

Optional[str]

delete_member(member_id)

Deletes a member of one’s system

Note

The system’s authorization token must be set in order to use this method.

Parameters

member_id (Union[str, Member]) – The member to be deleted. Can be a Member object or the member ID as a string.

Returns

None

Return type

NoneType

edit_member(member_id, member=None, **kwargs)

Edits a member of one’s system.

Note

The system’s authorization token must be set in order to use this method.

If a Member object is provided, this method will use the attributes of that object to edit the member. If both a Member object and some keyword arguments are passed, the keyword arguments will take priority.

Parameters
  • member_id (Union[str, Member]) – The member to be edited. Can be a Member object or the member ID as a string.

  • member (Optional[Member]) – Optional Member object representing the member with updated attributes.

  • **kwargs – Any number of keyworded patchable values from PluralKit’s member model.

Note

Any fields not passed will retain their prior value. Any fields passed with None will clear or reset to the default.

Keyword Arguments
  • name (str) – New name of the member.

  • display_name (Optional[str]) – New display name of the member. If None is passed, this field is cleared.

  • description (Optional[str]) – New description of the member. If None is passed, this field is cleared.

  • pronouns (Optional[str]) – New pronouns of the member. If None is passed, this field is cleared.

  • color (Union[Color,str,None]) – New color of the member. If a string, must be formatted as a 6-character hex string (e.g. "ff7000"), sans the # symbol. If None is passed, this field is cleared.

  • avatar_url (Optional[str]) – New avatar URL for the member. If None is passed, this field is cleared.

  • birthday (Union[Birthday,str]) – New birthdate of the member. If a string, must be formatted as YYYY-MM-DD, in which case, a year of 0001 or 0004 represents a hidden year. If None is passed, this field is cleared.

  • proxy_tags (Union[ProxyTags,Sequence[ProxyTag],Sequence[Dict[str,str]]]) – New proxy tags of the member. May be a ProxyTags object, a sequence of ProxyTag objects, or a sequence of Python dictionaries with the keys “prefix” and “suffix”.

  • keep_proxy (bool) – New truth value for whether to display the member’s proxy tags in the proxied message.

  • visibility (Union[Privacy,str,None]) – New visibility privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

  • name_privacy (Union[Privacy,str,None]) – New name privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

  • description_privacy (Union[Privacy,str,None]) – New description privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

  • avatar_privacy (Union[Privacy,str,None]) – New avatar privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

  • pronoun_privacy (Union[Privacy,str]) – New pronouns privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

  • metadata_privacy (Union[Privacy,str]) – New metadata (eg. creation timestamp, message count, etc.) privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. If None is passed, this field is reset to public.

Returns

The updated member.

Return type

Member

edit_system(system=None, **kwargs)

Edits one’s own system

Note

The system’s authorization token must be set in order to use this method.

If a System object is provided, this method will use the attributes of that object to edit one’s system. If both a System object and some keyword arguments are passed, the keyword arguments will take priority.

Parameters
  • system (Optional[System]) – The optional object to transfer system attributes from.

  • **kwargs – Any number of keyworded patchable values from PluralKit’s system model.

Note

Any fields not passed will retain their prior value. Any fields passed with None will clear or reset to the default.

Keyword Arguments
  • name (Optional[str]) – The new system name.

  • description (Optional[str]) – The new system description.

  • tag (Optional[str]) – The new system tag.

  • avatar_url (Optional[str]) – The new system avatar.

  • tz (Union[Timezone,str,None]) – The timezone as a tzdb identifier. Passing None will reset this field to “UTC”.

  • description_privacy (Union[Privacy,str,None]) – The new system description privacy.

  • member_list_privacy (Union[Privacy,str,None]) – The new system member list privacy.

  • front_privacy (Union[Privacy,str,None]) – The new system front privacy.

  • metadata_privacy (Union[Privacy,str,None]) – The new system metadata privacy.

Returns

The updated system.

Return type

System

get_fronters(system=None)

Fetches the current fronters of a system.

Parameters

system (Optional[Union[str,System,int]]) – The system to fetch fronters from. Can be a System object, the five-letter lowercase system ID as a string, or the Discord user ID corresponding to a system. If None, fetches the fronters of the system associated with the client.

Note

Passing a Discord user ID takes an extra request. For this reason, it’s perhaps better practice to cache the system ID associated with Discord accounts using Client.get_system first.

Returns

The Timestamp object and the list of current fronters.

Return type

Tuple[Timestamp, List[Member]]

get_member(member_id)

Gets a system member.

Parameters

member_id (str) – The ID of the member to be fetched.

Returns

The member with the given ID.

Return type

Member

get_members(system=None)

Retrieve list of a system’s members.

Parameters

system (Optional[Union[str,System,int]]) – The system to fetch members from. Can be a System object, the five-letter lowercase system ID as a string, or the Discord user ID corresponding to a system. If None, fetches the members of the system associated with the client.

Note

Passing a Discord user ID takes an extra request. For this reason, it’s perhaps better practice to cache the system ID associated with Discord accounts using Client.get_system first.

Yields

Member – The next system member.

Return type

Union[List[Member], AsyncGenerator[Member, None]]

get_message(message)

Fetches a message proxied by pluralkit

Note

Messages proxied by pluralkit can be fetched either with the proxy message’s id, or the id of the original message that triggered the proxy.

Parameters

Message – The message to be fetched. Can be a Discord message ID (as a string or integer) or a Message object.

Returns

The message object.

Return type

Message

get_switches(system=None)

Fetches the switch history of a system.

Parameters

system (Union[System, str, None]) – The system to fetch switch history from. Can be a System object, the five-letter lowercase system ID as a string, or the Discord user ID corresponding to a system. If None, fetches the switch history of the system associated with the client.

Note

Passing a Discord user ID takes an extra request. For this reason, it’s perhaps better practice to cache the system ID associated with Discord accounts using Client.get_system first.

Yields

Switch – The next switch.

Return type

Union[List[Switch], AsyncGenerator[Switch, None]]

get_system(system=None)

Return a system by its system ID or Discord user ID.

Parameters

system (Union[System, str, int, None]) – The system ID (as str), Discord user ID (as int), or System object of the system. If None, returns the system of the client.

Returns

The retrieved system.

Return type

System

new_member(name, **kwargs)

Creates a new member of one’s system.

Note

The system’s authorization token must be set in order to use this method.

Parameters
Keyword Arguments
  • display_name (Optional[str]) – New display name of the member. Default is None.

  • description (Optional[str]) – New description of the member. Default is None.

  • pronouns (Optional[str]) – New pronouns of the member. Default is None.

  • color (Union[Color,str,None]) – New color of the member. If a string, must be formatted as a 6-character hex string (e.g. "ff7000"), sans the # symbol. Default is None.

  • avatar_url (Optional[str]) – New avatar URL for the member. Default is None.

  • birthday (Union[Timestamp,str]) – New birthdate of the member. If a string, must be formatted as YYYY-MM-DD, in which case, year of 0001 or 0004 represents a hidden year. Default is None.

  • proxy_tags (Union[ProxyTags,Sequence[ProxyTag],Sequence[Dict[str,str]]]) – New proxy tags of the member. May be a ProxyTags object, a sequence of ProxyTag objects, or a sequence of Python dictionaries with the keys “prefix” and “suffix”. Default is an empty set of proxy tags.

  • keep_proxy (bool) – New truth value for whether to display the member’s proxy tags in the proxied message. Default is False.

  • visibility (Union[Privacy,str,None]) – New visibility privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

  • name_privacy (Union[Privacy,str,None]) – New name privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

  • description_privacy (Union[Privacy,str,None]) – New description privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

  • avatar_privacy (Union[Privacy,str,None]) – New avatar privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

  • pronoun_privacy (Union[Privacy,str]) – New pronouns privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

  • metadata_privacy (Union[Privacy,str]) – New metadata (eg. creation timestamp, message count, etc.) privacy for the member. Must be either Privacy.PUBLIC or Privacy.PRIVATE. Default is public.

Returns

The new member.

Return type

Member

new_switch(members)

Creates a new switch.

Note

The system’s authorization token must be set in order to use this method.

Parameters

members (Sequence[Union[Member,str]]) – A list of members that will be present in the new switch.

Return type

Optional[Coroutine[Any, Any, None]]

Models

Birthday

class pluralkit.Birthday(dt=None, *, year=None, month=None, day=None, hour=0, minute=0, second=0, microsecond=0)

Represents a birthday.

staticmethod from_json(bd)

Takes in a string (as returned by the API) and returns the Birthday.

Parameters

bd (str) – The YYYY-MM-DD formatted string representing the birthdate.

Returns

The corresponding birthday.

Return type

Birthday

hidden_year

Whether this birthday’s year is hidden.

If set to False, sets the birthday’s year to 0001, which internally represents a hidden year in PluralKit’s API.

Return type

bool

json()

Returns the YYYY-MM-DD formatted birthdate.

Return type

str

staticmethod parse(bd)

Takes in a Birthday, datetime, or str, converts to Birthday as needed.

Parameters

bd (Union[Birthday,datetime,str,None]) – The birthday, represented as a Birthday, datetime, or str.

Returns

The Birthday object, or None if input is None.

Return type

Optional[Birthday]

Raises

TypeError – If given argument is neither a Birthday, datetime, or str.

Color

class pluralkit.Color(*args, **kwargs)

Represents a color.

This class is initialized in the same way that a colour.Color object is. It may also take a colour.Color object directly.

staticmethod from_json(color)

Takes in a string (as returned by the API) and returns the Color.

json()

Returns the hex of the Color sans the # symbol.

Example: Color("magenta").json() would return "ff00ff".

staticmethod parse(c)

Takes in a Color, colour.Color, or str and converts to Color as needed.

Parameters

color (Union[Color,colour.Color,str,None]) – The color, represented as a Color, colour.Color or str. If a string, may either be in the format as expected by PluralKit’s API internally (e.g. 00ffff) or a color string that can be taken by a Color object (e.g. cyan).

Returns

The Color object, or None if input is None.

Return type

Optional[Color]

Raises

TypeError – If the given argument is neither a Color, colour.Color, or str.

Member

class pluralkit.Member(*, id, name, created, name_privacy=<Privacy.PUBLIC: 'public'>, display_name=None, description=None, description_privacy=<Privacy.PUBLIC: 'public'>, color=None, birthday=None, birthday_privacy=<Privacy.PUBLIC: 'public'>, pronouns=None, pronoun_privacy=<Privacy.PUBLIC: 'public'>, avatar_url=None, avatar_privacy=<Privacy.PUBLIC: 'public'>, keep_proxy=False, metadata_privacy=<Privacy.PUBLIC: 'public'>, proxy_tags=None, visibility=<Privacy.PUBLIC: 'public'>)

Represents a PluralKit system member.

Parameters
  • id (str) – The member’s five-letter lowercase ID.

  • name (str) – The member’s name.

  • created (Union[None, Timestamp, datetime, str]) – The member’s creation date. May be a string formatted as {year}-{month}-{day}T{hour}:{minute}:{second}.{microsecond}Z (ISO 8601 format), a Timestamp, or a datetime.

  • name_privacy (Union[Privacy, str]) – The member’s name privacy, either PUBLIC or PRIVATE. Default is public.

  • display_name (Optional[str]) – The member’s display name. Default is None.

  • description (Optional[str]) – The member’s description. Default is None.

  • description_privacy (Union[Privacy, str]) – The member’s description privacy, either PUBLIC or PRIVATE. Default is public.

  • color (Union[Color, str, None]) – The member’s color. Default is None.

  • birthday (Union[Birthday, datetime, str, None]) – The member’s birthdate. May be a string formatted as {year}-{month}-{day}, a Timestamp, or a datetime. Default is None.

  • birthday_privacy (Union[Privacy, str]) – The member’s birthdate privacy, either PUBLIC or PRIVATE. Default is public.

  • pronouns (Optional[str]) – The member’s pronouns. Default is None.

  • pronoun_privacy (Union[Privacy, str]) – The member’s pronouns privacy, either PUBLIC or PRIVATE. Default is public.

  • avatar_url (Optional[str]) – The member’s avatar URL.

  • avatar_privacy (Union[Privacy, str]) – The member’s avatar privacy, either PUBLIC or PRIVATE. Default is public.

  • keep_proxy (bool) – Whether the member’s proxy tags remain in the proxied message (True) or not (False). Default is False.

  • metadata_privacy (Union[Privacy, str]) – The member’s metadata (eg. creation timestamp, message count, etc.) privacy. Must be either PUBLIC or PRIVATE. Default is public.

  • proxy_tags (Optional[ProxyTags]) – The member’s proxy tags. Default is an empty set of proxy tags.

  • visibility (Union[Privacy, str]) – The visibility privacy setting of the member, either PUBLIC or PRIVATE. Default is public.

id

The member’s five-letter lowercase ID.

Type

str

name

The member’s name.

Type

str

created

The member’s creation date.

Type

Timestamp

name_privacy

The member’s name privacy.

Type

Privacy

display_name

The member’s display name.

Type

Optional[str]

description

The member’s description.

Type

Optional[str]

description_privacy

The member’s description privacy.

Type

Privacy

color

The member’s color.

Type

Optional[Color]

birthday

The member’s birthdate.

Type

Optional[Birthday]

birthday_privacy

The member’s birthday privacy.

Type

Privacy

pronouns

The member’s pronouns.

Type

Optional[str]

pronoun_privacy

The member’s pronouns privacy.

Type

Privacy

avatar_url

The member’s avatar URL.

Type

Optional[str]

avatar_privacy

The member’s avatar privacy.

Type

Privacy

keep_proxy

Whether the member’s proxy tags remain in the proxied message (True) or not (False).

Type

bool

metadata_privacy

The member’s metadata (eg. creation timestamp, message count, etc.) privacy.

Type

Privacy

proxy_tags

The member’s proxy tags.

Type

ProxyTags

visibility

The visibility privacy setting of the member.

Type

Privacy

staticmethod from_json(member)

Static method to convert a member dict to a Member object.

Parameters
  • member (Dict[str, Any]) – Dictionary representing a system, e.g. one received directly from the API. Must

  • a value for the id and created attributes. (have) –

Returns

The corresponding Member object.

Return type

Member

json()

Generate the Python dict representing this member.

Return type

Dict[str, Any]

Message

class pluralkit.Message(*, timestamp, id, original, sender, channel, system, member)

Represents a proxied message.

Parameters
  • timestamp (Union[Timestamp, datetime, str]) – Timestamp of the message. May be a string for atted as {year}-{month}-{day}T{hour}:{minute}:{second}.{microsecond}Z (ISO 8601 format), a Timestamp, or a datetime.

  • id (Union[int, str]) – The ID of the Discord message sent by the webhook.

  • original (Union[int, str]) – The ID of the (presumably deleted) original Discord message sent by the account.

  • sender (Union[int, str]) – The user ID of the account that sent the message.

  • channel (Union[int, str]) – The ID of the channel the message was sent to.

  • system (System) – The system that proxied the message.

  • member (Member) – The member that proxied the message.

timestamp

Timestamp of the message.

Type

Timestamp

id

The ID of the Discord message sent by the webhook.

Type

int

original

The ID of the (presumably deleted) original Discord message sent by the account.

Type

int

sender

The user ID of the account that sent the message.

Type

int

channel

The ID of the channel the message was sent to.

Type

int

system

The system that proxied the message.

Type

System

member

The member that proxied the message.

Type

Member

staticmethod from_json(message)

Static method to convert a message dict to a Message object.

Parameters
  • message (Dict[str, Any]) – Dictionary representing a message, e.g. one received directly from the API.

  • have a value the same attributes as required by the Message initializer. (Must) –

Returns

The corresponding Message object.

Return type

Message

json()

Return Python dict representing this message.

Return type

Dict[str, Any]

ProxyTag

class pluralkit.ProxyTag(*, prefix=None, suffix=None)

Represents a single PluralKit proxy tag.

Parameters
  • prefix (Optional[str]) – Prefix that will enclose proxied messages.

  • suffix (Optional[str]) – Suffix that will enclose proxied messages.

Important

At least one of the suffix or prefix arguments must be passed.

prefix

Prefix that will enclose proxied messages.

Type

Optional[str]

suffix

Suffix that will enclose proxied messages.

Type

Optional[str]

staticmethod from_json(proxy_tag)

Static method to convert a proxy tag dict to a ProxyTag.

Parameters

proxy_tag (Dict[str, str]) – Dictionary representing a proxy tag. Must have at least one of prefix or suffix as keys.

Returns

The corresponding ProxyTag object.

Return type

ProxyTag

json()

Return the JSON object representing this proxy tag as a Python dict.

Return type

Dict[str, Optional[str]]

match(message)

Determine if a given message would be proxied under this proxy tag.

Parameters

message (str) – Message to parse.

Return type

bool

ProxyTags

class pluralkit.ProxyTags(proxy_tags=None)

Represents a set of PluralKit proxy tags.

Hint

ProxyTags objects can be iterated or indexed to yield its underlying ProxyTag objects.

Parameters

proxy_tags (Optional[Generator[ProxyTag, None, None]]) – A sequence of ProxyTag objects.

staticmethod from_json(proxy_tags)

Static method to convert a list of proxy tags dict`s to a `ProxyTags object.

Parameters

proxy_tags (Sequence[Dict[str, str]]) – Sequence of Python dictionaries, each representing a proxy tag.

Returns

The corresponding ProxyTags object.

Return type

ProxyTags

json()

Return the JSON object representing this proxy tag as a list of Python dict.

Return type

List[Dict[str, str]]

match(message)

Determine if a given message would be proxied under this set of proxy tags.

Parameters

message (str) – Message to parse.

Return type

bool

Switch

class pluralkit.Switch(*, timestamp, members)

Represents a switch event.

Parameters
  • timestamp (Union[Timestamp, str]) – Timestamp of the switch. May be a string formatted as {year}-{month}-{day}T{hour}:{minute}:{second}.{microsecond}Z (ISO 8601 format), a Timestamp, or a datetime.

  • members (Union[Sequence[str], Sequence[Member]]) – Members involved. May be a list of the five-letter member IDs as strings, or a list of Member models, though cannot be mixed.

timestamp

Timestamp of the switch.

Type

Timestamp

members

Members involved.

Type

Union[Sequence[str],Sequence[Member]]

staticmethod from_json(switch)

Static method to convert a switch dict to a Switch object.

Parameters
  • switch (Dict[str, str]) – Dictionary representing a switch, e.g. one received directly from the API. Must

  • a value for the members and timestamp attributes. See this class's (have) –

  • documentation for what format those are expected to be in. (initializer) –

Returns

The corresponding Switch object.

Return type

Switch

json()

Return Python dict representing this switch.

Return type

Dict[str, Any]

System

class pluralkit.System(*, id, created, name=None, description=None, tag=None, avatar_url=None, tz='UTC', description_privacy=<Privacy.PUBLIC: 'public'>, member_list_privacy=<Privacy.PUBLIC: 'public'>, front_privacy=<Privacy.PUBLIC: 'public'>, front_history_privacy=<Privacy.PUBLIC: 'public'>)

Represents a PluralKit system.

Parameters
  • id (str) – The system’s five-character lowercase ID.

  • created (Union[Timestamp, datetime, str]) – The system’s creation date. May be a string formatted as {year}-{month}-{day}T{hour}:{minute}:{second}.{microsecond}Z (ISO 8601 format), a Timestamp, or a datetime.

  • name (Optional[str]) – The name of the system. Default None.

  • description (Optional[str]) – The description of the system. Default None.

  • tag (Optional[str]) – The system’s tag appended to display names. Default None.

  • avatar_url (Optional[str]) – The system’s avatar URL. Default None.

  • tz (Union[Timezone, tzinfo, str]) – The system’s tzdb timezone. May be a Timezone, tzinfo, or str. Default is "UTC".

  • description_privacy (Union[Privacy, str]) – The system’s description privacy, either PUBLIC or PRIVATE. Default is public.

  • member_list_privacy (Union[Privacy, str]) – The system’s member list privacy, either PUBLIC or PRIVATE. Default is public.

  • front_privacy (Union[Privacy, str]) – The system’s fronting privacy, either PUBLIC or PRIVATE. Default is public.

  • front_history_privacy (Union[Privacy, str]) – The system’s fronting history privacy, either PUBLIC or PRIVATE. Default is public.

id

The system’s five-character lowercase ID.

Type

str

name

The name of the system.

Type

Optional[str]

description

The description of the system.

Type

Optional[str]

tag

The system’s tag appended to display names.

Type

Optional[str]

avatar_url

The system’s avatar URL.

Type

Optional[str]

tz

The system’s tzdb timezone.

Type

Timezone

created

The system’s timestamp at creation.

Type

Timestamp

description_privacy

The system’s description privacy.

Type

Privacy

member_list_privacy

The system’s member list privacy.

Type

Privacy

front_privacy

The system’s fronting privacy.

Type

Privacy

front_history_privacy

The system’s fronting history privacy.

Type

Privacy

staticmethod from_json(system)

Static method to convert a system dict to a System object.

Parameters

system (Dict[str, Any]) – Dictionary representing a system, e.g. one received directly from the API. Must have a value for the id and created attributes.

Returns

The corresponding System object.

Return type

System

json()

Return Python dict representing this system.

Return type

Dict[str, Any]

Timestamp

class pluralkit.Timestamp(dt=None, *, year=None, month=None, day=None, hour=0, minute=0, second=0, microsecond=0)

Represents a PluralKit UTC timestamp.

This class works by wrapping around a datetime object. Use ts.datetime to access it, for any Timestamp ts.

This class may be initialized in the same way that a datetime object is. It may also take a datetime object directly.

staticmethod from_json(bd)

Takes in a string (as returned by the API) and returns the corresponding Timestamp.

Parameters

bd (str) – The {year}-{month}-{day}T{hour}:{minute}:{second}.{microsecond}Z formatted string representing a PluralKit API timestamp.

Returns

The corresponding Timestamp object.

Return type

Timestamp

json()

Convert this timestamp to the ISO 8601 format that PluralKit uses internally.

Return type

str

staticmethod parse(ts)

Takes in a Timestamp, datetime, or str, converts to Timestamp as needed.

Parameters

ts (Union[Timestamp,datetime,str]) – The timestamp, represented as a Timestamp, datetime, or str.

Returns

The Timestamp object.

Return type

Timestamp

Raises

TypeError – If given argument is neither a Timestamp, datetime, or str.

Timezone

class pluralkit.Timezone(*args, **kwargs)

Represents a tzdb time zone.

This class is initialized in the same way that pytz.timezone initializes tzinfo objects. It may also take a tzinfo object directly.

Parameters

tz (Union[str,tzinfo]) – The timezone, either as a string or as a tzinfo (e.g. from pytz.timezone).

staticmethod from_json(tz)

Takes in a string (as returned by the API) and returns the Timezone.

Parameters

tz (str) – The time zone as stored in the PluralKit API internally.

Returns

The corresponding Timezone object.

Return type

Timezone

json()

Returns the string representation of this timezone as expected by the API.

staticmethod parse(tz)

Takes in a Timezone, tzinfo, or str and converts to Timezone as needed.

Parameters

tz (Union[Timezone,tzinfo,str]) – The timezone, represented as a Timezone, tzinfo, or str.

Raises

TypeError – If given argument is neither a Timezone, tzinfo, nor str.

Enumerations

Privacy

class pluralkit.Privacy(value)

Represents the privacies accepted by PluralKit.

PUBLIC = 'public'

Represents a public PluralKit privacy setting.

PRIVATE = 'private'

Represents a private PluralKit privacy setting.

UNKNOWN = None

Equivalent to Privacy.PUBLIC in effect. Returned for member and system privacy fields if the client does not have an authorization token set.

Exceptions

PluralKitException

class errors.PluralKitException

Base exception class for pk.py

AccessForbidden

class errors.AccessForbidden

Thrown when attempting to access private info.

AuthorizationError

class errors.AuthorizationError

Thrown when the authorization token passed to PluralKit’s API is invalid (or missing).

DiscordUserNotFound

class errors.DiscordUserNotFound(id)

Thrown when the Discord user ID is apparently not associated with a PluralKit system.

InvalidBirthday

class errors.InvalidBirthday(string)

Thrown when an invalid string is passed for the “Birthday” field of a member object. (Must be yyyy-mm-dd)

InvalidKwarg

class errors.InvalidKwarg(key)

Thrown when an invalid field is passed in a POST or PATCH request

SystemNotFound

class errors.SystemNotFound(id)

Thrown when the system ID is apparently not in PluralKit’s database.

MemberNotFound

class errors.MemberNotFound(id)

Thrown when the member ID is apparently not in PluralKit’s database.