telegram-s / telegram-api-old

Telegram Api library for java
MIT License
138 stars 64 forks source link

how can i send a photo message using ex3ndr library ? #41

Closed shokri-navid closed 8 years ago

shokri-navid commented 8 years ago

i am using this library to create a Telegram messenger and i work nice but now i want to sent a message to a contact witch has a photo as content of message. i am using this code snippet :

    TLInputPhoto p = new TLInputPhoto() ;
    TLInputMediaPhoto photo = new TLInputMediaPhoto() ;
    photo.setId(p); 
    try {
        File file = new File("d:\\test.jpg") ;
        InputStream input = new FileInputStream(file) ;
        photo.deserialize(input,api.getApiContext());
    }catch (Exception ex){
        System.out.println(ex.getMessage());
    }
        api.doRpcCall(new TLRequestMessagesSendMedia(new TLInputPeerContact(u.getUserId()),photo,123564789)) ;
    String s = "" ;

but i am getting wrong classid exception. how can i do this job?

shokri-navid commented 8 years ago

i find solution of my question in this url: https://github.com/ex3ndr/telegram-bot/blob/master/app/src/main/java/org/telegram/bot/Application.java