Reorganised databases

This commit is contained in:
2025-07-19 01:16:09 +03:00
parent b8b3ccfbcb
commit a0468758ad
5 changed files with 39 additions and 12 deletions

View File

@@ -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)");
}