diff --git a/src/commands/add.cpp b/src/commands/add.cpp index 2a77ebb..dfb6092 100644 --- a/src/commands/add.cpp +++ b/src/commands/add.cpp @@ -6,6 +6,11 @@ using namespace sql; using json = nlohmann::json; 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 = ?", {event.command.guild_id.str(), event.command.channel_id.str()}); if (res->next()) { @@ -13,6 +18,8 @@ void add::execute(sql::Connection &con, dpp::cluster &bot, const dpp::slashcomma return; } + delete res; + dpp::webhook newWebhook = dpp::webhook(); newWebhook.name = "Sheepstar"; newWebhook.channel_id = event.command.channel_id;