find Name
This commit is contained in:
parent
2245e48a66
commit
2349e5a602
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"token": "token here",
|
"token": "OTQ5MTIxNDU2MTY2NTM5Mjk2.YiFwPA.cKj457bZ5x0pFw6w5QaN7ezqg3E",
|
||||||
"bot_command": "!gbp"
|
"bot_command": "!gbp"
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ std::string commandParse(std::vector<std::string> args)
|
|||||||
return findNum(std::stoi(args[1]));
|
return findNum(std::stoi(args[1]));
|
||||||
else
|
else
|
||||||
return "Invalid command!";
|
return "Invalid command!";
|
||||||
|
|
||||||
} else if (args[0] == "findname") {
|
} else if (args[0] == "findname") {
|
||||||
if (args.size() >= 2)
|
if (args.size() >= 2)
|
||||||
return findName(args[1]);
|
return findName(args[1]);
|
||||||
@ -92,8 +91,9 @@ std::string findName(std::string user)
|
|||||||
{
|
{
|
||||||
std::map<unsigned short int, std::pair<int, std::string>> gbp = readGBPIntoList();
|
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++) {
|
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 "#" + std::to_string(it->first) + ": " + it->second.second + " (" + std::to_string(it->second.first) + " GBP)\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "User not found!";
|
return "User not found!";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user