Closed Galexion closed 3 years ago
client.say
requires 2 arguments. The channel and the message.
But I have that already.
if (commandName === '!d20') {
const num = rollDice();
client.say(target, `You rolled a ${num}.`);
console.log(`* Executed ${commandName} command`);
}
if (commandName === '!socials') {
client.say(target, `Twitter: twitter.com/TailsEraYT | Discord: discord.gg/pWh43mtmeX`);
console.log(`* Executed ${commandName} command`);
}
if (commandName === '!duelme') {
client.say(target, `HEY ME COME BATTLE THIS PERSON`);
console.log(`* Executed ${commandName} command`);
}
if (commandName === '!guess') {
if (args.length < 2) {
return client.say(target,`Did- Did you forget to say a Number after the command? ugh I NEED a number between 1 and 20.`);
}
let guessedNumber = Number(args[1])
const num = rollDice();
if (guessedNumber === num) {
client.say(target, `Right! Your Number that you needed to guess is ${num}!`);
} else {
client.say(target, `Dang. You Need to guess the Number ${num}.`);
}
console.log(`* Number is ${args[1]} / `, typeof args[1]);
console.log(`* Executed ${commandName} command`);
}
/* if(commandName === '!mute') {
let username = client.getUsername();
if (client.isMod("#TailsEraYT", username)) {
if(Number(args[1]) < 1 && args.length[1] >= 1) {
let muted = args[1]
} else {
client.say(target, `cannot continue without Username of the Muted.`);
}
if(Number(args[2]) < 1 && args.length[2] >= 1) {
let muteTimer = args[2]
} else {
let muteTimer = 300
}
client.timeout( target, muted, muteTimer, "Muted by Mod" ).then((data) => {
client.say(target, `${username} muted ${muted} for ${muteTimer} seconds.`);
console.log(`* Executed ${commandName} Command, ${data}`);
})
} else {
client.say(target, `${username}, your not a mod! > :<`);
console.log(`* Executed ${commandName} Command, ${username}`);
}
} */
//Special things not activated using commands
client.on("anongiftpaidupgrade", (channel, username, userstate) => {
client.say(target, `Thank you to ${username} for Continuing to be in the ${channel} gang!`);
console.log(`* ${username} subbed to ${channel}.`);
console.log(`* Executed Continued Sub Action`)
});
client.on("cheer", (channel, userstate, message) => {
client.say(`Cheers! ${channel} has sent the bits over! // ${message}`);
console.log(`* ${username} sent bits to ${channel}.`);
console.log(`* Executed Cheer Action`);
});
client.on("connecting", () => {
client.say(target, `Established Connection to ${target}.`);
console.log(`* Executed Login Message`);
});
client.on("raided", (channel, username, viewers) => {
client.say(target, `${channel}, be advised. ${username} is raiding THIS Channel with ${viewers} Viewers!`);
console.log(`* ${username} has raided with ${viewers} Viewers`);
console.log(`* Executed Raid Event.`)
});
client.on("resub", (channel, username, months, message, userstate, methods) => {
let cumulativeMonths = ~~userstate["msg-param-cumulative-months"];
client.say(target, `${username} has rejoined / Continued the ${channel} Sub Gang, With ${months} in!`)
});
client.on("subgift", (channel, username, streakMonths, recipient, methods, userstate) => {
client.say(target, `${username} has just gifted ${recipient} a Instant Join to the ${channel} Sub Gang! ${username} has sent ${senderCount} gifts already!`);
let senderCount = ~~userstate["msg-param-sender-count"];
console.log(`* ${username} has sent ${recipient} a sub in chat.`);
console.log(`* Executed Gift Event`);
});
client.on("submysterygift", (channel, username, numbOfSubs, methods, userstate) => {
client.say(target, `MYSTERY GIFT TIME! ${username} has sent ${numbOfSubs} Instant Invites to ${numbOfSubs}! ${username} has sent ${senderCount} subs alredy!`)
let senderCount = ~~userstate["msg-param-sender-count"];
console.log(`* ${username} has sent ${numbOfSubs} subs in chat.`);
console.log(`* Executed Mystry Gift Event`);
});
(that was an expert of the program)
Turns out it was just a unreturned message script. oops.
This one is missing the channel argument.
client.on("cheer", (channel, userstate, message) => {
client.say(`Cheers! ${channel} has sent the bits over! // ${message}`);
Try following the error stack to find the issues.
at client.onMessageHandler (C:\Users\Pizza Hutters\Desktop\Twitch IRC Bot\GalexionTTV TailsEraYT\bot.js:76:16)
At the end it says "bot.js:76:16
" which means line 76 in bot.js
.
I don't know if that's the complete code but it seems to have some serious issues. Where is target
coming from? Most of the handlers seem to be naming the channel argument "channel" instead of target. Not sure where target
is coming from. Make sure you're not nesting things improperly. You don't want to add event listeners within other event listeners.
Actual behaviour:
Bot Crashes with log error
Expected behaviour:
Muted Person or rejection message
Error log:
Server configuration