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

feat: add sending message option and command to anyone for better experience and automation flow #269

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Msameim181
Copy link

feature: adding sending message option and command to anyone for a better experience and automation flow.

$ telegram-message "Hello, world!"

$ telegram-message "Hello, world!" -to 123456789

$ telegram-message "Hello, <i>world</i>!" -pm html

…ding them

This commit adds a new class called TelegramMessageClient to the telegram_upload/client/telegram_message_client.py file. The class extends the TelegramClient class from the telethon library and provides methods for sending messages and forwarding them to multiple destinations.

The TelegramMessageClient class includes the following methods:
- forward_to: Forwards a message to multiple destinations.
- send_one_message: Sends a single message to an entity with optional retries and parse mode.
- send_messages: Sends multiple messages to an entity with optional parse mode and forwarding.

This new functionality improves the experience and automation flow for sending messages using the Telegram API.
This commit adds the TelegramMessageClient class to the TelegramManagerClient, allowing for sending messages and forwarding them. This enhances the functionality and automation flow of the application.

Refactor the TelegramManagerClient class to inherit from TelegramUploadClient, TelegramDownloadClient, and TelegramMessageClient.
Add the option to forward messages to a chat or user by specifying the alias, id, username, mobile, or id. This option can be used multiple times.

Refactor the `message` function in `telegram_upload/management.py` to include the new `forward` option. The function now accepts the `forward` option as a command-line argument and passes it to the `send_messages` method of the `TelegramManagerClient` class.

This commit also includes a minor fix to handle the `parse_mode` option when it is set to 'text'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant