Skip to content

Commit

Permalink
feat: send messages over Helix by default (#5607)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Sep 29, 2024
1 parent d0bcf35 commit ef4be6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/providers/twitch/TwitchIrcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/providers/twitch/api/Helix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <magic_enum/magic_enum.hpp>
#include <QJsonDocument>
#include <QStringBuilder>

namespace {

Expand Down Expand Up @@ -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())
{
Expand Down

0 comments on commit ef4be6c

Please sign in to comment.