Compare commits

...

3 Commits

Author SHA1 Message Date
hgw
59dc4bc980
Update README 2023-10-03 00:16:14 +00:00
hgw
2e138d5906
Add brackets setting to example config 2023-10-03 00:10:09 +00:00
hgw
0716e7ede2
Correct config file names 2023-10-03 00:09:23 +00:00
4 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,9 @@
#### 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 were not multithreaded and was very 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 was at one point extraordinarily 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
@ -13,6 +15,11 @@ 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/default.json'); var config = require('./config/config.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/default.json') const config = require('../config/config.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,7 +24,8 @@
}, },
"colours": { "colours": {
"warning": "08", "warning": "08",
"error": "04" "error": "04",
"brackets": "15"
}, },
"misc": { "misc": {
"logging": "true" "logging": "true"