Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle v0.3.2 #17

Merged
merged 3 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion EzTg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,19 @@ async def forwardMessage(self,
async def getMe(self):
"""Get information about the bot."""
r = await self.send("getMe")
user = User(r["id"], r["is_bot"], r["first_name"], r["last_name"], r["username"], r["language_code"], r["is_premium"], r["added_to_attachment_menu"], r["can_join_groups"], r["can_read_all_group_messages"], r["supports_inline_queries"])
user = User(
r["id"],
r["is_bot"],
r["first_name"],
r["last_name"],
r["username"],
r["language_code"],
r["is_premium"],
r["added_to_attachment_menu"],
r["can_join_groups"],
r["can_read_all_group_messages"],
r["supports_inline_queries"],
)
return user

async def copyMessage(
Expand Down
66 changes: 57 additions & 9 deletions EzTg/replykeyboardmarkup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
class ReplyKeyboardMarkup:
def __init__(self, is_persistent=False, resize_keyboard=False, one_time_keyboard=False, selective=False, input_field_placeholder=None):

def __init__(
self,
is_persistent=False,
resize_keyboard=False,
one_time_keyboard=False,
selective=False,
input_field_placeholder=None,
):
self.keyboard = [[]]
self.is_persistent = is_persistent
self.resize_keyboard = resize_keyboard
self.one_time_keyboard = one_time_keyboard
self.selective = selective

def add(self, text, request_user=None, request_chat=None, request_contact=False, request_location=False, request_poll=False, web_app=None):
self.keyboard[-1].append({"text": text, "request_user": request_user, "request_chat": request_chat, "request_contact": request_contact, "request_location": request_location, "request_poll": request_poll, "web_app": web_app})

def add_new_row(self, text, request_user=None, request_chat=None, request_contact=False, request_location=False, request_poll=False, web_app=None):

def add(
self,
text,
request_user=None,
request_chat=None,
request_contact=False,
request_location=False,
request_poll=False,
web_app=None,
):
self.keyboard[-1].append({
"text": text,
"request_user": request_user,
"request_chat": request_chat,
"request_contact": request_contact,
"request_location": request_location,
"request_poll": request_poll,
"web_app": web_app,
})

def add_new_row(
self,
text,
request_user=None,
request_chat=None,
request_contact=False,
request_location=False,
request_poll=False,
web_app=None,
):
self.keyboard.append([])
self.keyboard[-1].append({"text": text, "request_user": request_user, "request_chat": request_chat, "request_contact": request_contact, "request_location": request_location, "request_poll": request_poll, "web_app": web_app})

self.keyboard[-1].append({
"text": text,
"request_user": request_user,
"request_chat": request_chat,
"request_contact": request_contact,
"request_location": request_location,
"request_poll": request_poll,
"web_app": web_app,
})

def send(self):
return {"reply_markup_keyboard": self.keyboard, "is_persistent": self.is_persistent, "resize_keyboard": self.resize_keyboard, "one_time_keyboard": self.one_time_keyboard, "selective": self.selective}
return {
"reply_markup_keyboard": self.keyboard,
"is_persistent": self.is_persistent,
"resize_keyboard": self.resize_keyboard,
"one_time_keyboard": self.one_time_keyboard,
"selective": self.selective,
}