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

Command Line Argument - CLI issue #48

Closed
nixjobin opened this issue Jan 29, 2014 · 13 comments
Closed

Command Line Argument - CLI issue #48

nixjobin opened this issue Jan 29, 2014 · 13 comments

Comments

@nixjobin
Copy link

Hi,
From command line, The messages are not going. Interactive is working fine.

echo "msg Jobin_J hello" |./telegram -k tg.pub
Telegram-client version 0.01-beta, Copyright (C) 2013 Vitaly Valtman
Telegram-client comes with ABSOLUTELY NO WARRANTY; for details type show_license'. This is free software, and you are welcome to redistribute it under certain conditions; typeshow_license' for details.

msg Jobin_J hello
Bad user/chat id
User Jobin J: 3 unread

@vysheng
Copy link
Owner

vysheng commented Jan 29, 2014

Yep, this is because you try to send message, before contacts were loaded. You have two options: use "msg user# ..." instead (it will work only if you are this user's contact) or you can use binlog ([-B] key).

@nixjobin
Copy link
Author

Hi Vysheng,

Thanks for the reply. Yes, the contact is in my contact. So itred the below and its not working

msg 965XXXXXXXX hello | ./telegram
msg +965XXXXXXXX hello | ./telegram
msg 00965XXXXXXXX hello | ./telegram

All of them giving the same error. "Bad user/chat id"

Thanks,

  • Jobin

@vysheng
Copy link
Owner

vysheng commented Jan 29, 2014

You can see user_id this way: in tg use command contact_list. There would be lines like this: User #271912: X Y (X_Y 7901...) offline. Was online [2013/11/20 17:26:37]

#271912 in this case is user_id. So you should send msg by command "msg user#271912 text"

@nixjobin
Copy link
Author

Hi Vysheng,,

Yep. That did the Job, Thanks for the explanation.

@vysheng
Copy link
Owner

vysheng commented Jan 29, 2014

Welcome.

@cryptid11
Copy link

For this:

msg Telegram_Notifications hello | ./telegram

It gives me: "command not found".

Like if it can't load the contacts in time...any solution?

@stillru
Copy link
Contributor

stillru commented Oct 15, 2014

msg Telegram_Notifications hello | ./bin/telegram-cli -k server.pub -e

@stillru
Copy link
Contributor

stillru commented Oct 15, 2014

./bin/telegram-cli -k server.pub -e msg Telegram_Notifications hello
Read about -e key

@vysheng
Copy link
Owner

vysheng commented Oct 15, 2014

@cryptid11
Probably you want to use '-W' key or enable binlog
Also it may be useful to use '-R'

@vysheng
Copy link
Owner

vysheng commented Oct 15, 2014

Oh, and ./telegram is very old binary. New binary is bin/telegram-cli

@cryptid11
Copy link

all 2 ways from @stillru doesn't works for me.

here options:
telegram-cli Usage
-u specify username (would not be asked during authorization)
-k specify location of public key (possible multiple entries)
-v increase verbosity (0-ERROR 1-WARNIN 2-NOTICE 3+-DEBUG-levels)
-N message num mode
-c config file name
-p use specified profile
-l log level
-f during authorization fetch all messages since registration
-E disable auto accept of encrypted chats
-s lua script file
-W send dialog_list query and wait for answer before reading input
-C disable color output
-R disable readline
-d daemon mode
-L log file name
-U change uid after start
-G change gid after start
-D disable output
-P port to listen for input commands
-S unix socket to create
-e make commands end exit
-I use user and chat IDs in updates instead of names

seems that the -e option doesn't works...what's wrong @vysheng ?

When I run:

./bin/telegram-cli -k server.pub -e msg Telegram_Notifications hello

It tells me:

I: config dir=[/home/cryptid11/.telegram-cli]
All done. Exit
halt

@vysheng
Copy link
Owner

vysheng commented Oct 18, 2014

Try ./bin/telegram-cli -k server.pub -WR -e msg Telegram_Notifications hello

UPD my bad. ./bin/telegram-cli -k server.pub -WR -e "msg Telegram_Notifications hello"

@cryptid11
Copy link

Still doesn't works but only because @vysheng change the name "Telegram_Notifications" to "Telegram", and then forgot it.

Infact, this command works:

./bin/telegram-cli -k server.pub -WR -e "msg Telegram hello"

Excuse @vysheng I can't resist to kid you a little 👶

Please try your commands before posting! 🌴

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

4 participants