From a4b7c5a7ec936aab58284f00de5dc60f645e2335 Mon Sep 17 00:00:00 2001 From: hgw Date: Mon, 2 Oct 2023 02:14:35 +0000 Subject: [PATCH] merge rspam and uspam functions --- bot.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/bot.js b/bot.js index 27d4cdf..a71122d 100644 --- a/bot.js +++ b/bot.js @@ -78,22 +78,18 @@ async function ctcp(target, text, amt) { } } -async function rspam(chan, amt) { - if (amt > '100000') { +async function spam(chan, amt, type) { + if (amt > 100000) { bot.say(chan, "no") } else { for(var i=0; i < amt; i++){ - bot.say(chan, generateRandomString(randomext.integer(100,60))); - } - } -} - -async function uspam(chan, amt){ - if (amt > '100000') { - bot.say(chan, "no") - } else { - for(var i=0; i < amt; i++){ - bot.say(chan, "0" + randomext.integer(9,0) + randomext.uString(120,40)); + if (type == "unicode") { + var string = randomext.integer(9,0) + randomext.uString(120,40); + } else if (type == "random") { + var string = generateRandomString(70); + } + await timer(5); + bot.say(chan, string); } } } @@ -109,9 +105,9 @@ bot.addListener('message', function(nick, to, text, from) { } else if (args[0] === '$ctcpflood') { ctcp(args[1], args[2], args[3]); } else if (args[0] === '$rspam') { - rspam(to, args[1]) + spam(to, args[1], "random") } else if (args[0] === '$uspam') { - uspam(to, args[1]); + spam(to, args[1], "unicode"); } });