summary refs log tree commit diff stats
path: root/lingo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lingo.cpp')
-rw-r--r--lingo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lingo.cpp b/lingo.cpp index 1cfc9e3..cf5d033 100644 --- a/lingo.cpp +++ b/lingo.cpp
@@ -982,13 +982,19 @@ private:
982 982
983 std::string solution = cached_puzzle_->solution; 983 std::string solution = cached_puzzle_->solution;
984 bot_->message_create(message, [this, solution](const dpp::confirmation_callback_t& userdata) { 984 bot_->message_create(message, [this, solution](const dpp::confirmation_callback_t& userdata) {
985 const auto& posted_msg = std::get<dpp::message>(userdata.value); 985 if (!userdata.is_error()) {
986 std::lock_guard answer_lock(answers_mutex_); 986 const auto& posted_msg = std::get<dpp::message>(userdata.value);
987 if (answer_by_message_.size() > 3000) 987 std::lock_guard answer_lock(answers_mutex_);
988 { 988 if (answer_by_message_.size() > 3000)
989 answer_by_message_.clear(); 989 {
990 answer_by_message_.clear();
991 }
992 if (posted_msg.id != 0) {
993 answer_by_message_[posted_msg.id] = solution;
994 }
995 } else {
996 std::cout << "Error posting message: " << userdata.get_error().message << std::endl;
990 } 997 }
991 answer_by_message_[posted_msg.id] = solution;
992 }); 998 });
993#endif 999#endif
994 1000