off-loaded common functions

This commit is contained in:
DeSqBlocki
2025-02-08 17:07:13 +01:00
parent 5397e076ca
commit f978dbdf2e
7 changed files with 22 additions and 13 deletions
+3 -1
View File
@@ -1,9 +1,11 @@
const { mClient, dClient } = require('../..')
const { updateChatMode, getIDByName } = require('../../functions')
require('dotenv').configDotenv
module.exports = {
name: 'Twitch/Message',
once: false,
async execute(channel, userstate, message, self, tClient) {
const { dClient, mClient, getIDByName, updateChatMode } = require('../../index')
const knownBots = new Set(['streamlabs', 'nightbot', 'moobot', 'soundalerts', 'streamelements', 'remasuri_bot', 'commanderroot', 'x__hel_bot__x'])
async function emitShoutoutInfo(channel, username) {
// Function sends information to the Shoutout Handler if they haven't been shouted out before, default target: VIPs
+3 -2
View File
@@ -1,9 +1,10 @@
const { dClient, tClient } = require("../..")
// Event triggered by Raid
module.exports = {
name: 'Twitch/Raided',
once: false,
execute(channel, username, raiders, tClient) {
const { dClient } = require('../../index')
execute(channel, username, raiders) {
tClient.say(channel, `${username} entrusted us with ${raiders} people of their community, welcome xhelxBlankie`)
dClient.emit('Twitch/Shoutout', "RAID", channel, username)
}
+2 -1
View File
@@ -1,3 +1,5 @@
const { getChannelInformation, getIDByName } = require("../../functions");
// Event triggered by Custom Shoutout emitted in Messages.js
const soBuffer = new Map();
let isShoutoutInProgress = false; // Track shoutout status to avoid overlapping shoutouts
@@ -6,7 +8,6 @@ module.exports = {
name: 'Twitch/Shoutout',
once: false,
async execute(reason, channel, username, tClient) {
const { getIDByName, getChannelInformation } = require('../../index');
// Function to perform shoutout (Nightbot or custom)
async function doShoutouts(channel, user) {
+2 -1
View File
@@ -1,9 +1,10 @@
const { mClient } = require("../..")
// Event triggered by SubscribersOnly mode
module.exports = {
name: 'Twitch/Subscribers',
once: false,
async execute(channel, enabled) {
const { mClient } = require('../..')
let db = mClient.db('shoutouts')
let col = db.collection(channel)