a guest Mar 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # tg_send
- Send telegram messages from your shell.
- ## Install
- Add the content of tg_send.sh to your .bashrc/profile/bash_alias (the one you like the most).
- # to send a message use
- tg_send_msg $TG_USER_ID $MESSAGE
- # to send a file use
- tg_send_file $TG_USER_ID $FILE_LOCATION $OPTIONAL_CAPTION
- # you can get your user id from @userinfobot
- # you can use pipes
- echo "lololol" | tg_send_msg $TG_USER_ID
- # with files too
- echo "my contents!" | tg_send_file $TG_USER_ID $FILE_NAME $OPTIONAL_CAPTION
- ## Limitations
- 1. **Messages:** Telegram has a fixed message width limit of 4096 UTF-8 characters, and you can clearly see that there is no segmentation if message is too long. So beware.
- 2. **Files:** Telegram has a limit for photo size of 10MB, and 50MB of other types. Keep it in mind when using this script.
RAW Paste Data