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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sound and flash alert for automod caught messages #5026

Merged
merged 23 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1556a4b
feat: trigger sound and highlight for automod channel
iProdigy Dec 15, 2023
07346f7
chore: update changelog
iProdigy Dec 15, 2023
88c6e34
Merge branch 'master' into feature/automod-notification
iProdigy Dec 16, 2023
42bf0da
feat: create automod row in highlights settings
iProdigy Dec 24, 2023
ccba4db
chore: reformat
iProdigy Dec 24, 2023
8f9a3dc
Merge branch 'master' into feature/automod-notification
iProdigy Dec 24, 2023
3466b3f
fix: call highlight controller for automod caught message
iProdigy Dec 25, 2023
df7b5c4
chore: include std optional
iProdigy Dec 25, 2023
4534060
chore: another optional include
iProdigy Dec 25, 2023
0371e4c
Merge branch 'master' into feature/automod-notification
iProdigy Dec 25, 2023
0db205b
nit: Flag the offending message & use that for highlights
pajlada Dec 25, 2023
d80f102
nit: move fallback sound logic to the static triggerHighlights method
pajlada Dec 25, 2023
bf2f7b0
nit: Call `triggerHighlights` like a static method
pajlada Dec 25, 2023
64c2e95
Add comment explaining our weird way to use triggerHighlights
pajlada Dec 25, 2023
7b8d5c6
nit: settings reformat
pajlada Dec 25, 2023
1e163dd
nit: settings key change
pajlada Dec 25, 2023
25c887f
nit2: change setting keys again
pajlada Dec 25, 2023
63a9b50
nit3: another setting key change
pajlada Dec 25, 2023
c243115
chore: remove scrollbar highlight color
iProdigy Dec 25, 2023
5a40a9c
highlighting: Disable sound & color dialog on all cells that are disa…
pajlada Dec 25, 2023
8cc39c5
Merge branch 'master' into feature/automod-notification
pajlada Dec 25, 2023
dfa1496
Assert/check message highlightColor
pajlada Dec 25, 2023
dfaee6a
another color assert
pajlada Dec 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unversioned

- Major: Allow use of Twitch follower emotes in other channels if subscribed. (#4922)
- Major: Add `/automod` split to track automod caught messages across all open channels the user moderates. (#4986)
- Major: Add `/automod` split to track automod caught messages across all open channels the user moderates. (#4986, #5026)
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
- Minor: The account switcher is now styled to match your theme. (#4817)
- Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795)
Expand Down
11 changes: 11 additions & 0 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,17 @@ void Application::initPubSub()
p.first);
getApp()->twitch->automodChannel->addMessage(
p.second);

if (getSettings()->automodPlaySound &&
!isInStreamerMode())
{
getApp()->notifications->playSound();
}
if (getSettings()->automodFlashTaskbar &&
!isInStreamerMode())
{
getApp()->windows->sendAlert();
}
});
}
// "ALLOWED" and "DENIED" statuses remain unimplemented
Expand Down
5 changes: 5 additions & 0 deletions src/singletons/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ class Settings
IntSetting openFromToast = {"/notifications/openFromToast",
static_cast<int>(ToastReaction::OpenInBrowser)};

BoolSetting automodPlaySound = {"/notifications/automod/enableSound",
false};
BoolSetting automodFlashTaskbar = {
"/notifications/automod/enableTaskbarFlashing", true};

/// External tools
// Streamlink
BoolSetting streamlinkUseCustomPath = {"/external/streamlink/useCustomPath",
Expand Down
14 changes: 8 additions & 6 deletions src/widgets/helper/ChannelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,12 +1076,14 @@ void ChannelView::messageAppended(MessagePtr &message,

if (!messageFlags->has(MessageFlag::DoNotTriggerNotification))
{
if (messageFlags->has(MessageFlag::Highlighted) &&
messageFlags->has(MessageFlag::ShowInMentions) &&
!messageFlags->has(MessageFlag::Subscription) &&
(getSettings()->highlightMentions ||
this->channel_->getType() != Channel::Type::TwitchMentions))

if ((messageFlags->has(MessageFlag::Highlighted) &&
messageFlags->has(MessageFlag::ShowInMentions) &&
!messageFlags->has(MessageFlag::Subscription) &&
(getSettings()->highlightMentions ||
this->channel_->getType() != Channel::Type::TwitchMentions)) ||
(this->channel_->getType() == Channel::Type::TwitchAutomod &&
(getSettings()->automodPlaySound ||
getSettings()->automodFlashTaskbar)))
{
this->tabHighlightRequested.invoke(HighlightState::Highlighted);
}
Expand Down
35 changes: 35 additions & 0 deletions src/widgets/splits/SplitHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,41 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
moreMenu->addAction(action);
}

if (this->split_->getChannel()->getType() == Channel::Type::TwitchAutomod)
{
{
auto *action = new QAction(this);
action->setText("Play sound on caught messages");
action->setCheckable(true);

QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action] {
action->setChecked(getSettings()->automodPlaySound);
});
QObject::connect(action, &QAction::triggered, this, [] {
getSettings()->automodPlaySound =
!getSettings()->automodPlaySound;
});

moreMenu->addAction(action);
}

{
auto *action = new QAction(this);
action->setText("Flash taskbar on caught messages");
action->setCheckable(true);

QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action] {
action->setChecked(getSettings()->automodFlashTaskbar);
});
QObject::connect(action, &QAction::triggered, this, [] {
getSettings()->automodFlashTaskbar =
!getSettings()->automodFlashTaskbar;
});

moreMenu->addAction(action);
}
}

if (twitchChannel)
{
moreMenu->addAction(
Expand Down
Loading