Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pyrogram/types/messages_and_media/web_app_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

from typing import Optional, Union

from pyrogram import raw
from ..object import Object

Expand All @@ -24,7 +26,7 @@ class WebAppData(Object):
"""Contains data sent from a `Web App <https://core.telegram.org/bots/webapps>`_ to the bot.

Parameters:
data (``str``):
data (``str``, *optional*):
The data.

button_text (``str``):
Expand All @@ -35,7 +37,7 @@ class WebAppData(Object):
def __init__(
self,
*,
data: str,
data: Optional[str],
button_text: str,
):
super().__init__()
Expand All @@ -44,8 +46,8 @@ def __init__(
self.button_text = button_text

@staticmethod
def _parse(action: "raw.types.MessageActionWebViewDataSentMe"):
def _parse(action: Union["raw.types.MessageActionWebViewDataSent", "raw.types.MessageActionWebViewDataSentMe"]):
return WebAppData(
data=action.data,
data=getattr(action, "data", None),
button_text=action.text
)
Loading