Closed Eric-Hacker closed 3 years ago
Hi Eric, this is actually a limitation on Twitch's IRC chat rate limit. If you put a delay between the Say() or combine the messages into one Say() call, it should work.
Thanks instafluff for the quick reply and thanks for the great library that makes getting started writing my own bot much easier for this JavaScript newbie. You are right. I have modified the code as follows and it works.
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/comfy.js@latest/dist/comfy.min.js"></script>
</head>
<body>
<script type="text/javascript">
var irc = "BroadcasterAccount";
var users = ["Larry","Moe","Curly"]
ComfyJS.onCommand = ( user, command, message, flags, extra ) => {
if( (flags.broadcaster || flags.mod) && command === "test" ) {
console.log( "!test was typed in chat" );
for(u in users) {
setTimeout( ComfyJS.Say , u * 2000, "Great job " + users[u], extra.channel );
}
}
} // End OnCommand
ComfyJS.Init( "BotAccount" , "oauth:thisisnottheoathtoken", ["BotAccount", irc ] );
</script>
</body>
</html>
I would like a bot to be able to reply multiple lines to a command. That does not seem to work. In the below example code, only the first reply to test goes to the channel.
Example code (sanitized):