Telegram
This filter allows you to download files received from the Telegram feeder or send messages.
Note: it can be used only in a rule with the Telegram Feeder.
Parameters
The following parameters are required from this filter:
Parameter | Type | Default | Description |
---|---|---|---|
action | STRING | “send_message” | action to perform: “send_message”, “download_file” |
to | STRING | "" | used with action send_message , it has to contain the recipient of the message: username, @username, phone number with the country code (supports Golang templates) |
to_chatid | STRING | empty | the recipient of the message will be a chat |
filename | STRING | "" | specified the path of where to store the downloaded file: msg_filename in the extra will contain the name of the file (supports Golang templates) |
text | STRING | "" | the text of the file (supports Golang templates) |
Each action
can use different parameters:
action = send_message
Parameter | Type | Default | Description |
---|---|---|---|
to | STRING | "" | used with action send_message , it has to contain the recipient of the message: username, @username, phone number with the country code (supports Golang templates) |
to_chatid | STRING | empty | the recipient of the message will be a chat |
text | STRING | "" | the text of the file (supports Golang templates) |
action = download_file
Parameter | Type | Default | Description |
---|---|---|---|
filename | STRING | "" | specified the path of where to store the downloaded file: msg_filename in the extra will contain the name of the file (supports Golang templates) |
... | telegram(action="send_message", to="@username", text="the file '{{ .msg_filename }}' received from {{ .user_username }} has been downloaded.") | ...
Examples
telegramRule => <telegram: app_id="xxx", app_hash="yyyy", phone_number="+1123654789", session_folder="/tmp/sessions"> | text(target="chan_id", pattern="123456") | telegram(action="download_file", filename="/tmp/{{ .msg_filename }}") | telegram(action="send_message", to="@username", text="the file '{{ .msg_filename }}' received from {{ .user_username }} has been downloaded.")
telegramRule => <telegram: app_id="xxx", app_hash="yyyy", phone_number="+1123654789", session_folder="/tmp/sessions"> | text(target="main", pattern="help") | telegram(action="send_message", to="{{ .user_username }}", text="Hi {{ .user_username }}! You wrote the following message: {{ .main }}.")