EzTg package

Submodules

EzTg.inlinekeyboard module

class EzTg.inlinekeyboard.InlineKeyboard[source]

Bases: object

callback(text, callback_data)[source]

Add a new callback button to the keyboard.

Parameters

textstr

The text of the button

callback_datastr

The callback data of the button

callback_new_row(text, callback_data)[source]

Add a new callback button to the keyboard in a new row.

Parameters

textstr

The text of the button

callback_datastr

The callback data of the button

send()[source]

Return the keyboard.

url(text, url)[source]

Add a new url button to the keyboard.

Parameters

textstr

The text of the button

urlstr

The url of the button

url_new_row(text, url)[source]

Add a new url button to the keyboard in a new row.

Parameters

textstr

The text of the button

urlstr

The url of the button

EzTg.main module

class EzTg.main.Parse[source]

Bases: dict

class EzTg.main.TelegramClient(token)[source]

Bases: object

async copyMessage(chat_id, message_id, caption=None, disable_notification=False, reply_to_message_id=None, allow_sending_without_reply=False, reply_markup=None)[source]

Copy a message.

Parameters

chat_id: int

The chat id you want to forward the message to.

message_id: int

The message id you want to forward.

caption: str

The caption you want to send.

disable_notification: bool

Sends the message silently. Users will receive a notification with no sound.

reply_to_message_id: int

If the message is a reply, ID of the original message.

allow_sending_without_reply: bool

Pass True, if the message should be sent even if the specified replied-to message is not found.

reply_markup: InlineKeyboard.send

Additional interface options. Use the InlineKeyboard class to create a keyboard and use the send method to send it.

Create a chat invite link.

Parameters

chat_id: int

The chat id you want to make the invite link.

name: str

The name of the invite link.

expire_date: int

The expire date of the invite link.

member_limit: int

The member limit of the invite link.

creates_join_request: bool

Pass True, if the link should be created without a chat member limit.

async deleteMessage(chat_id, message_id)[source]

Delete a message.

Parameters

chat_id: int

The chat id you want to delete the message from.

message_id: int

The message id you want to delete.

async editMessageText(chat_id, message_id, text, inline_message_id=None, parse_mode='Markdown', entities=None, disable_web_page_preview=False, reply_markup=None)[source]

Edit a message.

Parameters

chat_id: int

The chat id you want to edit the message from.

message_id: int

The message id you want to edit.

text: str

The text you want to send.

inline_message_id: int

The inline message id you want to edit.

parse_mode: str

The parse mode you want to use.

entities: list

List of special entities that appear in message text, which can be specified instead of parse_mode.

disable_web_page_preview: bool

Disable link previews for links in this message.

reply_markup: InlineKeyboard.send

Additional interface options. Use the InlineKeyboard class to create a keyboard and use the send method to send it.

Export a chat invite link.

Parameters

chat_id: int

The chat id you want to make the invite link.

async forwardMessage(chat_id, from_chat_id, message_id, disable_notification=False)[source]

Foward a message.

Parameters

chat_id: int

The chat id you want to forward the message to.

from_chat_id: int

The chat id you want to forward the message from.

message_id: int

The message id you want to forward.

disable_notification: bool

Sends the message silently. Users will receive a notification with no sound.

async getMe()[source]

Get information about the bot.

async get_author_id(message)[source]

Get author id from message.

Parameters

message: dict

The message object.

async get_chat_id(message)[source]

Get chat id from message.

Parameters

message: dict

The message object.s

async leaveChat(chat_id)[source]

Leave a chat.

Parameters

chat_id: int

The chat id you want to leave.

async pinChatMessage(chat_id, message_id, disable_notification=False)[source]

Pin a message.

Parameters

chat_id: int

The chat id you want to pin the message.

message_id: int

The message id you want to pin.

disable_notification: bool

Sends the message silently. Users will receive a notification with no sound.

async send(method, **kwargs)[source]

Send a request to the telegram api.

Parameters

method: str

The method you want to use.

**kwargs: dict

The parameters you want to send to the method.

async sendMessage(chat_id, text, parse_mode='Markdown', disable_web_page_preview=False, disable_notification=False, reply_to_message_id=None, reply_markup=None)[source]

Send a message to a chat.

Parameters

chat_id: int

The chat id you want to send the message to.

text: str

The text you want to send.

parse_mode: str

The parse mode you want to use.

disable_web_page_preview: bool

Disable link previews for links in this message.

disable_notification: bool

Sends the message silently. Users will receive a notification with no sound.

reply_to_message_id: int

If the message is a reply, ID of the original message.

reply_markup: dict

Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

async setChatPhoto(chat_id, photo)[source]

Set the chat photo.

Parameters

chat_id: int

The chat id you want to set the photo.

photo: str

The photo you want to use.

async start_polling(callback, callback_query=None)[source]

Start polling for updates.

Parameters

callback: function

The function you want to call when a message is received.

callback_query: function

The function you want to call when a callback query is received.

async unpinChatMessage(chat_id, message_id)[source]

Unpin a message.

Parameters

chat_id: int

The chat id you want to unpin the message.

message_id: int

The message id you want to unpin.

exception EzTg.main.TokenError[source]

Bases: Exception

Module contents