|
Как получить фото из user профиля в телеграмме?
|
|||
---|---|---|---|
#18+
Я написал бота он обрабатывает сообщения. Из сообщения я получаю ID юзера который это сообщение отослал например message.getFrom().getId(). Далее по этому id пытаюсь вытащить его фото с помощью объекта getUserProfilePhotos. Пример GetUserProfilePhotos getUserProfilePhotos = new GetUserProfilePhotos(); getUserProfilePhotos.setUserId(message.getFrom().getId()); getUserProfilePhotos.deserializeResponse("Вытаскиваем фото"); - проблема в последнем методе я не знаю что передавать вместо слов "Вытаскиваем фото". Вот полное описание метода getUserProfilePhotos.deserializeResponse. Кто не будь может с этим сталкивался что нужно передавать вместо параметра answer? public UserProfilePhotos deserializeResponse(String answer) throws TelegramApiRequestException { try { ApiResponse<UserProfilePhotos> result = (ApiResponse)OBJECT_MAPPER.readValue(answer, new TypeReference<ApiResponse<UserProfilePhotos>>() { }); if (result.getOk()) { return (UserProfilePhotos)result.getResult(); } else { throw new TelegramApiRequestException("Error getting user profile photos", result); } } catch (IOException var3) { throw new TelegramApiRequestException("Unable to deserialize response", var3); } } библиотеку использую <groupId>org.telegram</groupId> <artifactId>telegrambots</artifactId> <version>3.6.1</version> ... |
|||
:
Нравится:
Не нравится:
|
|||
19.02.2019, 02:46 |
|
|
start [/forum/topic.php?fid=59&msg=39775984&tid=2121470]: |
0ms |
get settings: |
9ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
39ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
1ms |
others: | 16ms |
total: | 135ms |
0 / 0 |