This is deep re-writed version of old script:
-
more commands, to configurate bot, send messages or/and documents
-
writed to work in shell, so can take arguments from output of other shell commands
-
or can be imported as python module
-
help (-h/--help) for each command and globally and in python help function
How to setup tgsend
-
git clone
-
make sure that you have requests lib installed globally, or modify shebang
-
chmod +x tgsend.py
-
add link to file in your bin folde
-
get api-key from BotFather
-
tgsend create -A api-key
-
send any message to bot (to create chat)
-
get chat id using tgsend getid, store it in your environment (contacts file editor will be added, probably soon)
Usage:
tgsend send [-h] [-A <API-key>] (-T <chat id> | -t <chat name>) [-m message [message ...]] [-d file [file ...]] [-a audiofile [audiofile ...]
Or:
from tgsend import message_handler
message_handler(api_key = <API-key>, chat_id = <chat id>, messages = ["message", "message])