Browse Source

Fix activity button type

pull/10109/head
Lilly Rose Berner 3 years ago
committed by dolfies
parent
commit
aa62fa6ba4
  1. 15
      discord/activity.py
  2. 7
      discord/types/activity.py

15
discord/activity.py

@ -75,9 +75,7 @@ type: int
sync_id: str
session_id: str
flags: int
buttons: list[dict]
label: str (max: 32)
url: str (max: 512)
buttons: list[str (max: 32)]
There are also activity flags which are mostly uninteresting for the library atm.
@ -98,7 +96,6 @@ if TYPE_CHECKING:
from .types.activity import (
Activity as ActivityPayload,
ActivityAssets,
ActivityButton,
ActivityParty,
ActivityTimestamps,
)
@ -190,12 +187,8 @@ class Activity(BaseActivity):
- ``id``: A string representing the party ID.
- ``size``: A list of up to two integer elements denoting (current_size, maximum_size).
buttons: List[:class:`dict`]
An list of dictionaries representing custom buttons shown in a rich presence.
Each dictionary contains the following keys:
- ``label``: A string representing the text shown on the button.
- ``url``: A string representing the URL opened upon clicking the button.
buttons: List[:class:`str`]
An list of strings representing the labels of custom buttons shown in a rich presence.
.. versionadded:: 2.0
@ -234,7 +227,7 @@ class Activity(BaseActivity):
self.flags: int = kwargs.pop('flags', 0)
self.sync_id: Optional[str] = kwargs.pop('sync_id', None)
self.session_id: Optional[str] = kwargs.pop('session_id', None)
self.buttons: List[ActivityButton] = kwargs.pop('buttons', [])
self.buttons: List[str] = kwargs.pop('buttons', [])
activity_type = kwargs.pop('type', -1)
self.type: ActivityType = (

7
discord/types/activity.py

@ -76,11 +76,6 @@ class ActivityEmoji(TypedDict):
animated: NotRequired[bool]
class ActivityButton(TypedDict):
label: str
url: str
ActivityType = Literal[0, 1, 2, 4, 5]
@ -106,5 +101,5 @@ class Activity(_BaseActivity, total=False):
secrets: ActivitySecrets
session_id: Optional[str]
instance: bool
buttons: List[ActivityButton]
buttons: List[str]
sync_id: str

Loading…
Cancel
Save