fix(helix-chat): show better error messages (#5276)
This commit is contained in:
+1
-1
@@ -186,7 +186,7 @@
|
|||||||
- Dev: Added signal to invalidate paint buffers of channel views without forcing a relayout. (#5123)
|
- Dev: Added signal to invalidate paint buffers of channel views without forcing a relayout. (#5123)
|
||||||
- Dev: Specialize `Atomic<std::shared_ptr<T>>` if underlying standard library supports it. (#5133)
|
- Dev: Specialize `Atomic<std::shared_ptr<T>>` if underlying standard library supports it. (#5133)
|
||||||
- Dev: Added the `developer_name` field to the Linux AppData specification. (#5138)
|
- Dev: Added the `developer_name` field to the Linux AppData specification. (#5138)
|
||||||
- Dev: Twitch messages can be sent using Twitch's Helix API instead of IRC (disabled by default). (#5200)
|
- Dev: Twitch messages can be sent using Twitch's Helix API instead of IRC (disabled by default). (#5200, #5276)
|
||||||
- Dev: Added estimation for image sizes to avoid layout shifts. (#5192)
|
- Dev: Added estimation for image sizes to avoid layout shifts. (#5192)
|
||||||
- Dev: Added the `launachable` entry to Linux AppData. (#5210)
|
- Dev: Added the `launachable` entry to Linux AppData. (#5210)
|
||||||
- Dev: Cleaned up and optimized resources. (#5222)
|
- Dev: Cleaned up and optimized resources. (#5222)
|
||||||
|
|||||||
@@ -39,9 +39,17 @@ const QString SEVENTV_EVENTAPI_URL = "wss://events.7tv.io/v3";
|
|||||||
void sendHelixMessage(const std::shared_ptr<TwitchChannel> &channel,
|
void sendHelixMessage(const std::shared_ptr<TwitchChannel> &channel,
|
||||||
const QString &message, const QString &replyParentId = {})
|
const QString &message, const QString &replyParentId = {})
|
||||||
{
|
{
|
||||||
|
auto broadcasterID = channel->roomId();
|
||||||
|
if (broadcasterID.isEmpty())
|
||||||
|
{
|
||||||
|
channel->addMessage(makeSystemMessage(
|
||||||
|
"Sending messages in this channel isn't possible."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getHelix()->sendChatMessage(
|
getHelix()->sendChatMessage(
|
||||||
{
|
{
|
||||||
.broadcasterID = channel->roomId(),
|
.broadcasterID = broadcasterID,
|
||||||
.senderID =
|
.senderID =
|
||||||
getIApp()->getAccounts()->twitch.getCurrent()->getUserId(),
|
getIApp()->getAccounts()->twitch.getCurrent()->getUserId(),
|
||||||
.message = message,
|
.message = message,
|
||||||
@@ -68,13 +76,18 @@ void sendHelixMessage(const std::shared_ptr<TwitchChannel> &channel,
|
|||||||
}();
|
}();
|
||||||
chan->addMessage(errorMessage);
|
chan->addMessage(errorMessage);
|
||||||
},
|
},
|
||||||
[weak = std::weak_ptr(channel)](auto error, const auto &message) {
|
[weak = std::weak_ptr(channel)](auto error, auto message) {
|
||||||
auto chan = weak.lock();
|
auto chan = weak.lock();
|
||||||
if (!chan)
|
if (!chan)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.isEmpty())
|
||||||
|
{
|
||||||
|
message = "(empty message)";
|
||||||
|
}
|
||||||
|
|
||||||
using Error = decltype(error);
|
using Error = decltype(error);
|
||||||
|
|
||||||
auto errorMessage = [&]() -> QString {
|
auto errorMessage = [&]() -> QString {
|
||||||
|
|||||||
Reference in New Issue
Block a user