Skip to content

Commit

Permalink
👽 Bot API 7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
j1g5awi committed Nov 13, 2024
1 parent 6992fca commit 2b1720c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 4 deletions.
39 changes: 37 additions & 2 deletions nonebot/adapters/telegram/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ async def send_message(
link_preview_options: Optional[LinkPreviewOptions] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -143,11 +144,12 @@ async def copy_message(
message_id: int,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Literal["MarkdownV3", "Markdown", "HTML"]] = None,
parse_mode: Optional[Literal["MarkdownV2", "Markdown", "HTML"]] = None,
caption_entities: Optional[list[MessageEntity]] = None,
show_caption_above_media: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[
Expand Down Expand Up @@ -183,6 +185,7 @@ async def send_photo(
has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -210,6 +213,7 @@ async def send_audio(
thumbnail: Optional[Union[str, InputFile]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -235,6 +239,7 @@ async def send_document(
disable_content_type_detection: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -265,6 +270,7 @@ async def send_video(
supports_streaming: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -294,6 +300,7 @@ async def send_animation(
has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -318,6 +325,7 @@ async def send_voice(
duration: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -341,6 +349,7 @@ async def send_video_note(
thumbnail: Optional[Union[str, InputFile]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -357,12 +366,15 @@ async def send_paid_media(
chat_id: Union[int, str],
star_count: int,
media: list[InputPaidMedia],
business_connection_id: Optional[str] = None,
payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[list[MessageEntity]] = None,
show_caption_above_media: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[
Expand All @@ -384,6 +396,7 @@ async def send_media_group(
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
) -> list[Message]: ...
Expand All @@ -401,6 +414,7 @@ async def send_location(
proximity_alert_radius: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -428,6 +442,7 @@ async def send_venue(
google_place_type: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -451,6 +466,7 @@ async def send_contact(
vcard: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -486,6 +502,7 @@ async def send_poll(
is_closed: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand All @@ -506,6 +523,7 @@ async def send_dice(
emoji: Optional[Literal["🎲", "🎯", "🏀", "⚽", "🎳", "🎰"]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -637,6 +655,16 @@ async def edit_chat_invite_link(
creates_join_request: Optional[bool] = None,
) -> ChatInviteLink: ...

async def create_chat_subscription_invite_link(
self,
chat_id: Union[int, str],
subscription_period: int,
subscription_price: int,
name: Optional[str] = None,
) -> ChatInviteLink: ...
async def edit_chat_subscription_invite_link(
self, chat_id: Union[int, str], invite_link: str, name: Optional[str] = None
) -> ChatInviteLink: ...
async def revoke_chat_invite_link(
self, chat_id: Union[int, str], invite_link: str
) -> ChatInviteLink: ...
Expand Down Expand Up @@ -667,11 +695,15 @@ async def pin_chat_message(
self,
chat_id: Union[int, str],
message_id: int,
business_connection_id: Optional[str] = None,
disable_notification: Optional[bool] = None,
) -> Literal[True]: ...

async def unpin_chat_message(
self, chat_id: Union[int, str], message_id: Optional[int] = None
self,
chat_id: Union[int, str],
business_connection_id: Optional[str] = None,
message_id: Optional[int] = None,
) -> Literal[True]: ...

async def unpin_all_chat_messages(
Expand Down Expand Up @@ -929,6 +961,7 @@ async def send_sticker(
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Expand Down Expand Up @@ -1049,6 +1082,7 @@ async def send_invoice(
is_flexible: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
Expand Down Expand Up @@ -1108,6 +1142,7 @@ async def send_game(
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
Expand Down
35 changes: 33 additions & 2 deletions nonebot/adapters/telegram/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class User(BaseModel):
can_read_all_group_messages: Optional[bool] = None
supports_inline_queries: Optional[bool] = None
can_connect_to_business: Optional[bool] = None
has_main_web_app: Optional[bool] = None


class Chat(BaseModel):
Expand Down Expand Up @@ -260,6 +261,7 @@ class Giveaway(BaseModel):
has_public_winners: Optional[Literal[True]] = None
prize_description: Optional[str] = None
country_codes: Optional[list[str]] = None
prize_star_count: Optional[int] = None
premium_subscription_month_count: Optional[int] = None


Expand All @@ -270,6 +272,7 @@ class GiveawayWinners(BaseModel):
winner_count: int
winners: list[User]
additional_chat_count: Optional[int] = None
prize_star_count: Optional[int] = None
premium_subscription_month_count: Optional[int] = None
unclaimed_prize_count: Optional[int] = None
only_new_members: Optional[Literal[True]] = None
Expand Down Expand Up @@ -580,13 +583,14 @@ class GeneralForumTopicUnhidden(BaseModel):


class GiveawayCreated(BaseModel):
pass
prize_star_count: Optional[int] = None


class GiveawayCompleted(BaseModel):
winner_count: int
unclaimed_prize_count: Optional[int] = None
giveaway_message: Optional["Message"] = None
is_star_giveaway: Optional[Literal[True]] = None


class VideoChatScheduled(BaseModel):
Expand Down Expand Up @@ -629,6 +633,10 @@ class SwitchInlineQueryChosenChat(BaseModel):
allow_channel_chats: Optional[bool] = None


class CopyTextButton(BaseModel):
text: str


class CallbackGame(BaseModel):
pass

Expand All @@ -642,6 +650,7 @@ class InlineKeyboardButton(BaseModel):
switch_inline_query: Optional[str] = None
switch_inline_query_current_chat: Optional[str] = None
switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None
copy_text: Optional[CopyTextButton] = None
callback_game: Optional[CallbackGame] = None
pay: Optional[bool] = None

Expand Down Expand Up @@ -763,7 +772,11 @@ class ReactionTypeCustomEmoji(BaseModel):
custom_emoji_id: str


ReactionType = Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]
class ReactionTypePaid(BaseModel):
type: str


ReactionType = Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]


class MessageReactionUpdated(BaseModel):
Expand Down Expand Up @@ -834,6 +847,11 @@ class PreCheckoutQuery(BaseModel):
order_info: Optional[OrderInfo] = None


class PaidMediaPurchased(BaseModel):
from_: User = Field(alias="from")
paid_media_payload: str


class PollAnswer(BaseModel):
poll_id: str
voter_chat: Optional[Chat] = None
Expand Down Expand Up @@ -873,6 +891,7 @@ class ChatMemberAdministrator(BaseModel):
class ChatMemberMember(BaseModel):
status: Literal["member"] = "member"
user: User
until_date: Optional[int] = None


class ChatMemberRestricted(BaseModel):
Expand Down Expand Up @@ -927,6 +946,8 @@ class ChatInviteLink(BaseModel):
expire_date: Optional[int] = None
member_limit: Optional[int] = None
pending_join_request_count: Optional[int] = None
subscription_period: Optional[int] = None
subscription_price: Optional[int] = None


class ChatMemberUpdated(BaseModel):
Expand Down Expand Up @@ -963,6 +984,7 @@ class ChatBoostSourceGiveaway(BaseModel):
source: Literal["giveaway"] = "giveaway"
giveaway_message_id: int
user: Optional[User] = None
prize_star_count: Optional[int] = None
is_unclaimed: Optional[Literal[True]] = None


Expand Down Expand Up @@ -1007,6 +1029,7 @@ class Update(BaseModel):
callback_query: Optional[CallbackQuery] = None
shipping_query: Optional[ShippingQuery] = None
pre_checkout_query: Optional[PreCheckoutQuery] = None
purchased_paid_media: Optional[PaidMediaPurchased] = None
poll: Optional[Poll] = None
poll_answer: Optional[PollAnswer] = None
my_chat_member: Optional[ChatMemberUpdated] = None
Expand Down Expand Up @@ -1851,6 +1874,8 @@ class TransactionPartnerUser(BaseModel):
type: str
user: User
invoice_payload: Optional[str] = None
paid_media: Optional[list[PaidMedia]] = None
paid_media_payload: Optional[str] = None


class TransactionPartnerFragment(BaseModel):
Expand All @@ -1862,6 +1887,11 @@ class TransactionPartnerTelegramAds(BaseModel):
type: str


class TransactionPartnerTelegramApi(BaseModel):
type: str
request_count: int


class TransactionPartnerOther(BaseModel):
type: str

Expand All @@ -1870,6 +1900,7 @@ class TransactionPartnerOther(BaseModel):
TransactionPartnerUser,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]

Expand Down

0 comments on commit 2b1720c

Please sign in to comment.