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