mirror of
https://github.com/annimon-tutorials/Similar-Images-Bot.git
synced 2024-09-20 03:34:19 +03:00
Fix /del command
This commit is contained in:
parent
937103be94
commit
651ed41f2c
@ -32,7 +32,7 @@ import com.pengrad.telegrambot.response.SendResponse;
|
|||||||
public class BotHandler extends BaseBotHandler {
|
public class BotHandler extends BaseBotHandler {
|
||||||
|
|
||||||
private static final int RADIX = 36;
|
private static final int RADIX = 36;
|
||||||
private final Pattern delPattern = Pattern.compile("/del([^_]+)_(\\d+)");
|
private final Pattern delPattern = Pattern.compile("/del([^_]+)_([^-]+)");
|
||||||
private final Pattern comparePattern = Pattern.compile("/cmp([^-]+)_([^-]+)_(.*)");
|
private final Pattern comparePattern = Pattern.compile("/cmp([^-]+)_([^-]+)_(.*)");
|
||||||
|
|
||||||
private final ImageIndexer indexer;
|
private final ImageIndexer indexer;
|
||||||
@ -48,6 +48,7 @@ public class BotHandler extends BaseBotHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void handleUpdates(List<Update> updates) {
|
protected void handleUpdates(List<Update> updates) {
|
||||||
|
if (updates.isEmpty()) return;
|
||||||
final var removedPosts = processAdminCommands(updates);
|
final var removedPosts = processAdminCommands(updates);
|
||||||
processUpdates(updates, removedPosts);
|
processUpdates(updates, removedPosts);
|
||||||
}
|
}
|
||||||
@ -115,6 +116,7 @@ public class BotHandler extends BaseBotHandler {
|
|||||||
|
|
||||||
private void processUpdates(List<Update> updates, Set<Post> ignoredPosts) {
|
private void processUpdates(List<Update> updates, Set<Post> ignoredPosts) {
|
||||||
final List<Message> channelPosts = getChannelPostsWithPhotos(updates);
|
final List<Message> channelPosts = getChannelPostsWithPhotos(updates);
|
||||||
|
if (channelPosts.isEmpty()) return;
|
||||||
final var similarImagesInfos = new ArrayList<SimilarImagesInfo>();
|
final var similarImagesInfos = new ArrayList<SimilarImagesInfo>();
|
||||||
for (var post : channelPosts) {
|
for (var post : channelPosts) {
|
||||||
final var originalPost = new Post(post.chat().id(), post.messageId());
|
final var originalPost = new Post(post.chat().id(), post.messageId());
|
||||||
|
Loading…
Reference in New Issue
Block a user