Skip to content

Commit

Permalink
chore: refactor chat moderation service
Browse files Browse the repository at this point in the history
  • Loading branch information
zunderscore committed Jan 10, 2025
1 parent 2ab351c commit b9c645a
Show file tree
Hide file tree
Showing 14 changed files with 699 additions and 755 deletions.
1 change: 0 additions & 1 deletion grunt/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module.exports = function (grunt) {
'--out="./dist/pack"',
'--arch=x64',
`--electronVersion=${version}`,
'--asar.unpack="moderation-service.js"',
'--prune',
'--overwrite',
'--version-string.ProductName="Firebot v5"',
Expand Down
8 changes: 0 additions & 8 deletions src/backend/app-management/electron/app-helpers.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
"use strict";

exports.restartApp = () => {

const { app } = require("electron");

try {
const chatModerationManager = require("../../chat/moderation/chat-moderation-manager");
chatModerationManager.stopService();
} catch (error) {
//silently fail
}

setTimeout(() => {
app.relaunch({ args: process.argv.slice(1).concat(["--relaunch"]) });
app.exit(0);
Expand Down
4 changes: 2 additions & 2 deletions src/backend/app-management/electron/events/when-ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ exports.whenReady = async () => {
startupScriptsManager.loadStartupConfig();

windowManagement.updateSplashScreenStatus("Starting chat moderation manager...");
const chatModerationManager = require("../../../chat/moderation/chat-moderation-manager");
chatModerationManager.load();
const { ChatModerationManager } = require("../../../chat/moderation/chat-moderation-manager");
ChatModerationManager.load();

windowManagement.updateSplashScreenStatus("Loading counters...");
const { CounterManager } = require("../../../counters/counter-manager");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ exports.windowsAllClosed = async () => {
const { HotkeyManager } = require("../../../hotkeys/hotkey-manager");
HotkeyManager.unregisterAllHotkeys();

// Stop the chat moderation service
const chatModerationManager = require("../../../chat/moderation/chat-moderation-manager");
chatModerationManager.stopService();

// Persist custom variables
if (SettingsManager.getSetting("PersistCustomVariables")) {
const customVariableManager = require("../../../common/custom-variable-manager");
Expand Down
4 changes: 2 additions & 2 deletions src/backend/chat/chat-listeners/twitch-chat-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chatCommandHandler = require("../commands/chat-command-handler");
const chatHelpers = require("../chat-helpers");
const activeUserHandler = require("./active-user-handler");
const accountAccess = require("../../common/account-access");
const chatModerationManager = require("../moderation/chat-moderation-manager");
const { ChatModerationManager } = require("../moderation/chat-moderation-manager");
const chatRolesManager = require("../../roles/chat-roles-manager");
const twitchEventsHandler = require("../../events/twitch-events");
const raidMessageChecker = require(".././moderation/raid-message-checker");
Expand Down Expand Up @@ -53,7 +53,7 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
streamerChatClient.onMessage(async (_channel, user, messageText, msg) => {
const firebotChatMessage = await chatHelpers.buildFirebotChatMessage(msg, messageText);

await chatModerationManager.moderateMessage(firebotChatMessage);
await ChatModerationManager.moderateMessage(firebotChatMessage);

if (firebotChatMessage.isVip === true) {
chatRolesManager.addVipToVipList({
Expand Down
Loading

0 comments on commit b9c645a

Please sign in to comment.