feat: send messages over Helix by default (#5607)

This commit is contained in:
nerix 2024-09-29 11:52:37 +02:00 committed by GitHub
parent d0bcf35fdc
commit ef4be6cdac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View file

@ -92,6 +92,7 @@
- Dev: Refactored `static`s in headers to only be present once in the final app. (#5588) - 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: Refactored legacy Unicode zero-width-joiner replacement. (#5594)
- Dev: The JSON output when copying a message (<kbd>SHIFT</kbd> + right-click) is now more extensive. (#5600) - Dev: The JSON output when copying a message (<kbd>SHIFT</kbd> + 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 ## 2.5.1

View file

@ -132,14 +132,14 @@ bool shouldSendHelixChat()
{ {
switch (getSettings()->chatSendProtocol) switch (getSettings()->chatSendProtocol)
{ {
case ChatSendProtocol::Default:
case ChatSendProtocol::Helix: case ChatSendProtocol::Helix:
return true; return true;
case ChatSendProtocol::Default:
case ChatSendProtocol::IRC: case ChatSendProtocol::IRC:
return false; return false;
default: default:
assert(false && "Invalid chat protocol value"); assert(false && "Invalid chat protocol value");
return false; return true;
} }
} }

View file

@ -9,6 +9,7 @@
#include <magic_enum/magic_enum.hpp> #include <magic_enum/magic_enum.hpp>
#include <QJsonDocument> #include <QJsonDocument>
#include <QStringBuilder>
namespace { namespace {
@ -3015,8 +3016,13 @@ void Helix::sendChatMessage(
} }
const auto obj = result.parseJson(); const auto obj = result.parseJson();
auto message = auto message = obj["message"].toString();
obj["message"].toString(u"Twitch internal server error"_s);
if (message.isEmpty())
{
message = u"Twitch internal server error (" %
result.formatError() % ')';
}
switch (*result.status()) switch (*result.status())
{ {