Change InlineQueryResultType.MPEG to more correct (#1146)

* Change `InlineQueryResultType.MPEG` to `InlineQueryResultType.MPEG4GIF`

* Change regexp for parse entities

* Use code generator to fix types

* Add changelog
This commit is contained in:
Desiders 2023-04-08 17:41:00 +03:00 committed by GitHub
parent 268b7e759d
commit 46a7beb668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 4 deletions

View file

@ -5,7 +5,7 @@ description: |
Source: https://core.telegram.org/bots/api#inlinequeryresult
multi_parse:
attribute: type
regexp: "must be ([a-z_]+)"
regexp: "must be ([a-z_0-9]+)"
entities:
- InlineQueryResultCachedAudio
- InlineQueryResultCachedDocument

4
CHANGES/1146.bugfix.rst Normal file
View file

@ -0,0 +1,4 @@
Change type of result in InlineQueryResult enum for `InlineQueryResultCachedMpeg4Gif`
and `InlineQueryResultMpeg4Gif` to more correct according to documentation.
Change regexp for entities parsing to more correct (`InlineQueryResultType.yml`).

View file

@ -11,7 +11,7 @@ class InlineQueryResultType(str, Enum):
AUDIO = "audio"
DOCUMENT = "document"
GIF = "gif"
MPEG = "mpeg"
MPEG4_GIF = "mpeg4_gif"
PHOTO = "photo"
STICKER = "sticker"
VIDEO = "video"

View file

@ -21,7 +21,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
"""
type: str = Field(InlineQueryResultType.MPEG, const=True)
type: str = Field(InlineQueryResultType.MPEG4_GIF, const=True)
"""Type of the result, must be *mpeg4_gif*"""
id: str
"""Unique identifier for this result, 1-64 bytes"""

View file

@ -21,7 +21,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
Source: https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
"""
type: str = Field(InlineQueryResultType.MPEG, const=True)
type: str = Field(InlineQueryResultType.MPEG4_GIF, const=True)
"""Type of the result, must be *mpeg4_gif*"""
id: str
"""Unique identifier for this result, 1-64 bytes"""