File tree Expand file tree Collapse file tree
pyrogram/types/messages_and_media Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616# You should have received a copy of the GNU Lesser General Public License
1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
19+ from typing import Optional , Union
20+
1921from pyrogram import raw
2022from ..object import Object
2123
@@ -24,7 +26,7 @@ class WebAppData(Object):
2426 """Contains data sent from a `Web App <https://core.telegram.org/bots/webapps>`_ to the bot.
2527
2628 Parameters:
27- data (``str``):
29+ data (``str``, *optional* ):
2830 The data.
2931
3032 button_text (``str``):
@@ -35,7 +37,7 @@ class WebAppData(Object):
3537 def __init__ (
3638 self ,
3739 * ,
38- data : str ,
40+ data : Optional [ str ] ,
3941 button_text : str ,
4042 ):
4143 super ().__init__ ()
@@ -44,8 +46,8 @@ def __init__(
4446 self .button_text = button_text
4547
4648 @staticmethod
47- def _parse (action : "raw.types.MessageActionWebViewDataSentMe" ):
49+ def _parse (action : Union [ "raw.types.MessageActionWebViewDataSent" , "raw.types. MessageActionWebViewDataSentMe"] ):
4850 return WebAppData (
49- data = action . data ,
51+ data = getattr ( action , " data" , None ) ,
5052 button_text = action .text
5153 )
You can’t perform that action at this time.
0 commit comments