merge rspam and uspam functions

This commit is contained in:
hgw 2023-10-02 02:14:35 +00:00
parent 96b361ce07
commit a4b7c5a7ec

24
bot.js
View File

@ -78,22 +78,18 @@ async function ctcp(target, text, amt) {
} }
} }
async function rspam(chan, amt) { async function spam(chan, amt, type) {
if (amt > '100000') { if (amt > 100000) {
bot.say(chan, "no") bot.say(chan, "no")
} else { } else {
for(var i=0; i < amt; i++){ for(var i=0; i < amt; i++){
bot.say(chan, generateRandomString(randomext.integer(100,60))); 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);
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));
} }
} }
} }
@ -109,9 +105,9 @@ bot.addListener('message', function(nick, to, text, from) {
} else if (args[0] === '$ctcpflood') { } else if (args[0] === '$ctcpflood') {
ctcp(args[1], args[2], args[3]); ctcp(args[1], args[2], args[3]);
} else if (args[0] === '$rspam') { } else if (args[0] === '$rspam') {
rspam(to, args[1]) spam(to, args[1], "random")
} else if (args[0] === '$uspam') { } else if (args[0] === '$uspam') {
uspam(to, args[1]); spam(to, args[1], "unicode");
} }
}); });