Fixed Simple Chat Responses
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
const { dClient, mClient, tClient } = require('../..')
|
||||
|
||||
|
||||
require('dotenv').configDotenv
|
||||
|
||||
const knownBots = new Set(['streamlabs', 'nightbot', 'moobot', 'soundalerts', 'streamelements', 'remasuri_bot', 'commanderroot', 'x__hel_bot__x'])
|
||||
module.exports = {
|
||||
name: 'Twitch/Message',
|
||||
once: false,
|
||||
async execute(channel, userstate, message, self, tClient) {
|
||||
const { dClient, mClient } = require('../../index')
|
||||
const knownBots = new Set(['streamlabs', 'nightbot', 'moobot', 'soundalerts', 'streamelements', 'remasuri_bot', 'commanderroot', 'x__hel_bot__x'])
|
||||
async function updateChatMode(userID, setTo) {
|
||||
let state
|
||||
if (setTo === 'on') {
|
||||
@@ -19,6 +20,7 @@ async function updateChatMode(userID, setTo) {
|
||||
subscriber_mode: state,
|
||||
emote_mode: state
|
||||
});
|
||||
|
||||
}
|
||||
async function getIDByName(user) {
|
||||
const result = await Helix.users.get(user);
|
||||
@@ -37,10 +39,6 @@ async function verifyUser(channel, username) {
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
name: 'Twitch/Message',
|
||||
once: false,
|
||||
async execute(channel, userstate, message, self) {
|
||||
if (self) { return }
|
||||
if (knownBots.has(userstate.username)) { return }
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ const dClient = new Client({
|
||||
GatewayIntentBits.MessageContent,
|
||||
],
|
||||
});
|
||||
exports.dClient = dClient;
|
||||
|
||||
// Load Discord event handlers
|
||||
fs.readdirSync('./handlers').forEach((handler) => {
|
||||
@@ -219,19 +218,19 @@ async function tLogin() {
|
||||
|
||||
// Handle Twitch events
|
||||
tClient.on('connected', (address, port) => {
|
||||
dClient.emit('Twitch/Connected', address, port);
|
||||
dClient.emit('Twitch/Connected', address, port, tClient);
|
||||
});
|
||||
|
||||
tClient.on('message', async (channel, userstate, message, self) => {
|
||||
dClient.emit('Twitch/Message', channel, userstate, message, self);
|
||||
dClient.emit('Twitch/Message', channel, userstate, message, self, tClient);
|
||||
});
|
||||
|
||||
tClient.on('raided', (channel, username, viewers) => {
|
||||
dClient.emit('Twitch/Raided', channel, username, viewers);
|
||||
dClient.emit('Twitch/Raided', channel, username, viewers, tClient);
|
||||
});
|
||||
|
||||
tClient.on('subscribers', (channel, enabled) => {
|
||||
dClient.emit('Twitch/Subscribers', channel, enabled);
|
||||
dClient.emit('Twitch/Subscribers', channel, enabled, tClient);
|
||||
});
|
||||
|
||||
tClient.on('disconnected', (reason) => {
|
||||
@@ -248,3 +247,4 @@ async function tLogin() {
|
||||
|
||||
tLogin();
|
||||
|
||||
module.exports = { mClient, dClient };
|
||||
Reference in New Issue
Block a user