added settings

This commit is contained in:
DeSqBlocki
2025-02-13 21:04:53 +01:00
parent 5b07182020
commit 85f031c33a
8 changed files with 155 additions and 29 deletions
+8 -2
View File
@@ -21,7 +21,7 @@ module.exports = {
})
}
}
if (self) { return }
if (knownBots.has(userstate.username)) { return }
@@ -54,7 +54,13 @@ module.exports = {
dClient.emit('Command/positivity', channel, userstate, message, self)
break;
case "commands":
dClient.emit('Command/commands', channel, userstate, message, self, args[1], args[2])
dClient.emit('Command/commands', channel, userstate, message, self, args[1], args[2])
break;
case "settings":
dClient.emit('Command/settings', channel, userstate, message, self, args[1], args[2])
break;
case "so":
dClient.emit('Command/so', channel, userstate, message, self, args[1])
break;
default:
break;
+16 -2
View File
@@ -1,4 +1,4 @@
const { tClient } = require("../..");
const { tClient, mClient } = require("../..");
const { getChannelInformation } = require("../../functions");
// Event triggered by Custom Shoutout emitted in Messages.js
@@ -9,7 +9,21 @@ module.exports = {
name: 'Twitch/Shoutout',
once: false,
async execute(reason, channel, username) {
// Check if shoutout is enabled
const db = mClient.db('settings')
const coll = db.collection(channel)
const setting = await coll.findOne({ name: 'shoutout' })
// create in disabled state if not exists
if (!setting) {
await coll.insertOne({
name: 'shoutout',
enabled: false // default
})
}
if (!setting?.enabled && reason != 'command' ){ return }
// Function to perform shoutout (Nightbot or custom)
async function doShoutouts(channel, user) {
try {