add art command
This commit is contained in:
parent
7092ff4ded
commit
77cb76e48f
@ -1,8 +1,12 @@
|
|||||||
FROM node:14
|
FROM node:16
|
||||||
|
RUN apt update && apt install -y python3 python3-pip wget
|
||||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||||
|
RUN mkdir -p /tmp/fascinus && chown -R node:node /tmp/fascinus
|
||||||
WORKDIR /home/node/app
|
WORKDIR /home/node/app
|
||||||
COPY package*.json ./
|
|
||||||
USER node
|
USER node
|
||||||
|
COPY --chown=node:node banter/requirements.txt .
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
COPY --chown=node:node package*.json ./
|
||||||
RUN npm i
|
RUN npm i
|
||||||
COPY --chown=node:node . .
|
COPY --chown=node:node . .
|
||||||
CMD [ "node", "bot.js" ]
|
CMD [ "node", "bot.js" ]
|
@ -7,5 +7,10 @@ cold hard bot for cold hard chats
|
|||||||
- $flood [AMOUNT] [TEXT] - Floods the channel with a specific line x amount of times
|
- $flood [AMOUNT] [TEXT] - Floods the channel with a specific line x amount of times
|
||||||
- $ctcpflood [TARGET] [TEXT (one word)] [AMOUNT] - Sends x amount of CTCP requests to a target.
|
- $ctcpflood [TARGET] [TEXT (one word)] [AMOUNT] - Sends x amount of CTCP requests to a target.
|
||||||
- $sneed - Pastes the Sneed's Feed and Seed copypasta.
|
- $sneed - Pastes the Sneed's Feed and Seed copypasta.
|
||||||
- $rspam [LINES] - Spams x lines of random characters
|
- $rspam [LINES] - Spams x lines of random characters.
|
||||||
- $uspam [LINES] - Spams x lines of random unicode characters of varying length
|
- $uspam [LINES] - Spams x lines of random unicode characters of varying length.
|
||||||
|
- $art [IMAGE URL (png/jpg)] - Creates IRC art using a source image.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- [phy1729/banter](https://github.com/phy1729/banter) - $art uses a version of banter modified to allow URLs in place of local image files. These changes will be published upstream once refined.
|
@ -74,7 +74,7 @@ if __name__ == "__main__":
|
|||||||
args.file,
|
args.file,
|
||||||
float(args.d),
|
float(args.d),
|
||||||
int(args.w),
|
int(args.w),
|
||||||
str(args.t),
|
|
||||||
args.colorfmt.encode().decode("unicode_escape"),
|
args.colorfmt.encode().decode("unicode_escape"),
|
||||||
args.filler.encode().decode("unicode_escape")
|
args.filler.encode().decode("unicode_escape"),
|
||||||
|
str(args.t)
|
||||||
)
|
)
|
||||||
|
49
bot.js
49
bot.js
@ -1,15 +1,15 @@
|
|||||||
var irc = require("irc");
|
var irc = require("irc");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var request = require('request');
|
var readline = require('readline');
|
||||||
var art = require('ascii-art');
|
var path = require('path');
|
||||||
var crypto = require('crypto').webcrypto;
|
var randomext = require('./random');
|
||||||
var randomext = require('./random')
|
const { nextTick } = require("process");
|
||||||
|
|
||||||
var config = { //edit your shit here
|
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: ['#fascinus'],
|
||||||
botName: "fascinus",
|
botName: "fascinus",
|
||||||
userName: "fascinus",
|
userName: "fascinus",
|
||||||
realName: "Sneed"
|
realName: "Sneed"
|
||||||
@ -46,6 +46,7 @@ async function help(chan) {
|
|||||||
bot.say(chan, "$sneed - Pastes the Sneed's Feed and Seed copypasta.")
|
bot.say(chan, "$sneed - Pastes the Sneed's Feed and Seed copypasta.")
|
||||||
bot.say(chan, "$rspam [LINES] - Spams x lines of random characters")
|
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")
|
bot.say(chan, "$uspam [LINES] - Spams x lines of random unicode characters of varying length")
|
||||||
|
bot.say(chan, "$art [IMAGE URL (png/jpg)] - Creates IRC art using a source image.")
|
||||||
}
|
}
|
||||||
|
|
||||||
async function flood(chan, arg) {
|
async function flood(chan, arg) {
|
||||||
@ -105,6 +106,42 @@ async function rspam(chan, amt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function art(chan, url) {
|
||||||
|
var ext = path.extname(url)
|
||||||
|
if (ext === ".png") {
|
||||||
|
var filetype = "png"
|
||||||
|
} else if (ext === ".jpg") {
|
||||||
|
var filetype = "jpg"
|
||||||
|
} else {
|
||||||
|
bot.say(chan, "Image must be PNG or JPG");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log("Starting Banter")
|
||||||
|
const spawn = require("child_process").spawn;
|
||||||
|
const pythonProcess = spawn('python3', ["banter/banter.py", url, "-t", filetype])
|
||||||
|
pythonProcess.stdout.on('data', (data) => {
|
||||||
|
console.log(data.toString())
|
||||||
|
});
|
||||||
|
await timer(1000);
|
||||||
|
fs.stat('output.txt', function(err, stat) {
|
||||||
|
if (err == null) {
|
||||||
|
console.log('File exists');
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: fs.createReadStream('output.txt'),
|
||||||
|
crlfDelay: Infinity,
|
||||||
|
});
|
||||||
|
rl.on('line', (line) => {
|
||||||
|
bot.say(chan, line);
|
||||||
|
});
|
||||||
|
} else if (err.code === 'ENOENT') {
|
||||||
|
bot.say(chan, "Error")
|
||||||
|
} else {
|
||||||
|
bot.say(chan, "Error")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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') {
|
||||||
@ -119,6 +156,8 @@ bot.addListener('message', function(nick, to, text, from) {
|
|||||||
rspam(to, args[1])
|
rspam(to, args[1])
|
||||||
} else if (args[0] === '$uspam') {
|
} else if (args[0] === '$uspam') {
|
||||||
uspam(to, args[1]);
|
uspam(to, args[1]);
|
||||||
|
} else if (args[0] === '$art') {
|
||||||
|
art(to, args[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,3 +4,5 @@ services:
|
|||||||
container_name: fascinus
|
container_name: fascinus
|
||||||
build: .
|
build: .
|
||||||
restart: always
|
restart: always
|
||||||
|
dns:
|
||||||
|
- 1.1.1.1
|
0
output.txt
Normal file
0
output.txt
Normal file
3913
package-lock.json
generated
3913
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,12 +4,8 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ascii-art": "^2.8.5",
|
|
||||||
"crypto": "^1.0.1",
|
|
||||||
"dotenv": "^16.3.1",
|
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"irc": "^0.5.2",
|
"irc": "^0.5.2"
|
||||||
"request": "^2.88.2"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
Loading…
Reference in New Issue
Block a user