Compare commits

..

No commits in common. "59dc4bc980298ebec3845eb4577f3df6a6be689a" and "23dd42c963f2bbcc8811bb71e3b22f3c6286f7f5" have entirely different histories.

4 changed files with 4 additions and 12 deletions

View File

@ -2,9 +2,7 @@
#### node.js IRC bot framework #### node.js IRC bot framework
Bones is the base framework I use for creating multithreaded IRC bots, originally developed as a way to hugely improve on the speeds of earlier versions of mercury which was at one point extraordinarily slow. Bones is the base framework I use for creating multithreaded IRC bots, originally developed as a way to hugely improve on the speeds of earlier versions of mercury (which were not multithreaded and was very slow)
Bones will open all called bot commands in their own node process and then feed back the output as a string to the main file in order to be sent to IRC. This way the main process effectively only acts as a handler for prompts, forcing all outputs to be generated in seperate processes means the bot operates much faster than if the entire thing was just in the main bot.js file.
## Deployment ## Deployment
@ -15,11 +13,6 @@ Instructions are general and assume you have already developed something with th
3. You may also want to edit the container names in the `docker-compose.yml` file accordingly. (Optional but recommended) 3. You may also want to edit the container names in the `docker-compose.yml` file accordingly. (Optional but recommended)
4. Run `docker compose up` to begin. Append `-d` to start in the background and `--build` for the first run and subsequent starts after edits have been made. If you begin the bot with `-d` you can run `docker compose logs -f` to see live logs. 4. Run `docker compose up` to begin. Append `-d` to start in the background and `--build` for the first run and subsequent starts after edits have been made. If you begin the bot with `-d` you can run `docker compose logs -f` to see live logs.
## Examples
- mercury (https://git.supernets.org/hgw/mercury)
- fascinus (https://git.supernets.org/hgw/fascinus)
## Support ## Support
If you need assistance with installation or usage, you are more than welcome to contact me in #5000 on `irc.supernets.org` If you need assistance with installation or usage, you are more than welcome to contact me in #5000 on `irc.supernets.org`

2
bot.js
View File

@ -5,7 +5,7 @@
// / /_/ / /_/ / / / / __(__ ) // / /_/ / /_/ / / / / __(__ )
// /_.___/\____/_/ /_/\___/____/ // /_.___/\____/_/ /_/\___/____/
// //
var config = require('./config/config.json'); var config = require('./config/default.json');
var irc = require("irc"); var irc = require("irc");
var fs = require("fs"); var fs = require("fs");
const { Worker } = require('worker_threads'); const { Worker } = require('worker_threads');

View File

@ -1,4 +1,4 @@
const config = require('../config/config.json') const config = require('../config/default.json')
const { parentPort, workerData } = require('worker_threads'); const { parentPort, workerData } = require('worker_threads');
const { d1, d2 } = workerData; //Declare all used variables here (if you only pass 1 variable to this command you only really need d1 in here, but it doesnt matter) const { d1, d2 } = workerData; //Declare all used variables here (if you only pass 1 variable to this command you only really need d1 in here, but it doesnt matter)
var var1 = d1; // Declaring d1 as var1, just for consistancy with the last file but again, this may not be necessary in all cases. var var1 = d1; // Declaring d1 as var1, just for consistancy with the last file but again, this may not be necessary in all cases.

View File

@ -24,8 +24,7 @@
}, },
"colours": { "colours": {
"warning": "08", "warning": "08",
"error": "04", "error": "04"
"brackets": "15"
}, },
"misc": { "misc": {
"logging": "true" "logging": "true"