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

telegram-cli -e with several commands #934

Open
triflan opened this issue Jan 15, 2016 · 11 comments
Open

telegram-cli -e with several commands #934

triflan opened this issue Jan 15, 2016 · 11 comments

Comments

@triflan
Copy link

triflan commented Jan 15, 2016

telegram-cli -e argument works with several commands?
Something like this:
telegram-cli -e 'add contact phone_number name surname msg surname_name hello'

There is a way to use -e argument to send a msg to a phone number and exit?

(thank you)

@beMoD
Copy link

beMoD commented Jan 15, 2016

Hi,

you can use telegram-cli -e "add contact phone_number name surname\nmsg surname_name hello"

HTH,
beMoD

@triflan
Copy link
Author

triflan commented Jan 15, 2016

Doesn't work. Output:

FAIL: 38: too many args #3
All done. Exit
halt

It seems doesn't understand \n as Line Feed (I have also tryied things like \n /\n ^J)

On the other hand, msg command works (for me) as msg name_surname text and no with surname_name

@beMoD
Copy link

beMoD commented Jan 15, 2016

Did you use the double quotes and not the single quotes as in your example? \n is only interpretet between two ".

The other thing about surname_name <> name_surname happened, because I just copied your example and didn't pay attention to the notation ;-)

@triflan
Copy link
Author

triflan commented Jan 15, 2016

Yes and (in my case) the result was the same.
Anyway, I have change the code to use ';' as command separator and another problem arises:
msg peer text fails in arg parsing because (I think) add_contact is not yet executed: first is made the parsing of the commands and after that the execution.

@triflan
Copy link
Author

triflan commented Jan 15, 2016

In any case the application is great

@beMoD
Copy link

beMoD commented Jan 16, 2016

It's really hard to help you with you giving so few information on what you are doing, which commands you are executing and what results you get, sorry.

@luckydonald
Copy link

It should split it on '\n'
See for yourself: loop.c:784 @2052f4

@and7ey
Copy link

and7ey commented Mar 26, 2016

I also would like to send multiple commands with -e argument, but it doesn't work:

./telegram-cli -W -e "msg user#1234567 hi \n msg user#1234567 how are you"

I am on OSX.

@gabeio
Copy link

gabeio commented Nov 28, 2016

./telegram-cli -f --json -e "contact_list\nhistory @<username> 100" > dump.txt

outputs:

[warn] kq_init: detected broken kqueue; not using.: Inappropriate ioctl for device
Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman
Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show_license' for details.
Telegram-cli uses libtgl version 2.1.0
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
I: config dir=[/Volumes/MacHDD/Users/gabeio/.telegram-cli]
> {"result": "FAIL", "error_code": 78, "error": "can not find command 'contact_list\\nhistory'"}
All done. Exit
halt

clearly the \n is not being parsed properly on macOS/OSX since it's changing from \n to \\n

if I add spaced around \n it then thinks that \n is the next part of contact_list <something> which contact_list has no args

@ailinykh
Copy link

Here is working solution (at least for mac os)

@Paulchen232
Copy link

Paulchen232 commented Jan 15, 2019

@triflan
Hallo triflan!

I have change the code to use ';' as command separator

Can you send me this Code-Change? (My Telegram username is @goossi)

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

No branches or pull requests

7 participants