Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lisp-is-the-future/9b6913d602f1c7cc59003bcbe01a3a3e to your computer and use it in GitHub Desktop.
Save lisp-is-the-future/9b6913d602f1c7cc59003bcbe01a3a3e to your computer and use it in GitHub Desktop.
How to chat via telegram using command line
###############################
# install telegram-cli in ubuntu
###############################
cd # home folder
git clone --recursive https://github.com/vysheng/tg.git && cd tg
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev
cd tg
./configure --disable-openssl
make
# start with:
~/tg/bin/telegram-cli
# quit by
quit
##############################
# peer names or user names with empty space
##############################
# use '_' instead of SPC!!
# if you see error:
# "FAIL: 38: can not parse arg #1"
# then carefully look for typos - or you forgot to use '_'
###############################
# how to get rid of the annoying login logout notifications?
###############################
# https://github.com/vysheng/tg/issues/386
# https://github.com/vysheng/tg/issues/1451
# simple solution:
# start your session with:
~/tg/bin/telegram-cli -l 0 -k ~/tg/server.pub
# explanation:
# -l 0 log_level zero (eliminates notifications!)
# -k ~/tg/server.pub which public key to use
###############################
# list all peers
################################
contact_list
dialog_list
##############################
# list last N messages with a peer
##############################
history <peer> <N> # history Rommel_Martinez 10
###############################
# 1 to 1 chat with peer
###############################
# begin with
chat_with_peer <peer>
# quit with /exit or /quit
###############################
# send message to peer
###############################
msg <peer> "The message:\n newline - \" - if escaped characters not needed you can write without the double quotes"
###############################
# more commands:
###############################
# https://github.com/vysheng/tg
# https://www.systutorials.com/docs/linux/man/8-telegram-cli/
# https://medium.com/@weibeld/telegram-cli-cheatsheet-9944506eef0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment