Skip to content

Commit

Permalink
Merge pull request #19 from HexyeDEV/restyled/v0.3.2
Browse files Browse the repository at this point in the history
Restyle v0.3.2
  • Loading branch information
HexyeDEV authored Mar 5, 2023
2 parents 761b008 + 8a1d583 commit 06a5e4e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
18 changes: 11 additions & 7 deletions EzTg/chat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Chat:
"""Represents a telegram chat.
Attributes
----------
id: `int`
Expand Down Expand Up @@ -58,8 +58,9 @@ class Chat:
linked_chat_id: `int`
Optional. Unique identifier for the linked chat. Returned only in getChat.
location: `ChatLocation`
Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat."""

Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
"""

def __init__(self, data: dict):
self.id = data["id"]
self.type = data["type"]
Expand All @@ -70,10 +71,12 @@ def __init__(self, data: dict):
self.is_forum = data.get("is_forum")
self.photo = data.get("photo")
self.active_usernames = data.get("active_usernames")
self.emoji_status_custom_emoji_id = data.get("emoji_status_custom_emoji_id")
self.emoji_status_custom_emoji_id = data.get(
"emoji_status_custom_emoji_id")
self.bio = data.get("bio")
self.has_private_forwards = data.get("has_private_forwards")
self.has_restricted_voice_and_video_messages = data.get("has_restricted_voice_and_video_messages")
self.has_restricted_voice_and_video_messages = data.get(
"has_restricted_voice_and_video_messages")
self.join_to_send_messages = data.get("join_to_send_messages")
self.join_by_request = data.get("join_by_request")
self.description = data.get("description")
Expand All @@ -82,10 +85,11 @@ def __init__(self, data: dict):
self.permissions = data.get("permissions")
self.slow_mode_delay = data.get("slow_mode_delay")
self.message_auto_delete_time = data.get("message_auto_delete_time")
self.has_aggressive_anti_spam_enabled = data.get("has_aggressive_anti_spam_enabled")
self.has_aggressive_anti_spam_enabled = data.get(
"has_aggressive_anti_spam_enabled")
self.has_hidden_members = data.get("has_hidden_members")
self.has_protected_content = data.get("has_protected_content")
self.sticket_set_name = data.get("sticket_set_name")
self.can_set_sticker_set = data.get("can_set_sticker_set")
self.linked_chat_id = data.get("linked_chat_id")
self.location = data.get("location")
self.location = data.get("location")
10 changes: 5 additions & 5 deletions EzTg/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import aiohttp
import requests

from .user import User
from .chat import Chat
from .user import User


class Parse(dict):
Expand Down Expand Up @@ -406,7 +406,7 @@ async def get_sender_object(self, message) -> User:
----------
message: `dict`
The message object."""

sender = message["from"]
user = User(
sender["id"],
Expand All @@ -422,7 +422,7 @@ async def get_sender_object(self, message) -> User:

async def get_user_object(self, user) -> User:
"""Get user object from user dict.
Parameters
----------
user: `dict`
Expand Down Expand Up @@ -454,7 +454,7 @@ async def get_entity(self, entity_id) -> Chat:
Parameters
----------
entity_id: `int` or `str`
The entity id or username of the target supergroup or channel (in the format @channelusername)"""
The entity id or username of the target supergroup or channel (in the format @channelusername)
"""
raw = await self.send("getChat", chat_id=entity_id)
return await self.get_entity_object(raw)

2 changes: 1 addition & 1 deletion EzTg/replykeyboardmarkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def send(self):
"resize_keyboard": self.resize_keyboard,
"one_time_keyboard": self.one_time_keyboard,
"selective": self.selective,
}
}

0 comments on commit 06a5e4e

Please sign in to comment.