vysheng / tg

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

i cant use telegram cli python script note #1072

Open hra66 opened 8 years ago

hra66 commented 8 years ago

hi according to "https://github.com/vysheng/tg/wiki/Scripting-notes"

when i use bin/telegram-cli -Z my_script.py to run my python script , i have error telegram-cli invalid option -- z

how i can solve it? please help me.

efazati commented 8 years ago

my problem too!

hra66 commented 8 years ago

use lua script

On Sat, May 14, 2016 at 4:38 PM, Mohammad Efazati notifications@github.com wrote:

my problem too!

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vysheng/tg/issues/1072#issuecomment-219216855

LaFa777 commented 8 years ago

The solution of hra66 is temporarily best choice. Explanation: When trying to compile with python:

$ ./configure --disable-python
...bash
checking for python... enabled
checking for python build information... 
checking for python3.5... python3.5
checking for main in -lpython3.5... no
checking for main in -lpython3.5m... yes
  results of the Python check:
    Binary:      python3.5
    Library:     python3.5m
    Include Dir: /usr/local/include/python3.5m
...

Displays build error:

make
...
interface.c: In function ‘our_id_gw’:
interface.c:3090:5: error: incompatible type for argument 1 of ‘py_our_id’
     py_our_id (id);
     ^
In file included from interface.c:25:0:
python-tg.h:30:6: note: expected ‘int’ but argument is of type ‘tgl_peer_id_t’
 void py_our_id (int id);
      ^
make: *** [objs/interface.o] Ошибка 1

At the moment (temporarily) it's OK because the realization of function for python are not rewritten for the new interface.c. Example:

void our_id_gw (struct tgl_state *TLSR, tgl_peer_id_t id) {
  assert (TLSR == TLS);
  #ifdef USE_LUA
    lua_our_id (id);
  #endif
  #ifdef USE_PYTHON
    py_our_id (id);
  #endif
}

Function prototype for python

void py_our_id (int id);

Function prototype for lua:

void lua_our_id (tgl_peer_id_t id);

Solution:

  1. Wait new release
  2. Try to write a patch (The attempt was in this issue)
  3. Try to get older working version from git p.s. commit with new version interface.c