Added ability to see others balance
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
#include "Base/SQL.hpp"
|
||||
#include "Commands.hpp"
|
||||
#include <cstdint>
|
||||
#include <dpp/appcommand.h>
|
||||
#include <dpp/dispatcher.h>
|
||||
#include <dpp/exception.h>
|
||||
#include <dpp/snowflake.h>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
void commandPing(const dpp::slashcommand_t &event) { event.reply("Pong"); }
|
||||
void commandBalance(const dpp::slashcommand_t &event) {
|
||||
std::string balance = getUserBalance(event.command.get_issuing_user().id);
|
||||
event.reply(COMMAND_BALANCE_RESPONSE(balance));
|
||||
std::string person, balance;
|
||||
dpp::command_value id = event.get_parameter("user");
|
||||
|
||||
// Weirdest thing ever
|
||||
if (std::holds_alternative<std::monostate>(id)) {
|
||||
person = event.command.get_issuing_user().id;
|
||||
balance = getUserBalance(person);
|
||||
event.reply(COMMAND_BALANCE_SELF_RESPONSE(balance));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
person = std::get<dpp::snowflake>(id).str();
|
||||
balance = getUserBalance(person);
|
||||
event.reply(COMMAND_BALANCE_SOMEONE_ELSE_RESPONSE(person, balance));
|
||||
}
|
||||
|
||||
void commandPay(const dpp::slashcommand_t &event) {
|
||||
|
Reference in New Issue
Block a user