message_queue: combine if condition

This commit is contained in:
Syping 2024-02-23 11:27:17 +01:00
parent ea2c6c460f
commit 46b80f3bdf

View file

@ -37,7 +37,7 @@ void message_queue::add(message &&message)
void message_queue::process_message_event(dpp::cluster *bot, bot::settings::settings *settings, const dpp::message_create_t &event) void message_queue::process_message_event(dpp::cluster *bot, bot::settings::settings *settings, const dpp::message_create_t &event)
{ {
// We check for conditions we want to skip translation for // We check for conditions we want to skip translation for
if (event.msg.content.empty() || event.msg.has_thread()) if (event.msg.author.id == bot->me.id || event.msg.content.empty() || event.msg.has_thread())
return; return;
if (event.msg.webhook_id) { if (event.msg.webhook_id) {
@ -48,10 +48,6 @@ void message_queue::process_message_event(dpp::cluster *bot, bot::settings::sett
return; return;
} }
// Same as before, just without the involvement of webhooks
if (event.msg.author.id == bot->me.id)
return;
const std::lock_guard<bot::settings::settings> guard(*settings); const std::lock_guard<bot::settings::settings> guard(*settings);
if (const bot::settings::channel *channel = settings->get_channel(event.msg.guild_id, event.msg.channel_id)) { if (const bot::settings::channel *channel = settings->get_channel(event.msg.guild_id, event.msg.channel_id)) {
bot::message message; bot::message message;