vysheng / tg

telegram-cli
GNU General Public License v2.0
6.48k stars 1.53k forks source link

[Q] How to send one message from cli ? #518

Open flyingrub opened 9 years ago

flyingrub commented 9 years ago

hi, in my case i only need to send one msg sometimes (to notify me of somethings). I would like to launch it from a python / bash / ruby script. What is the simplest way to send only one message, without creating daemon, lua script ect ? I've seen a lot of thing in bash bur none worked :/ it would be great if we could launch only one command without opening the pseudo shell.

luckydonald commented 9 years ago

have a look at the -e parameter.

flyingrub commented 9 years ago

Thanks, i will try it :)

Also why is there no docs for the differents options of the telegram-cli ?

flyingrub commented 9 years ago

there is an issue, the -W option is executed after the -e one, so i can't send message to any groupchat with this options.

LukeLR commented 9 years ago

There is a documentation, try telegram-cli -h, it will print all it's arguments ;) I am not Shure, but the issue that telegram is unable to send messages to users it hasn't messaged before is maybe fixed in the test branch. You should probably download that one and give it a try ;)

On 12 May 2015, at 6:03 pm, Ronan Nello notifications@github.com wrote:

there is an issue, the -W option is executed after the -e one, so i can't send message to any groupchat with this options.

— Reply to this email directly or view it on GitHub.

jonnywilliamson commented 9 years ago

Are you using the TEST branch?

I think the requirement for -W on the command line before it will send a message with -e is not required anymore.

flyingrub commented 9 years ago

i've found this workaround, (sleep 5; echo "msg user msg") | telegram-cli -W, i use the master one.

gnumoksha commented 9 years ago

@flyingrub I have better experience using this:

./telegram-cli -k tg-server.pub -WR -e "msg $USER $TEXT"

eg.:

./telegram-cli -k tg-server.pub -WR -e "msg user#1234567 hi"

See