Skip to content

Instantly share code, notes, and snippets.

@centralhardware
Created February 9, 2024 19:01
Show Gist options
  • Save centralhardware/e4aac70e2e7659658ae625948760c9d7 to your computer and use it in GitHub Desktop.
Save centralhardware/e4aac70e2e7659658ae625948760c9d7 to your computer and use it in GitHub Desktop.
sdf.java
public void send(Object method, User user){
limiter.limit(() -> {
try {
telegramUtil.logSend(method);
if (method instanceof BotApiMethodMessage botApiMethodMessage){
absSender.execute(botApiMethodMessage);
} else if (method instanceof SendPhoto sendPhoto){
absSender.execute(sendPhoto);
} else if (method instanceof DeleteMessage deleteMessage){
absSender.execute(deleteMessage);
} else if (method instanceof AnswerCallbackQuery answerCallbackQuery){
absSender.execute(answerCallbackQuery);
} else if (method instanceof SendChatAction sendChatAction){
absSender.execute(sendChatAction);
} else if (method instanceof AnswerInlineQuery answerInlineQuery){
absSender.execute(answerInlineQuery);
} else if (method instanceof SendDocument sendDocument){
absSender.execute(sendDocument);
} else if (method instanceof EditMessageText editMessageText){
absSender.execute(editMessageText);
} else if (method instanceof EditMessageReplyMarkup editMessageReplyMarkup){
absSender.execute(editMessageReplyMarkup);
}
telegramUtil.saveStatisticOutcome(method, user);
} catch (Throwable t){
log.warn("",t);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment