ignore messages from the bot itself
This commit is contained in:
parent
05e1f5a52b
commit
d9fa698632
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user