From ef4be6cdac3463f2d83f8edd1915eb08e5f45147 Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 29 Sep 2024 11:52:37 +0200 Subject: [PATCH] feat: send messages over Helix by default (#5607) --- CHANGELOG.md | 1 + src/providers/twitch/TwitchIrcServer.cpp | 4 ++-- src/providers/twitch/api/Helix.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116d9e206..ef5464f9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ - Dev: Refactored `static`s in headers to only be present once in the final app. (#5588) - Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594) - Dev: The JSON output when copying a message (SHIFT + right-click) is now more extensive. (#5600) +- Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607) ## 2.5.1 diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index 6c3e6ae50..c6541a95c 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -132,14 +132,14 @@ bool shouldSendHelixChat() { switch (getSettings()->chatSendProtocol) { + case ChatSendProtocol::Default: case ChatSendProtocol::Helix: return true; - case ChatSendProtocol::Default: case ChatSendProtocol::IRC: return false; default: assert(false && "Invalid chat protocol value"); - return false; + return true; } } diff --git a/src/providers/twitch/api/Helix.cpp b/src/providers/twitch/api/Helix.cpp index 6844a2dcc..a756a0f47 100644 --- a/src/providers/twitch/api/Helix.cpp +++ b/src/providers/twitch/api/Helix.cpp @@ -9,6 +9,7 @@ #include #include +#include namespace { @@ -3015,8 +3016,13 @@ void Helix::sendChatMessage( } const auto obj = result.parseJson(); - auto message = - obj["message"].toString(u"Twitch internal server error"_s); + auto message = obj["message"].toString(); + + if (message.isEmpty()) + { + message = u"Twitch internal server error (" % + result.formatError() % ')'; + } switch (*result.status()) {