using icons in buttons
This commit is contained in:
parent
025c1d6560
commit
071a7199ad
@ -15,6 +15,7 @@ import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKe
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
||||
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -27,6 +28,10 @@ import static de.ph87.kleinanzeigen.api.JSON.objectMapper;
|
||||
@Slf4j
|
||||
public class Bot extends TelegramLongPollingBot {
|
||||
|
||||
private static final String ICON_CHECK = "✅";
|
||||
|
||||
private static final String ICON_REMOVE = "❌";
|
||||
|
||||
private static final long CHAT_ID = 101138682L;
|
||||
|
||||
private final DefaultBotSession session;
|
||||
@ -156,10 +161,10 @@ public class Bot extends TelegramLongPollingBot {
|
||||
final ArrayList<List<InlineKeyboardButton>> keyboard = new ArrayList<>();
|
||||
final ArrayList<InlineKeyboardButton> row = new ArrayList<>();
|
||||
if (offer.isRemember()) {
|
||||
addButton(row, "Nicht mehr merken", InlineCommand.UNREMEMBER, offer);
|
||||
addButton(row, ICON_CHECK + ICON_CHECK + ICON_CHECK + " Gemerkt " + ICON_CHECK + ICON_CHECK + ICON_CHECK, InlineCommand.UNREMEMBER, offer);
|
||||
} else {
|
||||
addButton(row, "Ignorieren", InlineCommand.IGNORE, offer);
|
||||
addButton(row, "Merken", InlineCommand.REMEMBER, offer);
|
||||
addButton(row, ICON_REMOVE + " Ignorieren", InlineCommand.IGNORE, offer);
|
||||
addButton(row, ICON_CHECK + " Merken", InlineCommand.REMEMBER, offer);
|
||||
}
|
||||
keyboard.add(row);
|
||||
markup.setKeyboard(keyboard);
|
||||
|
||||
@ -130,10 +130,7 @@ public class Kleinanzeigen {
|
||||
synchronized (offer) {
|
||||
offers.stream()
|
||||
.filter(existing -> existing.getId().equals(offer.getId()))
|
||||
.peek(existing -> {
|
||||
existing.merge(offer);
|
||||
log.info("Updated: {}", existing);
|
||||
})
|
||||
.peek(existing -> existing.merge(offer))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
log.info("Created: {}", offer);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user