summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-06 09:25:53 -0400
committerBenji Dial <benji@benjidial.net>2024-05-06 09:25:53 -0400
commit85a94138c89c8389f9828f097b3e96f8b94ed5d6 (patch)
tree2bb22b121ab93dfef716652a9b7e7a37326ec2a1
parent379b35093097f0091e08e128c161000ead3d1e19 (diff)
downloadbracket-bot-85a94138c89c8389f9828f097b3e96f8b94ed5d6.tar.gz
don't post list of entries at start of round if message would be too long
-rw-r--r--source.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/source.cpp b/source.cpp
index 9b5a122..dc5b39a 100644
--- a/source.cpp
+++ b/source.cpp
@@ -365,8 +365,13 @@ int main() {
if (advanced)
msg += "The only entry left in the previous round was \"" + *advanced + "\", so it advanced. ";
msg += "There are " + std::to_string(left_for_this_round.size()) + " entries remaining:";
+ std::string msg_backup = msg;
for (int i = left_for_this_round.size() - 1; i >= 0; --i)
msg += "\n* \"" + left_for_this_round[i] + "\"";
+ if (msg.size() > 2000) {
+ msg = std::move(msg_backup);
+ msg.back() = '.';
+ }
send_message(msg);
}