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