Исправил срабатывание бота на уведомления в групповых чатах
This commit is contained in:
parent
bf8ba844cf
commit
35167a00d2
2
pom.xml
2
pom.xml
@ -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.17</version>
|
<version>0.0.18</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -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.17</version>
|
<version>0.0.18</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegram-core</artifactId>
|
<artifactId>telegram-core</artifactId>
|
||||||
|
@ -38,9 +38,11 @@ public class EventDistributorService implements EventDistributor {
|
|||||||
public void processing(@NotNull Update update) {
|
public void processing(@NotNull Update update) {
|
||||||
if (update.getMessage() != null) {
|
if (update.getMessage() != null) {
|
||||||
final Message message = update.getMessage();
|
final Message message = update.getMessage();
|
||||||
|
if (!isEvent(message)) {
|
||||||
getEventProvider(Mail.TYPE)
|
getEventProvider(Mail.TYPE)
|
||||||
.ifPresent(eventProviders -> eventProviders.forEach(eventProvider -> eventProvider.sendEvent(MessageMailConvert.apply(message))));
|
.ifPresent(eventProviders -> eventProviders.forEach(eventProvider -> eventProvider.sendEvent(MessageMailConvert.apply(message))));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (update.getCallbackQuery() != null) {
|
if (update.getCallbackQuery() != null) {
|
||||||
final CallbackQuery callbackQuery = update.getCallbackQuery();
|
final CallbackQuery callbackQuery = update.getCallbackQuery();
|
||||||
getEventProvider(Mail.TYPE)
|
getEventProvider(Mail.TYPE)
|
||||||
@ -59,6 +61,19 @@ public class EventDistributorService implements EventDistributor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isEvent(Message message) {
|
||||||
|
return message.getChannelChatCreated() != null
|
||||||
|
|| message.getDeleteChatPhoto() != null
|
||||||
|
|| message.getNewChatMembers() != null
|
||||||
|
|| message.getNewChatTitle() != null
|
||||||
|
|| message.getNewChatPhoto() != null
|
||||||
|
|| message.getVideoChatEnded() != null
|
||||||
|
|| message.getVideoChatParticipantsInvited() != null
|
||||||
|
|| message.getVideoChatScheduled() != null
|
||||||
|
|| message.getVideoNote() != null
|
||||||
|
|| message.getVideoChatStarted() != null;
|
||||||
|
}
|
||||||
|
|
||||||
private Optional<List<EventProvider>> getEventProvider(String type) {
|
private Optional<List<EventProvider>> getEventProvider(String type) {
|
||||||
return Optional.ofNullable(eventProviderMap.get(type));
|
return Optional.ofNullable(eventProviderMap.get(type));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user