mirror of
https://gitlab.com/niansa/SomeBot.git
synced 2025-03-06 20:48:26 +01:00
Minor fixes and preparation for warnings
This commit is contained in:
parent
e160fdda60
commit
fa75f5da6f
3 changed files with 17 additions and 5 deletions
|
@ -209,10 +209,6 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
bot->cluster.on_message_create([this](const dpp::message_create_t& event) {
|
bot->cluster.on_message_create([this](const dpp::message_create_t& event) {
|
||||||
// Make sure user isn't a known bot
|
|
||||||
if (event.msg.author.is_bot()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Lock UUID list
|
// Lock UUID list
|
||||||
std::scoped_lock L(uuid_mutex);
|
std::scoped_lock L(uuid_mutex);
|
||||||
// Get server captcha settings
|
// Get server captcha settings
|
||||||
|
@ -223,6 +219,10 @@ public:
|
||||||
}
|
}
|
||||||
// Delete message later
|
// Delete message later
|
||||||
autodelete_message(event.msg);
|
autodelete_message(event.msg);
|
||||||
|
// Make sure user isn't a known bot
|
||||||
|
if (event.msg.author.is_bot()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Find user is in UUID list
|
// Find user is in UUID list
|
||||||
auto uuid_key = std::to_string(event.msg.guild_id)+std::to_string(event.msg.author.id);
|
auto uuid_key = std::to_string(event.msg.guild_id)+std::to_string(event.msg.author.id);
|
||||||
auto res = uuids.find(uuid_key);
|
auto res = uuids.find(uuid_key);
|
||||||
|
|
|
@ -35,7 +35,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get color
|
// Get color
|
||||||
unsigned color = Util::str_to_color(strOrEmpty(event.get_parameter("color")));
|
auto colorStr = strOrEmpty(event.get_parameter("color"));
|
||||||
|
unsigned color = Util::str_to_color(colorStr.empty()?"black":colorStr);
|
||||||
// Generate embed
|
// Generate embed
|
||||||
dpp::embed embed;
|
dpp::embed embed;
|
||||||
embed.set_title(strOrEmpty(event.get_parameter("title")))
|
embed.set_title(strOrEmpty(event.get_parameter("title")))
|
||||||
|
|
|
@ -11,6 +11,10 @@ class Moderation {
|
||||||
bot->db << "INSERT OR IGNORE INTO moderation_guild_settings (id) VALUES (?);"
|
bot->db << "INSERT OR IGNORE INTO moderation_guild_settings (id) VALUES (?);"
|
||||||
<< std::to_string(guild_id);
|
<< std::to_string(guild_id);
|
||||||
}
|
}
|
||||||
|
void db_add_member(const dpp::snowflake& guild_id, const dpp::snowflake& user_id) {
|
||||||
|
bot->db << "INSERT OR IGNORE INTO moderation_guild_user_warnings (guild_id, user_id) VALUES (?);"
|
||||||
|
<< std::to_string(guild_id) << std::to_string(user_id);
|
||||||
|
}
|
||||||
dpp::snowflake get_moderation_role(const dpp::snowflake& guild_id) {
|
dpp::snowflake get_moderation_role(const dpp::snowflake& guild_id) {
|
||||||
std::string fres;
|
std::string fres;
|
||||||
bot->db << "SELECT moderation_role FROM moderation_guild_settings "
|
bot->db << "SELECT moderation_role FROM moderation_guild_settings "
|
||||||
|
@ -39,6 +43,13 @@ public:
|
||||||
" logs_channel TEXT,"
|
" logs_channel TEXT,"
|
||||||
" UNIQUE(id)"
|
" UNIQUE(id)"
|
||||||
");";
|
");";
|
||||||
|
bot->db << "CREATE TABLE IF NOT EXISTS moderation_guild_user_warnings ("
|
||||||
|
" guild_id TEXT NOT NULL,"
|
||||||
|
" user_id TEXT NOT NULL,"
|
||||||
|
" amount INTEGER,"
|
||||||
|
" reasons TEXT,"
|
||||||
|
" UNIQUE(guild_id, user_id)"
|
||||||
|
");";
|
||||||
|
|
||||||
bot->add_chatcommand(Bot::ChatCommand({"purge"}, "Lösche die letzen Nachrichten", dpp::slashcommand().add_option(dpp::command_option(dpp::command_option_type::co_integer, "amount", "Menge", true))), [&](const dpp::slashcommand_t& event) {
|
bot->add_chatcommand(Bot::ChatCommand({"purge"}, "Lösche die letzen Nachrichten", dpp::slashcommand().add_option(dpp::command_option(dpp::command_option_type::co_integer, "amount", "Menge", true))), [&](const dpp::slashcommand_t& event) {
|
||||||
unsigned long amount = std::get<long>(event.get_parameter("amount"));
|
unsigned long amount = std::get<long>(event.get_parameter("amount"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue