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

14
bot.js
View File

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

View File

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