This commit is contained in:
hgw 2023-10-02 02:11:23 +00:00
commit 0d1412844c
11 changed files with 515 additions and 0 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
docker-compose.yml
scratch
config/example.default.json
config/default.json

134
.gitignore vendored Normal file
View File

@ -0,0 +1,134 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.env
scratch
config/default.json

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM node:16
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
USER node
COPY --chown=node:node package*.json ./
RUN npm i
COPY --chown=node:node . .
CMD [ "node", "bot.js" ]

15
LICENSE Normal file
View File

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2023 hogwart7
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

47
README.md Normal file
View File

@ -0,0 +1,47 @@
# Fascinus (fa-see-nus)
cold hard bot for cold hard chats
## Commands
- $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.
- $sneed - Pastes the Sneed's Feed and Seed copypasta.
- $rspam [LINES (def=100, max=100000)] - Spams x lines of random characters.
- $uspam [LINES (def=100, max=100000)] - Spams x lines of random unicode characters of varying length.
- $art [IMAGE URL (png/jpg)] - Creates IRC art using a source image.
- $godwords [AMOUNT (def=50, max=100000)] - Generate x amount of random words. Inspired by TempleOS.
## Deployment
1. Install Docker (required) and Docker Compose (optional, but strongly recommended)
2. Modify the info in the config block in `bot.js` to your taste.
3. Run `docker compose up` to begin. Append `-d` to start in the background and `--build` if you make any changes to any files
## Support
If you need assistance with installation or usage, join #5000 on `irc.supernets.org`
## 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.
## License
ISC License
Copyright (c) 2023 hogwart7
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
This repository contains a modified version of banter (https://github.com/phy1729/banter) which is licensed under GNU-GPL v3.0 and as such, this license does not apply to the contents of lib/banter.

91
bot.js Normal file
View File

@ -0,0 +1,91 @@
var irc = require("irc");
var config = require('config');
var fs = require("fs");
var readline = require('readline');
const { Worker } = require('worker_threads');
//var randomWords = require('better-random-words');
var connconfig = { //edit your shit here
server: config.get('irc.server'),
port: config.get('irc.port'),
SSL: config.get('irc.port'),
channels: config.get('irc.channels'),
botName: config.get('irc.nickname'),
userName: config.get('irc.username'),
realName: config.get('irc.realname')
};
var bot = new irc.Client(connconfig.server, connconfig.botName, {
channels: connconfig.channels,
secure: connconfig.SSL,
port: connconfig.port,
autoRejoin: true,
userName: connconfig.userName,
realName: connconfig.realName,
floodProtection: false,
floodProtectionDelay: 0
});
const timer = ms => new Promise(res => setTimeout(res, ms))
async function help(chan, sub) {
if (sub === undefined) {
var sub = "default"
}
if (sub === "default") {
bot.say(chan, 'Mercury - https://git.supernets.org/hogwart7/mercury')
bot.say(chan, "r!set [OPTION] [VALUE] - run r!help set for details")
}
}
async function rspam(chan, amt) {
var arr = []
if (amt > 10000) {
bot.say(chan, "no")
} else {
if (amt === undefined) {
var amt = 100
}
for(var i=0; i < amt; i++){
var string = generateRandomString(70);
await timer(2);
arr.push(string)
}
var output = arr.join("\n")
bot.say(chan, output);
}
}
async function godwords(chan, amt) {
if (amt > 100000) {
bot.say(chan, "no")
} else {
if (amt === undefined) {
var amt = 50
}
const worker = new Worker('./commands/godwords.js', {
workerData: {
amt
}
});
worker.once('message', (string) => {
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] === 'r!help') {
help(to, args[1]);
}
});
bot.addListener('error', function(message) {
console.log('error: ', message);
});
console.log('Starting Fascinus');

16
commands/godwords.js Normal file
View File

@ -0,0 +1,16 @@
const { parentPort, workerData } = require('worker_threads');
const { amt } = workerData;
var randomWords = require('../lib/randomword');
var output = [];
var string = [];
var text = [];
for(var i=0; i < amt; i++){
var word = randomWords({ exactly: 1 });
text.push(word);
}
var string = text.join(" ")
output.push(string);
parentPort.postMessage(output);
process.exit()

View File

@ -0,0 +1,13 @@
{
"irc": {
"server": "irc.supernets.org",
"port": 6697,
"ssl": "true",
"channels": [
"#5000"
],
"nickname": "mercury",
"username": "mercury",
"realname": "git.supernets.org/hogwart7/mercury"
}
}

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: '3.3'
services:
mercury:
container_name: mercury
build: .
restart: always
volumes:
- './config/default.json:/home/node/app/config/default.json'
- './config/settings.txt:/home/node/app/config/settings.txt'

158
package-lock.json generated Normal file
View File

@ -0,0 +1,158 @@
{
"name": "mercury",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mercury",
"version": "1.0.0",
"dependencies": {
"config": "^3.3.9",
"fs": "^0.0.1-security",
"irc": "^0.5.2"
}
},
"node_modules/config": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/config/-/config-3.3.9.tgz",
"integrity": "sha512-G17nfe+cY7kR0wVpc49NCYvNtelm/pPy8czHoFkAgtV1lkmcp7DHtWCdDu+C9Z7gb2WVqa9Tm3uF9aKaPbCfhg==",
"dependencies": {
"json5": "^2.2.3"
},
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"node_modules/iconv": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/iconv/-/iconv-2.2.3.tgz",
"integrity": "sha1-4ITWDut9c9p/CpwJbkyKvgkL+u0=",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"nan": "^2.3.5"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/irc": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/irc/-/irc-0.5.2.tgz",
"integrity": "sha1-NxT0doNlqW0LL3dryRFmvrJGS7w=",
"dependencies": {
"irc-colors": "^1.1.0"
},
"engines": {
"node": ">=0.10.0"
},
"optionalDependencies": {
"iconv": "~2.2.1",
"node-icu-charset-detector": "~0.2.0"
}
},
"node_modules/irc-colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/irc-colors/-/irc-colors-1.5.0.tgz",
"integrity": "sha512-HtszKchBQTcqw1DC09uD7i7vvMayHGM1OCo6AHt5pkgZEyo99ClhHTMJdf+Ezc9ovuNNxcH89QfyclGthjZJOw==",
"engines": {
"node": ">=6"
}
},
"node_modules/json5": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"bin": {
"json5": "lib/cli.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true
},
"node_modules/node-icu-charset-detector": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/node-icu-charset-detector/-/node-icu-charset-detector-0.2.0.tgz",
"integrity": "sha1-wjINo3Tdy2cfxUy0oOBB4Vb/1jk=",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"nan": "^2.3.3"
},
"engines": {
"node": ">=0.6"
}
}
},
"dependencies": {
"config": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/config/-/config-3.3.9.tgz",
"integrity": "sha512-G17nfe+cY7kR0wVpc49NCYvNtelm/pPy8czHoFkAgtV1lkmcp7DHtWCdDu+C9Z7gb2WVqa9Tm3uF9aKaPbCfhg==",
"requires": {
"json5": "^2.2.3"
}
},
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"iconv": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/iconv/-/iconv-2.2.3.tgz",
"integrity": "sha1-4ITWDut9c9p/CpwJbkyKvgkL+u0=",
"optional": true,
"requires": {
"nan": "^2.3.5"
}
},
"irc": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/irc/-/irc-0.5.2.tgz",
"integrity": "sha1-NxT0doNlqW0LL3dryRFmvrJGS7w=",
"requires": {
"iconv": "~2.2.1",
"irc-colors": "^1.1.0",
"node-icu-charset-detector": "~0.2.0"
}
},
"irc-colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/irc-colors/-/irc-colors-1.5.0.tgz",
"integrity": "sha512-HtszKchBQTcqw1DC09uD7i7vvMayHGM1OCo6AHt5pkgZEyo99ClhHTMJdf+Ezc9ovuNNxcH89QfyclGthjZJOw=="
},
"json5": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="
},
"nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true
},
"node-icu-charset-detector": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/node-icu-charset-detector/-/node-icu-charset-detector-0.2.0.tgz",
"integrity": "sha1-wjINo3Tdy2cfxUy0oOBB4Vb/1jk=",
"optional": true,
"requires": {
"nan": "^2.3.3"
}
}
}
}

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "mercury",
"version": "1.0.0",
"description": "",
"main": "bot.js",
"dependencies": {
"config": "^3.3.9",
"fs": "^0.0.1-security",
"irc": "^0.5.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "hogwart7",
"license": ""
}