domenica 19 aprile 2015

Client Telegram

Aggiornare il sistema
sudo apt-get update
Dipendenze
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make  
mkdir telegram
cd telegram/
git clone --recursive https://github.com/vysheng/tg.git && cd tg
./configure
make
nella directory telegram creare lo script:  send_message.sh contenente:

#!/bin/bash
  to=$1
  msg=$2
  tgpath=*****DIRECTORY*****/telegram/tg
  cd ${tgpath}
  (sleep 5; echo "msg $to $msg"; sleep 2; echo "safe_quit") | ${tgpath}/bin/telegram-cli -k tg-server.pub -W

Per configurare il numero di cellulare:

******DIR******/telegram/tg/bin/telegram-cli -k tg-server.pub -W

dopo aver ottenuto il prompt:

Telegram-cli version 1.2.0, 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 1.2.0
I: config dir=[/home/alfredo/.telegram-cli]
>
mandare un messaggio ad un utente (anche a te stesso):

msg Alfredo_Salzillo test
attendere che venga chiesto il numero di cellulare: inserirlo anteponendo +39xxxxxxxxx
e prendere il codice che viene mandato sul cellulare e inserirlo alla richiesta successiva. Poi si può anche uscire con quit.

Fatto questo si può anche usare lo script per mandare i messaggi usando:

./send_message.sh Alfredo_Salzillo Test123




Nessun commento:

Posta un commento