diff --git a/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o b/build/CMakeFiles/gbp-bot.dir/src/main.cpp.o index 8120f6a..66da3d5 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/config.json b/config.json index 809664c..612f34d 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,4 @@ { - "token": "OTQ5MTIxNDU2MTY2NTM5Mjk2.YiFwPA.cKj457bZ5x0pFw6w5QaN7ezqg3E", + "token": "token here", "bot_command": "!gbp" } diff --git a/src/commands.cpp b/src/commands.cpp index 5c443d1..68e9dfd 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -78,33 +78,57 @@ std::string printFullGBPList(bool update) } #undef FILE_NAME +/** + * ##findNum + * + * Returns the user + GBP at the given position. + * + * Arguments: + * * int pos - The position to find. + */ std::string findNum(int pos) { std::map> gbp = readGBPIntoList(); - std::string out = "#" + std::to_string(pos) + ": " + gbp[pos].second + " (" + std::to_string(gbp[pos].first) + " GBP)\n"; + std::string out = "```#" + std::to_string(pos) + ": " + gbp[pos].second + " (" + std::to_string(gbp[pos].first) + " GBP)```\n"; return out; } +/** + * ##findName + * + * Finds the given user, and returns a string with their GBP. + * + * Arguments: + * * std::string user - The username to search for. + */ std::string findName(std::string user) { std::map> gbp = readGBPIntoList(); for (std::map>::iterator it = gbp.begin(); it != gbp.end(); it++) { if (it->second.second.find(user) != -1) { - return "#" + std::to_string(it->first) + ": " + it->second.second + " (" + std::to_string(it->second.first) + " GBP)\n"; + return "```#" + std::to_string(it->first) + ": " + it->second.second + " (" + std::to_string(it->second.first) + " GBP)```\n"; } } return "User not found!"; } +/** + * ##findGBP + * + * Returns a string containing every user with the given gbp. + * + * Arguments: + * * int gbpinp - The GBP to find. + */ std::string findGBP(int gbpinp) { - std::string out = ""; + std::string out = "```"; std::map> gbp = readGBPIntoList(); for (std::map>::iterator it = gbp.begin(); it != gbp.end(); it++) if (it->second.first == gbpinp) out += "#" + std::to_string(it->first) + ": " + it->second.second + " (" + std::to_string(it->second.first) + " GBP)\n"; - - if (out == "") + out += "```"; + if (out == "``````") return "No users found with that GBP!"; return out; } @@ -124,7 +148,6 @@ std::string genericResponse() * * Return the list of commands. */ - std::string helpMessage() { std::string out; @@ -132,6 +155,12 @@ std::string helpMessage() out += "Available Commands: \n"; out += "gbplist (update):\n"; out += "----> Print out the current GBP leaderboard. Add update to fetch the latest page.\n"; + out += "findpos (number):\n"; + out += "----> Prints out the user at number (number) in the GBP leaderboard.\n"; + out += "findgbp (number):\n"; + out += "----> Prints out every use with (number) GBP.\n"; + out += "findname (username):\n"; + out += "----> Prints out the user (username) and their GBP.\n"; out += "```\n"; return out; }