tweaks
This commit is contained in:
parent
3c5183192e
commit
ab57ca89f6
@ -3,7 +3,7 @@
|
||||
"name": "control",
|
||||
"description": "Squeebot Plugin Management API and sockets",
|
||||
"tags": ["api", "control", "management"],
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"dependencies": [],
|
||||
"npmDependencies": []
|
||||
}
|
||||
|
@ -15,77 +15,6 @@ import fs from 'fs/promises';
|
||||
import tls, { TLSSocket } from 'tls';
|
||||
import net, { Server, Socket } from 'net';
|
||||
|
||||
/*
|
||||
const sc = {
|
||||
instances: {
|
||||
type: 'array',
|
||||
description: 'List of instances',
|
||||
default: [],
|
||||
format: {
|
||||
name: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
description: 'Instance name',
|
||||
default: 'general',
|
||||
},
|
||||
restart: {
|
||||
type: 'boolean',
|
||||
optional: true,
|
||||
description: 'Automatic restart on failure',
|
||||
default: false,
|
||||
},
|
||||
irc: {
|
||||
type: 'object',
|
||||
format: {
|
||||
nick: {
|
||||
type: 'string',
|
||||
default: 'Squeebot',
|
||||
},
|
||||
host: {
|
||||
type: 'string',
|
||||
default: 'localhost',
|
||||
},
|
||||
port: {
|
||||
type: 'number',
|
||||
default: 6667,
|
||||
},
|
||||
password: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
sasl: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
ssl: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
channels: {
|
||||
type: 'array',
|
||||
entryType: 'string',
|
||||
default: [],
|
||||
},
|
||||
nickserv: {
|
||||
type: 'object',
|
||||
format: {
|
||||
enabled: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
command: {
|
||||
type: 'string',
|
||||
default: 'STATUS',
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
interface ControlCommand {
|
||||
execute: Function;
|
||||
name: string;
|
||||
@ -468,9 +397,9 @@ async function parseTLSConfig(tlsconfig: StringAny): Promise<StringAny> {
|
||||
})
|
||||
class ControlPlugin extends Plugin {
|
||||
public core: ISqueebotCore | null = null;
|
||||
public plugins: Map<string, any> = new Map<string, any>();
|
||||
public plugins = new Map<string, any>();
|
||||
private server: Server | null = null;
|
||||
private sockets: Set<Socket> = new Set<Socket>();
|
||||
private sockets = new Set<Socket>();
|
||||
|
||||
public initialize(): void {
|
||||
this.addEventListener('core', (core: ISqueebotCore) => this.core = core);
|
||||
@ -667,16 +596,17 @@ class ControlPlugin extends Plugin {
|
||||
this.plugins.clear();
|
||||
this.config.save().then(() =>
|
||||
this.emit('pluginUnloaded', this));
|
||||
} else {
|
||||
if (typeof plugin !== 'string') {
|
||||
plugin = plugin.manifest.name;
|
||||
}
|
||||
this.plugins.delete(plugin);
|
||||
controlCommands = controlCommands.filter(k => {
|
||||
return k.plugin !== plugin;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventListener('pluginUnloaded')
|
||||
public unloadedEventHandler(plugin: string | Plugin): void {
|
||||
if (typeof plugin !== 'string') {
|
||||
plugin = plugin.manifest.name;
|
||||
}
|
||||
this.plugins.delete(plugin);
|
||||
controlCommands = controlCommands.filter(k => k.plugin !== plugin);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ControlPlugin;
|
||||
|
88
package-lock.json
generated
88
package-lock.json
generated
@ -9,10 +9,9 @@
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@squeebot/core": "^3.3.1",
|
||||
"@squeebot/core": "^3.3.4",
|
||||
"node-cron": "^3.0.0",
|
||||
"typescript": "^4.4.2",
|
||||
"ws": "^8.2.2"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.7.10",
|
||||
@ -42,14 +41,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@squeebot/core": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.3.1.tgz",
|
||||
"integrity": "sha512-pkLMbZ0ZLC0isBlGbOCyu28NalBOjmwAkC0RmPN19DysohEF7XBdMMBss72IT3fXeAK6mEKO7pHZS4XAHVZa0Q==",
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.3.4.tgz",
|
||||
"integrity": "sha512-alsBCCyVDOPWLR+YaVttxS5iWzsjbeCUxcSKKBpBYIMvBK34BpKn6c6HmdOsCfTeVwDqHmlUM2spkT10EerANw==",
|
||||
"dependencies": {
|
||||
"dateformat": "^4.0.0",
|
||||
"fs-extra": "^9.0.1",
|
||||
"semver": "^7.3.2",
|
||||
"tar": "^6.0.5"
|
||||
"dateformat": "^4.5.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"semver": "^7.3.5",
|
||||
"tar": "^6.1.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
@ -82,14 +81,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/at-least-node": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||
@ -107,17 +98,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
|
||||
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
|
||||
"dependencies": {
|
||||
"at-least-node": "^1.0.0",
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-minipass": {
|
||||
@ -272,26 +262,6 @@
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.2.tgz",
|
||||
"integrity": "sha512-Q6B6H2oc8QY3llc3cB8kVmQ6pnJWVQbP7Q5algTcIxx7YEpc0oU4NBVHlztA7Ekzfhw2r0rPducMUiCGWKQRzw==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
@ -300,14 +270,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@squeebot/core": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.3.1.tgz",
|
||||
"integrity": "sha512-pkLMbZ0ZLC0isBlGbOCyu28NalBOjmwAkC0RmPN19DysohEF7XBdMMBss72IT3fXeAK6mEKO7pHZS4XAHVZa0Q==",
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.3.4.tgz",
|
||||
"integrity": "sha512-alsBCCyVDOPWLR+YaVttxS5iWzsjbeCUxcSKKBpBYIMvBK34BpKn6c6HmdOsCfTeVwDqHmlUM2spkT10EerANw==",
|
||||
"requires": {
|
||||
"dateformat": "^4.0.0",
|
||||
"fs-extra": "^9.0.1",
|
||||
"semver": "^7.3.2",
|
||||
"tar": "^6.0.5"
|
||||
"dateformat": "^4.5.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"semver": "^7.3.5",
|
||||
"tar": "^6.1.11"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
@ -340,11 +310,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"at-least-node": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="
|
||||
},
|
||||
"chownr": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||
@ -356,11 +321,10 @@
|
||||
"integrity": "sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q=="
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
|
||||
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
|
||||
"requires": {
|
||||
"at-least-node": "^1.0.0",
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"universalify": "^2.0.0"
|
||||
@ -470,12 +434,6 @@
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.2.tgz",
|
||||
"integrity": "sha512-Q6B6H2oc8QY3llc3cB8kVmQ6pnJWVQbP7Q5algTcIxx7YEpc0oU4NBVHlztA7Ekzfhw2r0rPducMUiCGWKQRzw==",
|
||||
"requires": {}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
@ -11,10 +11,9 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@squeebot/core": "^3.3.1",
|
||||
"@squeebot/core": "^3.3.4",
|
||||
"node-cron": "^3.0.0",
|
||||
"typescript": "^4.4.2",
|
||||
"ws": "^8.2.2"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.7.10",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "simplecommands",
|
||||
"description": "Official Simplistic Commands API for Squeebot 3",
|
||||
"tags": ["handler", "commands", "api"],
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"dependencies": ["control?", "permissions?"],
|
||||
"npmDependencies": []
|
||||
}
|
||||
|
@ -377,9 +377,7 @@ class SqueebotCommandsAPIPlugin extends Plugin {
|
||||
// Iteration 3: Match permissions for user
|
||||
matching = this.permissionMatcher(msg, matching);
|
||||
|
||||
const b = (t: string) => {
|
||||
return msg.source.format.format('bold', t);
|
||||
};
|
||||
const b = (t: string) => msg.source.format.format('bold', t);
|
||||
|
||||
if (!args[cmdarg]) {
|
||||
msg.resolve('A command name is required.');
|
||||
@ -432,9 +430,7 @@ class SqueebotCommandsAPIPlugin extends Plugin {
|
||||
// Iteration 3: Match permissions for user
|
||||
matching = this.permissionMatcher(msg, matching);
|
||||
|
||||
const b = (t: string) => {
|
||||
return msg.source.format.format('bold', t);
|
||||
};
|
||||
const b = (t: string) => msg.source.format.format('bold', t);
|
||||
|
||||
if (args[cmdarg]) {
|
||||
let found: CommandSpec | null = null;
|
||||
|
@ -3,7 +3,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "control",
|
||||
"version": "0.1.1"
|
||||
"version": "0.1.2"
|
||||
},
|
||||
{
|
||||
"name": "cron",
|
||||
@ -15,7 +15,7 @@
|
||||
},
|
||||
{
|
||||
"name": "simplecommands",
|
||||
"version": "1.1.2"
|
||||
"version": "1.1.3"
|
||||
},
|
||||
{
|
||||
"name": "xprotocol",
|
||||
|
Loading…
Reference in New Issue
Block a user