fascinus/bot.js

130 lines
4.0 KiB
JavaScript
Raw Normal View History

2023-10-02 02:14:35 +00:00
var irc = require("irc");
var fs = require("fs");
var request = require('request');
var art = require('ascii-art');
var crypto = require('crypto').webcrypto;
2023-10-02 02:14:35 +00:00
var randomext = require('./random')
2023-10-02 02:14:35 +00:00
var config = { //edit your shit here
2023-10-02 02:14:35 +00:00
server: "irc.supernets.org",
2023-10-02 02:14:35 +00:00
port: 6697,
SSL: true,
2023-10-02 02:14:36 +00:00
channels: ['#dev'],
2023-10-02 02:14:35 +00:00
botName: "fascinus",
2023-10-02 02:14:35 +00:00
userName: "fascinus",
realName: "Sneed"
};
var bot = new irc.Client(config.server, config.botName, {
2023-10-02 02:14:35 +00:00
channels: config.channels,
2023-10-02 02:14:35 +00:00
secure: config.SSL,
port: config.port,
autoRejoin: true,
userName: config.userName,
realName: config.realName,
floodProtection: false,
floodProtectionDelay: 0
});
2023-10-02 02:14:35 +00:00
const timer = ms => new Promise(res => setTimeout(res, ms))
2023-10-02 02:14:35 +00:00
const generateRandomString = (amt) => {
const chars =
"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890`!@#$%^&*()_+{}|\"\',./ᘈᷞኬᲡ᩶ᐨᅚ⸗⡳ᾟⓅᤲ⧛ሥ⸰⯠ᬨ⧻Შ⼷ᢕ᭄◁ⱉጻ៾᪅⎑ᘂᏤ⛰⃡";
const randomArray = Array.from(
{ length: amt },
(v, k) => chars[Math.floor(Math.random() * chars.length)]
);
const randomString = randomArray.join("");
return randomString;
}
async function help(chan) {
2023-10-02 02:14:35 +00:00
bot.say(chan, 'Fascinus - https://git.supernets.org/hogwart7/fascinus')
2023-10-02 02:14:35 +00:00
bot.say(chan, "$flood [AMOUNT] [TEXT] - Floods the channel with a specific line x amount of times")
2023-10-02 02:14:35 +00:00
bot.say(chan, "$ctcpflood [TARGET] [TEXT (one word)] [AMOUNT] - Sends x amount of CTCP requests to a target.")
bot.say(chan, "$sneed - Pastes the Sneed's Feed and Seed copypasta.")
2023-10-02 02:14:35 +00:00
bot.say(chan, "$rspam [LINES] - Spams x lines of random characters")
bot.say(chan, "$uspam [LINES] - Spams x lines of random unicode characters of varying length")
2023-10-02 02:14:35 +00:00
}
2023-10-02 02:14:36 +00:00
async function flood(chan, arg) {
arg.shift() //$flood
let amt = arg.shift() //number
var text = arg.join(" ")
2023-10-02 02:14:35 +00:00
if (amt > 100000) {
2023-10-02 02:14:35 +00:00
bot.say(chan, "no");
} else {
for(var i=0; i < amt; i++){
bot.say(chan, text);
}
2023-10-02 02:14:35 +00:00
}
}
async function sneed(chan) {
bot.say(chan, 'THE SIGN IS A SUBTLE JOKE. THE SHOP IS CALLED \"SNEED\'S FEED & SEED\", WHERE')
bot.say(chan, 'FEED AND SEED BOTH END IN THE SOUND "-EED", THUS RHYMING WITH THE NAME OF')
bot.say(chan, 'THE OWNER, SNEED. THE SIGN SAYS THAT THE SHOP WAS "FORMERLY CHUCK\'S", IMPLYING')
bot.say(chan, 'THAT THE TWO WORDS BEGINNING WITH "F" AND "S" WOULD HAVE ENDED WITH "-UCK",')
bot.say(chan, 'RHYMING WITH "CHUCK". SO, WHEN CHUCK OWNED THE SHOP, IT WOULD HAVE BEEN CALLED')
bot.say(chan, '"CHUCK\'S FUCK AND SUCK".')
}
async function ctcp(target, text, amt) {
2023-10-02 02:14:35 +00:00
if (amt > 100000) {
2023-10-02 02:14:35 +00:00
bot.say(chan, "no");
} else {
for(var i=0; i < amt; i++){
bot.ctcp(target, "privmsg", text);
await timer(1000);
}
}
2023-10-02 02:14:35 +00:00
}
2023-10-02 02:14:36 +00:00
async function uspam(chan, amt) {
2023-10-02 02:14:35 +00:00
if (amt > 100000) {
2023-10-02 02:14:35 +00:00
bot.say(chan, "no")
} else {
for(var i=0; i < amt; i++){
2023-10-02 02:14:36 +00:00
var string = "" + randomext.integer(9,0) + randomext.uString(120,40);
2023-10-02 02:14:36 +00:00
await timer(5);
bot.say(chan, string);
}
}
}
async function rspam(chan, amt) {
if (amt > 100000) {
bot.say(chan, "no")
} else {
for(var i=0; i < amt; i++){
var string = generateRandomString(70);
2023-10-02 02:14:35 +00:00
await timer(5);
bot.say(chan, string);
2023-10-02 02:14:35 +00:00
}
}
2023-10-02 02:14:35 +00:00
}
bot.addListener('message', function(nick, to, text, from) {
var args = text.split(' ');
if (args[0] === '$help') {
help(to);
} else if (args[0] === '$flood') {
2023-10-02 02:14:36 +00:00
flood(to, args)
2023-10-02 02:14:35 +00:00
} else if (args[0] === '$sneed') {
sneed(to);
} else if (args[0] === '$ctcpflood') {
ctcp(args[1], args[2], args[3]);
} else if (args[0] === '$rspam') {
2023-10-02 02:14:36 +00:00
rspam(to, args[1])
2023-10-02 02:14:35 +00:00
} else if (args[0] === '$uspam') {
2023-10-02 02:14:36 +00:00
uspam(to, args[1]);
2023-10-02 02:14:35 +00:00
}
});
bot.addListener('error', function(message) {
console.log('error: ', message);
});
console.log('Starting Fascinus');