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 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: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607)
## 2.5.1

View file

@ -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;
}
}

View file

@ -9,6 +9,7 @@
#include <magic_enum/magic_enum.hpp>
#include <QJsonDocument>
#include <QStringBuilder>
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())
{