Skip to content

Commit

Permalink
معليش
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Jun 29, 2024
1 parent 637b54d commit e2d1ea7
Showing 1 changed file with 91 additions and 76 deletions.
167 changes: 91 additions & 76 deletions tgram/bound.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
import inspect
import sys
import tgram

from typing import Union, List
from tgram import sync
from tgram.types import (
InputFile,
InputMedia,
Message,
MessageEntity,
LinkPreviewOptions,
InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ForceReply,
ReplyParameters,
MessageId,
)


class MessageB:
async def reply_text(
self: Message,
self: "tgram.types.Message",
text: str,
parse_mode: str = None,
entities: List[MessageEntity] = None,
link_preview_options: LinkPreviewOptions = None,
entities: List["tgram.types.MessageEntity"] = None,
link_preview_options: "tgram.types.LinkPreviewOptions" = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ForceReply,
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_message(
chat_id=self.chat.id,
text=text,
Expand All @@ -53,20 +41,23 @@ async def reply_text(
)

async def reply_photo(
self: Message,
photo: Union[InputFile, str],
self: "tgram.types.Message",
photo: Union["tgram.types.InputFile", str],
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_photo(
self.chat.id,
photo=photo,
Expand All @@ -87,22 +78,25 @@ async def reply_photo(
)

async def reply_audio(
self: Message,
audio: Union[InputFile, str],
self: "tgram.types.Message",
audio: Union["tgram.types.InputFile", str],
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
duration: int = None,
performer: str = None,
title: str = None,
thumbnail: Union[InputFile, str] = None,
thumbnail: Union["tgram.types.InputFile", str] = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_audio(
self.chat.id,
audio=audio,
Expand All @@ -125,20 +119,23 @@ async def reply_audio(
)

async def reply_document(
self: Message,
document: Union[InputFile, str],
thumbnail: Union[InputFile, str] = None,
self: "tgram.types.Message",
document: Union["tgram.types.InputFile", str],
thumbnail: Union["tgram.types.InputFile", str] = None,
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
disable_content_type_detection: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_document(
self.chat.id,
document=document,
Expand All @@ -159,25 +156,28 @@ async def reply_document(
)

async def reply_video(
self: Message,
video: Union[InputFile, str],
self: "tgram.types.Message",
video: Union["tgram.types.InputFile", str],
duration: int = None,
width: int = None,
height: int = None,
thumbnail: Union[InputFile, str] = None,
thumbnail: Union["tgram.types.InputFile", str] = None,
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
supports_streaming: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_video(
self.chat.id,
video=video,
Expand All @@ -203,24 +203,27 @@ async def reply_video(
)

async def reply_animation(
self: Message,
animation: Union[InputFile, str],
self: "tgram.types.Message",
animation: Union["tgram.types.InputFile", str],
duration: int = None,
width: int = None,
height: int = None,
thumbnail: Union[InputFile, str] = None,
thumbnail: Union["tgram.types.InputFile", str] = None,
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_animation(
self.chat.id,
animation=animation,
Expand All @@ -245,19 +248,22 @@ async def reply_animation(
)

async def reply_voice(
self: Message,
voice: Union[InputFile, str],
self: "tgram.types.Message",
voice: Union["tgram.types.InputFile", str],
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
duration: int = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_voice(
self.chat.id,
voice=voice,
Expand All @@ -277,18 +283,21 @@ async def reply_voice(
)

async def reply_video_note(
self: Message,
video_note: Union[InputFile, str],
self: "tgram.types.Message",
video_note: Union["tgram.types.InputFile", str],
duration: int = None,
length: int = None,
thumbnail: Union[InputFile, str] = None,
thumbnail: Union["tgram.types.InputFile", str] = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_video_note(
self.chat.id,
video_note=video_note,
Expand All @@ -307,12 +316,12 @@ async def reply_video_note(
)

async def reply_media_group(
self: Message,
media: List[InputMedia],
self: "tgram.types.Message",
media: List["tgram.types.InputMedia"],
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_media_group(
self.chat.id,
media=media,
Expand All @@ -327,7 +336,7 @@ async def reply_media_group(
)

async def reply_location(
self: Message,
self: "tgram.types.Message",
latitude: float,
longitude: float,
horizontal_accuracy: float = None,
Expand All @@ -338,9 +347,12 @@ async def reply_location(
protect_content: bool = None,
message_effect_id: str = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.send_location(
self.chat.id,
latitude=latitude,
Expand All @@ -363,11 +375,11 @@ async def reply_location(
# TODO More soon

async def forward(
self: Message,
self: "tgram.types.Message",
chat_id: Union[int, str],
disable_notification: bool = None,
protect_content: bool = None,
) -> Message:
) -> "tgram.types.Message":
return await self._me.forward_message(
chat_id=chat_id,
from_chat_id=self.chat.id,
Expand All @@ -380,19 +392,22 @@ async def forward(
)

async def copy(
self: Message,
self: "tgram.types.Message",
chat_id: Union[int, str],
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
reply_parameters: ReplyParameters = None,
reply_parameters: "tgram.types.ReplyParameters" = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
"tgram.types.InlineKeyboardMarkup",
"tgram.types.ReplyKeyboardMarkup",
"tgram.types.ReplyKeyboardRemove",
"tgram.types.ForceReply",
] = None,
) -> MessageId:
) -> "tgram.types.MessageId":
return await self._me.copy_message(
chat_id=chat_id,
from_chat_id=self.chat.id,
Expand All @@ -411,12 +426,12 @@ async def copy(
)

@property
def id(self: Message) -> int:
def id(self: "tgram.types.Message") -> int:
return self.message_id

@property
def __reply_param(self) -> ReplyParameters:
return ReplyParameters(self.id)
def __reply_param(self) -> "tgram.types.ReplyParameters":
return tgram.types.ReplyParameters(self.id)


for name, obj in inspect.getmembers(sys.modules[__name__]):
Expand Down

0 comments on commit e2d1ea7

Please sign in to comment.