Compare commits

...

2 Commits

Author SHA1 Message Date
hgw be8377c329
add symphish command 2023-10-04 00:35:47 +00:00
hgw 53b6623ae2
Bump phishies to 1.1.0 2023-10-03 04:16:21 +00:00
4 changed files with 26 additions and 11 deletions

10
bot.js
View File

@ -81,7 +81,11 @@ async function godwords(chan, amt) {
}
async function phish(chan, height, width) {
openPostWorker(chan, 'phish', height, width)
openPostWorker(chan, 'phish', height, width, "em")
}
async function symphish(chan, height, width) {
openPostWorker(chan, 'phish', height, width, "sym")
}
bot.addListener('message', function(nick, to, text, from) {
@ -117,7 +121,9 @@ bot.addListener('message', function(nick, to, text, from) {
godwords(to, args[1]);
} else if (command === config.irc.prefix+'phish') {
phish(to, args[1], args[2])
}
} else if (command === config.irc.prefix+'symphish') {
symphish(to, args[1], args[2])
}
msgTimeout.add(to);
setTimeout(() => {
msgTimeout.delete(to);

View File

@ -1,8 +1,9 @@
const config = require('../config/config.json')
const { parentPort, workerData } = require('worker_threads');
const { d1, d2 } = workerData;
const { d1, d2, d3 } = workerData;
var height = d1
var width = d2
var type = d3
var phish = require('phishies');
const timer = ms => new Promise(res => setTimeout(res, ms))
@ -33,6 +34,17 @@ async function sendUpstream(content) {
process.exit()
}
function gen(height, width, type) {
consoleLog('[phish] Generating phish output')
if (type == "em") {
var aquarium = phish.aquarium(height, width)
} else if (type == "sym") {
var aquarium = phish.aquarium_sym(height, width)
}
var output = aquarium.join("\n")
sendUpstream(output)
}
if (height > 100) {
consoleLog('[phish] Height requesteed was over the maximum allowable amount, defaulting to maximum')
height = 100
@ -49,7 +61,4 @@ if (width == undefined) {
consoleLog('[phish] Width was not specified, defaulting to 5')
width = 7
}
consoleLog('[phish] Generating phish output')
var aquarium = phish.aquarium(height, width)
var output = aquarium.join("\n")
sendUpstream(output)
gen(height, width, type)

6
package-lock.json generated
View File

@ -49,9 +49,9 @@
}
},
"phishies": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/phishies/-/phishies-1.0.2.tgz",
"integrity": "sha512-uZArCHgYfx7GfpPGUJiQL+eh+6ksj5KGz5n9gJMjbfdk5KJEh+UZGNe4qTgmZGqeFR9NVAaL18+cebsfE7D02g=="
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/phishies/-/phishies-1.2.0.tgz",
"integrity": "sha512-1Z4Mt3es3NEkEFyYyOnVAyiDeGghh40IrAQ10lcUQbmNkoI3ZfaHomCDffir4w9x6XVjHCl21doUjCokBMry5Q=="
}
}
}

View File

@ -6,7 +6,7 @@
"dependencies": {
"fs": "^0.0.1-security",
"irc": "^0.5.2",
"phishies": "^1.0.2"
"phishies": "^1.2.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"