mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix: /ban
messages for self/mod bans (#4164)
This commit is contained in:
parent
9f5477c433
commit
9fba0bd4ab
|
@ -68,8 +68,8 @@
|
||||||
- Minor: Migrated /followersoff to Helix API. (#4040)
|
- Minor: Migrated /followersoff to Helix API. (#4040)
|
||||||
- Minor: Migrated /raid command to Helix API. Chat command will continue to be used until February 11th 2023. (#4029)
|
- Minor: Migrated /raid command to Helix API. Chat command will continue to be used until February 11th 2023. (#4029)
|
||||||
- Minor: Migrated /unraid command to Helix API. Chat command will continue to be used until February 11th 2023. (#4030)
|
- Minor: Migrated /unraid command to Helix API. Chat command will continue to be used until February 11th 2023. (#4030)
|
||||||
- Minor: Migrated /ban to Helix API. (#4049)
|
- Minor: Migrated /ban to Helix API. (#4049, #4164)
|
||||||
- Minor: Migrated /timeout to Helix API. (#4049)
|
- Minor: Migrated /timeout to Helix API. (#4049, #4164)
|
||||||
- Minor: Migrated /w to Helix API. Chat command will continue to be used until February 11th 2023. (#4052)
|
- Minor: Migrated /w to Helix API. Chat command will continue to be used until February 11th 2023. (#4052)
|
||||||
- Minor: Migrated /vips to Helix API. Chat command will continue to be used until February 11th 2023. (#4053)
|
- Minor: Migrated /vips to Helix API. Chat command will continue to be used until February 11th 2023. (#4053)
|
||||||
- Minor: Migrated /uniquechat and /r9kbeta to Helix API. (#4057)
|
- Minor: Migrated /uniquechat and /r9kbeta to Helix API. (#4057)
|
||||||
|
|
|
@ -2658,11 +2658,22 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||||
|
|
||||||
case Error::TargetBanned: {
|
case Error::TargetBanned: {
|
||||||
// Equivalent IRC error
|
// Equivalent IRC error
|
||||||
errorMessage = QString("%1 is already banned in this channel.")
|
errorMessage += QString("%1 is already banned in this channel.")
|
||||||
.arg(userDisplayName);
|
.arg(userDisplayName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Error::CannotBanUser: {
|
||||||
|
// We can't provide the identical error as in IRC,
|
||||||
|
// because we don't have enough information about the user.
|
||||||
|
// The messages from IRC are formatted like this:
|
||||||
|
// "You cannot {op} moderator {mod} unless you are the owner of this channel."
|
||||||
|
// "You cannot {op} the broadcaster."
|
||||||
|
errorMessage += QString("You cannot %1 %2.")
|
||||||
|
.arg(operation, userDisplayName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Error::UserMissingScope: {
|
case Error::UserMissingScope: {
|
||||||
// TODO(pajlada): Phrase MISSING_REQUIRED_SCOPE
|
// TODO(pajlada): Phrase MISSING_REQUIRED_SCOPE
|
||||||
errorMessage += "Missing required scope. "
|
errorMessage += "Missing required scope. "
|
||||||
|
|
|
@ -2064,6 +2064,13 @@ void Helix::banUser(QString broadcasterID, QString moderatorID, QString userID,
|
||||||
{
|
{
|
||||||
failureCallback(Error::TargetBanned, message);
|
failureCallback(Error::TargetBanned, message);
|
||||||
}
|
}
|
||||||
|
else if (message.startsWith(
|
||||||
|
"The user specified in the user_id field may "
|
||||||
|
"not be banned",
|
||||||
|
Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
failureCallback(Error::CannotBanUser, message);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failureCallback(Error::Forwarded, message);
|
failureCallback(Error::Forwarded, message);
|
||||||
|
|
|
@ -551,6 +551,7 @@ enum class HelixBanUserError { // /timeout, /ban
|
||||||
Ratelimited,
|
Ratelimited,
|
||||||
ConflictingOperation,
|
ConflictingOperation,
|
||||||
TargetBanned,
|
TargetBanned,
|
||||||
|
CannotBanUser,
|
||||||
|
|
||||||
// The error message is forwarded directly from the Twitch API
|
// The error message is forwarded directly from the Twitch API
|
||||||
Forwarded,
|
Forwarded,
|
||||||
|
|
Loading…
Reference in a new issue