From 123ec85b86cfb0abf7104191b65b44707c071526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Thu, 8 Dec 2022 09:36:03 -0700 Subject: [PATCH] Do not respond to empty message packets --- src/PlayerbotAI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 39f946b7..d2268b15 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -713,7 +713,7 @@ void PlayerbotAI::HandleBotOutgoingPacket(WorldPacket const& packet) if (bot->InBattleground() && bot->GetBattleground() && !(isMentioned || (msgtype != CHAT_MSG_CHANNEL && !isRandomBot))) return; - if ((isRandomBot && !isPaused && (!urand(0, 20) || (!urand(0, 10) && message.find(bot->GetName()) != std::string::npos))) || (!isRandomBot && (isMentioned || msgtype != CHAT_MSG_CHANNEL || !urand(0, 4)))) + if (!message.empty() && (isRandomBot && !isPaused && (!urand(0, 20) || (!urand(0, 10) && message.find(bot->GetName()) != std::string::npos))) || (!isRandomBot && (isMentioned || msgtype != CHAT_MSG_CHANNEL || !urand(0, 4)))) { QueueChatResponse(msgtype, guid1, ObjectGuid(), message, chanName, name); GetAiObjectContext()->GetValue("last said", "chat")->Set(time(0) + urand(5, 25));