Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃洝 Add /shield and /shieldoff 馃洝 #4580

Merged
merged 6 commits into from
May 7, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Apr 25, 2023

Description

This PR adds the /shield and /shieldoff commands that toggle shield mode. Shield mode is not tracked internally. If shield mode is active and /shield is used, there will be just be a message, saying "Shield mode was activated." (which is true - shield mode was activated in the past - even more: it hasn't been disabled since). There's little-to-no point in checking the shield mode before, because it might be changed between checking and updating. The only reason this should be done is to provide the user with the name of the moderator that enabled shield mode (this isn't sent if the mode didn't change for some reason).

Closes #4206.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/providers/twitch/api/Helix.cpp Show resolved Hide resolved
src/providers/twitch/api/Helix.cpp Show resolved Hide resolved
src/providers/twitch/api/Helix.cpp Show resolved Hide resolved
src/providers/twitch/api/Helix.hpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/providers/twitch/api/Helix.hpp Show resolved Hide resolved
@pajlada pajlada enabled auto-merge (squash) May 7, 2023 10:08
@pajlada pajlada merged commit 4dd290e into Chatterino:master May 7, 2023
15 checks passed
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchChannel.hpp"

namespace chatterino::commands {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: modification of 'std' namespace can result in undefined behavior [cert-dcl58-cpp]

namespace chatterino::commands {
          ^
Additional context

/usr/include/c++/11/bits/unique_ptr.h:44: 'std' namespace opened here

namespace std _GLIBCXX_VISIBILITY(default)
          ^


QString toggleShieldMode(const CommandContext &ctx, bool isActivating)
{
const QString command =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'command' is not initialized [cppcoreguidelines-init-variables]

Suggested change
const QString command =
const QString command = 0 =

},
[channel = ctx.channel](const auto error, const auto &message) {
using Error = HelixUpdateShieldModeError;
QString errorMessage = "Failed to update shield mode - ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'errorMessage' is not initialized [cppcoreguidelines-init-variables]

Suggested change
QString errorMessage = "Failed to update shield mode - ";
QString errorMessage = 0 = "Failed to update shield mode - ";

@@ -0,0 +1,16 @@
#pragma once

#include <QString>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'QString' file not found [clang-diagnostic-error]

#include <QString>
         ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants