move subfiles for commands to own folder

This commit is contained in:
hgw 2023-10-02 02:14:36 +00:00
parent d5fdf36f77
commit 63baf493ac
2 changed files with 7 additions and 17 deletions

16
bot.js
View File

@ -10,7 +10,7 @@ var config = { //edit your shit here
server: "irc.supernets.org", server: "irc.supernets.org",
port: 6697, port: 6697,
SSL: true, SSL: true,
channels: ['#dev'], channels: ['#dev', '#superbowl'],
botName: "fascinus", botName: "fascinus",
userName: "fascinus", userName: "fascinus",
realName: "Sneed" realName: "Sneed"
@ -115,7 +115,6 @@ async function rspam(chan, amt) {
} }
async function art(chan, url) { async function art(chan, url) {
var ext = path.extname(url) var ext = path.extname(url)
if (ext === ".png") { if (ext === ".png") {
var filetype = "png" var filetype = "png"
@ -157,28 +156,21 @@ async function godwords(chan, amt) {
if (amt > 100000) { if (amt > 100000) {
bot.say(chan, "no") bot.say(chan, "no")
} else { } else {
if (amt === undefined) { if (amt === undefined) {
var amt = 50 var amt = 50
} }
//for(var i=0; i < amt; i++){ const worker = new Worker('./commands/godwords.js', {
// var word = randomWords({ exactly: 1 });
// text.push(word);
// var string = text.join(" ")
//}
const worker = new Worker('./wordgen.js', {
workerData: { workerData: {
amt amt
} }
}); });
worker.once('message', (string) => { worker.once('message', (string) => {
console.log('Received the hashedArray from the worker thread!'); console.log('Received string from worker, posting.');
bot.say(chan, string); bot.say(chan, string);
}); });
} }
} }
bot.addListener('message', function(nick, to, text, from) { bot.addListener('message', function(nick, to, text, from) {
var args = text.split(' '); var args = text.split(' ');
if (args[0] === '$help') { if (args[0] === '$help') {
@ -204,4 +196,4 @@ bot.addListener('error', function(message) {
console.log('error: ', message); console.log('error: ', message);
}); });
console.log('Starting Fascinus'); console.log('Starting Fascinus');

View File

@ -2,7 +2,7 @@ const { parentPort, workerData } = require('worker_threads');
const { amt } = workerData; const { amt } = workerData;
var randomWords = require('better-random-words'); var randomWords = require('better-random-words');
var hashedArray = []; var output = [];
var string = []; var string = [];
var text = []; var text = [];
for(var i=0; i < amt; i++){ for(var i=0; i < amt; i++){
@ -10,9 +10,7 @@ for(var i=0; i < amt; i++){
text.push(word); text.push(word);
} }
var string = text.join(" ") var string = text.join(" ")
hashedArray.push(string);
//console.log(string);
// send the hashedArray to the parent thread output.push(string);
parentPort.postMessage(hashedArray); parentPort.postMessage(output);
process.exit() process.exit()