Skip to content

Commit

Permalink
support aiogram 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
loRes228 committed May 8, 2024
1 parent b6d064e commit 741cc2d
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ lint:

.PHONY: format
format:
ruff check --fix ${CODE_DIRS}
ruff format ${CODE_DIRS}
ruff check --fix ${CODE_DIRS}
2 changes: 1 addition & 1 deletion aiogram_broadcaster/__meta__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.2"
__version__ = "0.4.3"
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def __init__(
height: Optional[int] = ...,
thumbnail: Optional[InputFile] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
has_spoiler: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ def __init__(
audio: Union[InputFile, str],
business_connection_id: Optional[str] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
duration: Optional[int] = ...,
performer: Optional[str] = ...,
title: Optional[str] = ...,
thumbnail: Optional[InputFile] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def __init__(
first_name: str,
business_connection_id: Optional[str] = ...,
last_name: Optional[str] = ...,
vcard: Optional[str] = None,
vcard: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(
business_connection_id: Optional[str] = ...,
emoji: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def __init__(
business_connection_id: Optional[str] = ...,
thumbnail: Optional[InputFile] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
disable_content_type_detection: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/from_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ def __init__(
from_chat_id: Union[int, str],
message_id: int,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
) -> None: ...
6 changes: 4 additions & 2 deletions aiogram_broadcaster/contents/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from aiogram.client.default import Default
from aiogram.methods import SendGame
from aiogram.types import InlineKeyboardMarkup
from aiogram.types import (
InlineKeyboardMarkup,
)

from .base import BaseContent

Expand Down Expand Up @@ -32,6 +34,6 @@ def __init__(
game_short_name: str,
business_connection_id: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[InlineKeyboardMarkup] = ...,
) -> None: ...
7 changes: 5 additions & 2 deletions aiogram_broadcaster/contents/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from aiogram.client.default import Default
from aiogram.methods import SendInvoice
from aiogram.types import InlineKeyboardMarkup, LabeledPrice
from aiogram.types import (
InlineKeyboardMarkup,
LabeledPrice,
)

from .base import BaseContent

Expand Down Expand Up @@ -89,6 +92,6 @@ def __init__(
send_email_to_provider: Optional[bool] = ...,
is_flexible: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[InlineKeyboardMarkup] = ...,
) -> None: ...
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
heading: Optional[int] = ...,
proximity_alert_radius: Optional[int] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/media_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ def __init__(
],
business_connection_id: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
) -> None: ...
48 changes: 42 additions & 6 deletions aiogram_broadcaster/contents/message.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
from typing import TYPE_CHECKING, Any, List, Optional, Union
from typing import TYPE_CHECKING, List, Optional, Union

from aiogram.client.default import Default
from aiogram.methods import CopyMessage, ForwardMessage, TelegramMethod
from aiogram.methods import (
CopyMessage,
ForwardMessage,
SendAnimation,
SendAudio,
SendContact,
SendDice,
SendDocument,
SendLocation,
SendMessage,
SendPhoto,
SendPoll,
SendSticker,
SendVenue,
SendVideo,
SendVideoNote,
SendVoice,
)
from aiogram.types import (
ForceReply,
InlineKeyboardMarkup,
Expand Down Expand Up @@ -48,10 +65,10 @@ def __init__(
*,
message: Message,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down Expand Up @@ -82,7 +99,7 @@ def __init__(
*,
message: Message,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
) -> None: ...


Expand All @@ -93,7 +110,26 @@ class MessageSendContent(BaseContent):
business_connection_id: Optional[str] = None
parse_mode: Optional[str] = None

async def __call__(self, chat_id: int) -> TelegramMethod[Any]:
async def __call__(
self,
chat_id: int,
) -> Union[
ForwardMessage,
SendAnimation,
SendAudio,
SendContact,
SendDocument,
SendLocation,
SendMessage,
SendPhoto,
SendPoll,
SendDice,
SendSticker,
SendVenue,
SendVideo,
SendVideoNote,
SendVoice,
]:
return self.message.send_copy(
chat_id=chat_id,
disable_notification=self.disable_notification,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def __init__(
photo: Union[InputFile, str],
business_connection_id: Optional[str] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
has_spoiler: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
15 changes: 11 additions & 4 deletions aiogram_broadcaster/contents/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from aiogram.types import (
ForceReply,
InlineKeyboardMarkup,
InputPollOption,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
Expand All @@ -16,8 +17,10 @@

class PollContent(BaseContent):
question: str
options: List[str]
options: List[Union[InputPollOption, str]]
business_connection_id: Optional[str] = None
question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
question_entities: Optional[List[MessageEntity]] = None
is_anonymous: Optional[bool] = None
type: Optional[str] = None
allows_multiple_answers: Optional[bool] = None
Expand Down Expand Up @@ -45,6 +48,8 @@ async def __call__(self, chat_id: int) -> SendPoll:
question=self.question,
options=self.options,
business_connection_id=self.business_connection_id,
question_parse_mode=self.question_parse_mode,
question_entities=self.question_entities,
is_anonymous=self.is_anonymous,
type=self.type,
allows_multiple_answers=self.allows_multiple_answers,
Expand All @@ -66,20 +71,22 @@ def __init__(
self,
*,
question: str,
options: List[str],
options: List[Union[InputPollOption, str]],
business_connection_id: Optional[str] = ...,
question_parse_mode: Optional[Union[str, Default]] = ...,
question_entities: Optional[List[MessageEntity]] = ...,
is_anonymous: Optional[bool] = ...,
type: Optional[str] = ..., # noqa: A002
allows_multiple_answers: Optional[bool] = ...,
correct_option_id: Optional[int] = ...,
explanation: Optional[str] = ...,
explanation_parse_mode: Optional[str] = ...,
explanation_parse_mode: Optional[Union[str, Default]] = ...,
explanation_entities: Optional[List[MessageEntity]] = ...,
open_period: Optional[int] = ...,
close_date: Optional[Union[datetime, timedelta, int]] = ...,
is_closed: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
business_connection_id: Optional[str] = ...,
emoji: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
6 changes: 3 additions & 3 deletions aiogram_broadcaster/contents/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def __init__(
*,
text: str,
business_connection_id: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
entities: Optional[List[MessageEntity]] = ...,
link_preview_options: Optional[LinkPreviewOptions] = ...,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
google_place_id: Optional[str] = ...,
google_place_type: Optional[str] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def __init__(
height: Optional[int] = ...,
thumbnail: Optional[InputFile] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
has_spoiler: Optional[bool] = ...,
supports_streaming: Optional[bool] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
2 changes: 1 addition & 1 deletion aiogram_broadcaster/contents/video_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
length: Optional[int] = ...,
thumbnail: Optional[InputFile] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions aiogram_broadcaster/contents/voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def __init__(
voice: Union[InputFile, str],
business_connection_id: Optional[str] = ...,
caption: Optional[str] = ...,
parse_mode: Optional[str] = ...,
parse_mode: Optional[Union[str, Default]] = ...,
caption_entities: Optional[List[MessageEntity]] = ...,
duration: Optional[int] = ...,
disable_notification: Optional[bool] = ...,
protect_content: Optional[bool] = ...,
protect_content: Optional[Union[bool, Default]] = ...,
reply_markup: Optional[
Union[
InlineKeyboardMarkup,
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
authors = [
{ name = "LORES" },
{ name = "LORES" }
]
dependencies = [
"aiogram>=3.4.0"
"aiogram>=3.6.0"
]

[project.urls]
Expand All @@ -26,13 +26,13 @@ dev = [
"types-aiofiles>=23.2.0"
]
redis = [
"redis[hiredis]>=5.0.0",
"redis[hiredis]>=5.0.0"
]
mongo = [
"motor>=3.0.0"
]
sqlalchemy = [
"SQLAlchemy>=2.0.0",
"SQLAlchemy>=2.0.0"
]

[tool.hatch.version]
Expand Down

0 comments on commit 741cc2d

Please sign in to comment.