Поправил преобразование сообщения

This commit is contained in:
Struchkov Mark 2022-07-04 09:40:31 +03:00
parent dc7f1cf767
commit af627cd7b7
4 changed files with 10 additions and 4 deletions

View File

@ -5,7 +5,7 @@
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>telegram-bot</artifactId> <artifactId>telegram-bot</artifactId>
<version>0.0.9</version> <version>0.0.10</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
@ -33,8 +33,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<godfather.core.ver>0.0.7</godfather.core.ver> <godfather.core.ver>0.0.8</godfather.core.ver>
<telegrambots.ver>6.0.1</telegrambots.ver> <telegrambots.ver>6.1.0</telegrambots.ver>
<plugin.maven.compiler.ver>3.10.1</plugin.maven.compiler.ver> <plugin.maven.compiler.ver>3.10.1</plugin.maven.compiler.ver>
<plugin.nexus.staging.ver>1.6.13</plugin.nexus.staging.ver> <plugin.nexus.staging.ver>1.6.13</plugin.nexus.staging.ver>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>telegram-bot</artifactId> <artifactId>telegram-bot</artifactId>
<version>0.0.9</version> <version>0.0.10</version>
</parent> </parent>
<artifactId>telegram-core</artifactId> <artifactId>telegram-core</artifactId>

View File

@ -2,6 +2,7 @@ package dev.struchkov.godfather.telegram.convert;
import dev.struchkov.godfather.context.domain.content.Mail; import dev.struchkov.godfather.context.domain.content.Mail;
import org.telegram.telegrambots.meta.api.objects.CallbackQuery; import org.telegram.telegrambots.meta.api.objects.CallbackQuery;
import org.telegram.telegrambots.meta.api.objects.User;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -17,6 +18,10 @@ public class CallbackQueryConvert {
mail.setText(callbackQuery.getData()); mail.setText(callbackQuery.getData());
mail.setPersonId(callbackQuery.getMessage().getChatId()); mail.setPersonId(callbackQuery.getMessage().getChatId());
mail.setAddDate(LocalDateTime.now()); mail.setAddDate(LocalDateTime.now());
final User user = callbackQuery.getFrom();
mail.setFirstName(user.getFirstName());
mail.setLastName(user.getLastName());
return mail; return mail;
} }

View File

@ -34,6 +34,7 @@ public final class MessageMailConvert {
mail.setCreateDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(message.getDate()), ZoneId.systemDefault())); mail.setCreateDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(message.getDate()), ZoneId.systemDefault()));
mail.setFirstName(message.getChat().getFirstName()); mail.setFirstName(message.getChat().getFirstName());
mail.setLastName(message.getChat().getLastName()); mail.setLastName(message.getChat().getLastName());
final List<MessageEntity> entities = message.getEntities(); final List<MessageEntity> entities = message.getEntities();
if (entities != null) { if (entities != null) {
mail.setAttachments(convertAttachments(entities)); mail.setAttachments(convertAttachments(entities));