Skip to content

Commit

Permalink
OnAnyMessage: Also ignore older msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Royna2544 committed Nov 18, 2024
1 parent 2159880 commit 743630f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api/components/OnAnyMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <api/components/OnAnyMessage.hpp>
#include <future>
#include "Authorization.hpp"

void TgBotApiImpl::OnAnyMessageImpl::onAnyMessage(
const TgBotApi::AnyMessageCallback& callback) {
Expand Down Expand Up @@ -48,6 +49,9 @@ void TgBotApiImpl::OnAnyMessageImpl::onAnyMessageFunction(
TgBotApiImpl::OnAnyMessageImpl::OnAnyMessageImpl(TgBotApiImpl::Ptr api)
: _api(api) {
_api->getEvents().onAnyMessage([this](Message::Ptr message) {
if (!AuthContext::isUnderTimeLimit(message)) {
return;
}
onAnyMessageFunction(std::move(message));
});
}

0 comments on commit 743630f

Please sign in to comment.