Added the sendSuccess, sendError, getResultSet & executeQuery functions to the util.h

This commit is contained in:
2023-11-04 12:21:15 +01:00
parent 95900161b4
commit d6041b94f0

View File

@ -3,6 +3,7 @@
#include <dpp/dpp.h> #include <dpp/dpp.h>
#include <mariadb/conncpp.hpp> #include <mariadb/conncpp.hpp>
#include <regex>
class util { class util {
public: public:
@ -24,12 +25,43 @@ public:
*/ */
static dpp::embed getDefaultEmbed(EmbedType type = INFO); static dpp::embed getDefaultEmbed(EmbedType type = INFO);
/**
* @brief Sends a success message
* @param event The event
* @param message The message
*/
static void sendSuccess(const dpp::slashcommand_t& event, const std::string& message);
/**
* @brief Sends an error message
* @param event The event
* @param message The message
*/
static void sendError(const dpp::slashcommand_t& event, const std::string& message);
/** /**
* @brief Creates a connection to the database * @brief Creates a connection to the database
* @param config The database config * @param config The database config
* @return The connection * @return The connection
*/ */
static sql::Connection* createConnection(const json& config); static sql::Connection* createConnection(const json& config);
/**
* @brief Gets a result set from a query
* @param con The connection
* @param query The query
* @param params The parameters
* @return The result set
*/
static sql::ResultSet* getResultSet(sql::Connection& con, const std::string& query, std::initializer_list<std::string> params);
/**
* @brief Executes a query
* @param con The connection
* @param query The query
* @param params The parameters
*/
static void executeQuery(sql::Connection& con, const std::string& query, std::initializer_list<std::string> params);
}; };