Reorganised databases
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
#include "Commands.hpp"
|
||||
#include "../languages/locale_en.hpp"
|
||||
#include "Base/SQL.hpp"
|
||||
#include <dpp/snowflake.h>
|
||||
|
||||
void commandPing(const dpp::slashcommand_t &event) { event.reply("Pong"); }
|
||||
void commandBalance(const dpp::slashcommand_t &event) {
|
||||
dpp::snowflake userid = event.command.get_issuing_user().id;
|
||||
std::string balance;
|
||||
execSQL("SELECT CASH FROM MONEY WHERE UID=" + userid.str(), &balance);
|
||||
|
||||
if (balance.empty()) {
|
||||
execSQL("INSERT INTO MONEY (UID) VALUES (" + userid.str() + ");");
|
||||
balance = "0";
|
||||
} else {
|
||||
std::uint8_t begining = balance.find(':') + 1;
|
||||
balance = balance.substr(begining, balance.find(';') - begining);
|
||||
}
|
||||
|
||||
event.reply("You have " + balance + " " + CURRENCY_NAME + "(s)");
|
||||
}
|
||||
|
Reference in New Issue
Block a user