find Name

This commit is contained in:
SuperNovaa41 2022-03-04 15:28:20 -05:00
parent 2245e48a66
commit 2349e5a602
3 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{
"token": "token here",
"token": "OTQ5MTIxNDU2MTY2NTM5Mjk2.YiFwPA.cKj457bZ5x0pFw6w5QaN7ezqg3E",
"bot_command": "!gbp"
}

View File

@ -37,7 +37,6 @@ std::string commandParse(std::vector<std::string> args)
return findNum(std::stoi(args[1]));
else
return "Invalid command!";
} else if (args[0] == "findname") {
if (args.size() >= 2)
return findName(args[1]);
@ -92,9 +91,10 @@ std::string findName(std::string user)
{
std::map<unsigned short int, std::pair<int, std::string>> gbp = readGBPIntoList();
for (std::map<unsigned short int, std::pair<int, std::string>>::iterator it = gbp.begin(); it != gbp.end(); it++) {
if (it->second.second == user)
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 "User not found!";
}