diff --git a/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o b/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o index ce45935..51272d1 100644 Binary files a/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o and b/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o differ diff --git a/src/commands.cpp b/src/commands.cpp index 19c2126..75d242d 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1,6 +1,9 @@ #include "gbp.cpp" #include +#define FILE_WARNING "/FILE/" + +#define FILE_NAME "temp-GBP" std::string printFullGBPList(bool update = false) { std::map> gbp; @@ -9,11 +12,21 @@ std::string printFullGBPList(bool update = false) else gbp = readGBPIntoList(); - std::string msg = ""; + std::ofstream file; + file.open("temp-GBP"); + + std::string line; for (std::map>::iterator it = gbp.begin(); it != gbp.end(); it++) { - msg += std::to_string(it->first) + ": " + it->second.second + "(" + std::to_string(it->second.first) + " GBP)\n"; + line = std::to_string(it->first) + ": " + it->second.second + " (" + std::to_string(it->second.first) + " GBP)\n"; + file << line; } - return msg; -} + file.close(); + std::string out; + out.append(FILE_WARNING); + out.append(" "); + out.append(FILE_NAME); + return out; +} +#undef FILE_NAME diff --git a/src/main.cpp b/src/main.cpp index db06e08..f04aba9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,8 +49,9 @@ void onMessage(dpp::cluster &bot, dpp::message msg) std::string argument = msg.content.substr(argIdx, msg.content.length() - argIdx); std::string msgContent = ""; - if (argument == "gbp") - msgContent = printFullGBPList(); + + + dpp::message toSend = dpp::message(msg.channel_id, msgContent);