ignore messages from the bot itself

This commit is contained in:
jason 2025-08-26 00:05:37 +00:00
parent 05e1f5a52b
commit d9fa698632

View File

@ -73,6 +73,14 @@ int main() {
}); });
bot.on_message_create([&bot](const dpp::message_create_t& event) { bot.on_message_create([&bot](const dpp::message_create_t& event) {
// Ignore messages from the bot itself to prevent infinite loops
bot.log(dpp::ll_info, "author id: " + to_string(event.msg.author.id));
bot.log(dpp::ll_info, "bot id: " + to_string(bot.me.id));
if (event.msg.author.id == bot.me.id) {
bot.log(dpp::ll_info, "Ignoring message, author and bot id match");
return;
}
// Check if the message has any attachments // Check if the message has any attachments
if (!event.msg.attachments.empty()) { // if (!event.msg.attachments.empty()) { //
// Log that an attachment was found // Log that an attachment was found