Added a security check to the add.cpp
This commit is contained in:
parent
d151338206
commit
f42b40091b
@ -6,6 +6,11 @@ using namespace sql;
|
|||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
void add::execute(sql::Connection &con, dpp::cluster &bot, const dpp::slashcommand_t &event) {
|
void add::execute(sql::Connection &con, dpp::cluster &bot, const dpp::slashcommand_t &event) {
|
||||||
|
if (event.command.channel.get_type() != dpp::channel_type::CHANNEL_TEXT) {
|
||||||
|
util::sendError(event, "This command can only be used in text channels.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ResultSet *res = util::getResultSet(con, "SELECT * FROM channels WHERE guildId = ? AND channelId = ?",
|
ResultSet *res = util::getResultSet(con, "SELECT * FROM channels WHERE guildId = ? AND channelId = ?",
|
||||||
{event.command.guild_id.str(), event.command.channel_id.str()});
|
{event.command.guild_id.str(), event.command.channel_id.str()});
|
||||||
if (res->next()) {
|
if (res->next()) {
|
||||||
@ -13,6 +18,8 @@ void add::execute(sql::Connection &con, dpp::cluster &bot, const dpp::slashcomma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete res;
|
||||||
|
|
||||||
dpp::webhook newWebhook = dpp::webhook();
|
dpp::webhook newWebhook = dpp::webhook();
|
||||||
newWebhook.name = "Sheepstar";
|
newWebhook.name = "Sheepstar";
|
||||||
newWebhook.channel_id = event.command.channel_id;
|
newWebhook.channel_id = event.command.channel_id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user