From f4fb03ccf9d36b8cc2ae4031b80742f653b93211 Mon Sep 17 00:00:00 2001 From: squidlox <32559074+squidlox@users.noreply.github.com> Date: Fri, 8 May 2026 13:16:39 -0400 Subject: [PATCH] Update topic_cmd.cpp may help mitigate file loading errors --- src/commands/topic_cmd.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/topic_cmd.cpp b/src/commands/topic_cmd.cpp index 55f1a97..4d01818 100644 --- a/src/commands/topic_cmd.cpp +++ b/src/commands/topic_cmd.cpp @@ -4,7 +4,17 @@ void cmd::topicCommand(dpp::cluster& bot, const dpp::slashcommand_t& event) { static int index; - const std::string topic = cmd::utils::readFileLine("res/topic.txt", index); + int maxLoadAttempts = 10; + + for(int i = 0; i < maxLoadAttempts; i++) // check if topic string is empty up to x amount of attempts + { + const std::string topic = cmd::utils::readFileLine("res/topic.txt", index); + if(topic.length() > 0) + { + break; + } + } + const dpp::embed embed = dpp::embed() .set_color(globals::color::defaultColor)