Skip to content

Commit

Permalink
fead: link in markups
Browse files Browse the repository at this point in the history
  • Loading branch information
kutuzov13 committed Apr 10, 2024
1 parent 6b27924 commit 9ff5f53
Show file tree
Hide file tree
Showing 2 changed files with 459 additions and 354 deletions.
8 changes: 6 additions & 2 deletions pybotx/models/message/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Button:
width_ratio: Missing[int] = Undefined
alert: Missing[str] = Undefined
process_on_client: Missing[bool] = Undefined
link: Missing[str] = Undefined


ButtonRow = List[Button]
Expand All @@ -41,8 +42,7 @@ def __eq__(self, other: object) -> bool:
if not isinstance(other, BaseMarkup):
raise NotImplementedError

# https://github.com/wemake-services/wemake-python-styleguide/issues/2172
return self._buttons == other._buttons # noqa: WPS437
return self._buttons == other._buttons

def __repr__(self) -> str:
buttons = []
Expand Down Expand Up @@ -78,6 +78,7 @@ def add_button(
width_ratio: Missing[int] = Undefined,
alert: Missing[str] = Undefined,
process_on_client: Missing[bool] = Undefined,
link: Missing[str] = Undefined,
new_row: bool = True,
) -> None:
button = Button(
Expand All @@ -91,6 +92,7 @@ def add_button(
width_ratio=width_ratio,
alert=alert,
process_on_client=process_on_client,
link=link,
)
self.add_built_button(button, new_row=new_row)

Expand Down Expand Up @@ -118,6 +120,7 @@ class BotXAPIButtonOptions(UnverifiedPayloadBaseModel):
show_alert: Missing[Literal[True]]
alert_text: Missing[str]
handler: Missing[Literal["client"]]
link: Missing[str]


class BotXAPIButton(UnverifiedPayloadBaseModel):
Expand Down Expand Up @@ -153,6 +156,7 @@ def api_button_from_domain(button: Button) -> BotXAPIButton:
alert_text=button.alert,
show_alert=show_alert,
handler=handler,
link=button.link
),
)

Expand Down

0 comments on commit 9ff5f53

Please sign in to comment.