From d17c9244e7a77d294b774cd71ef493c460cf3887 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Wed, 2 Aug 2023 20:03:44 +0300 Subject: [PATCH] core updates --- discord/plugin.json | 2 +- discord/plugin.ts | 27 ++++++- package-lock.json | 184 ++++++++++++++++++++++++-------------------- package.json | 2 +- squeebot.repo.json | 2 +- 5 files changed, 129 insertions(+), 88 deletions(-) diff --git a/discord/plugin.json b/discord/plugin.json index 92fbc30..e3f9972 100644 --- a/discord/plugin.json +++ b/discord/plugin.json @@ -2,7 +2,7 @@ "main": "plugin.js", "name": "discord", "description": "Discord Service for Squeebot 3", - "version": "1.2.3", + "version": "1.3.0", "tags": ["service", "discord"], "dependencies": ["control?"], "npmDependencies": ["discord.js@^13.1.0"] diff --git a/discord/plugin.ts b/discord/plugin.ts index 333282a..0b606ca 100644 --- a/discord/plugin.ts +++ b/discord/plugin.ts @@ -17,7 +17,8 @@ import { IMessage, IMessageTarget, MarkdownFormatter, - Protocol + Protocol, + ProtocolFeatureFlag } from '@squeebot/core/lib/types'; class DiscordFormatter extends MarkdownFormatter { @@ -141,6 +142,28 @@ class DiscordMessageAdapter implements IMessage { } class DiscordProtocol extends Protocol { + public static Features = [ + ProtocolFeatureFlag.COLORS, + ProtocolFeatureFlag.FORMATTING, + ProtocolFeatureFlag.PLAIN, + ProtocolFeatureFlag.MARKDOWN, + ProtocolFeatureFlag.CUSTOM_EMBEDS, + ProtocolFeatureFlag.EMOJI, + ProtocolFeatureFlag.IMAGES, + ProtocolFeatureFlag.VOICE, + ProtocolFeatureFlag.VIDEO, + ProtocolFeatureFlag.THREADS, + ProtocolFeatureFlag.REACTIONS, + ProtocolFeatureFlag.MENTION, + ProtocolFeatureFlag.MULTISERVER, + ProtocolFeatureFlag.EVENT_MESSAGE, + ProtocolFeatureFlag.EVENT_ROOM_JOIN, + ProtocolFeatureFlag.EVENT_ROOM_LEAVE, + ProtocolFeatureFlag.KICK, + ProtocolFeatureFlag.BAN, + ProtocolFeatureFlag.MUTE, + ]; + public format: Formatter = new DiscordFormatter(); public type = 'DiscordProtocol'; @@ -370,7 +393,7 @@ class DiscordServicePlugin extends Plugin { private startAll(list: any[]): void { for (const ins of list) { - const newProto = new DiscordProtocol(this, ins); + const newProto = new DiscordProtocol(this, ins, DiscordProtocol.Features); logger.log('[%s] Starting Discord service "%s".', this.name, ins.name); this.monitor(newProto); this.service?.use(newProto, true); diff --git a/package-lock.json b/package-lock.json index af7fafd..6c0f62c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@squeebot/core": "^3.3.1", + "@squeebot/core": "^3.6.0-1", "discord.js": "^13.1.0", "typescript": "^4.4.2" } @@ -93,14 +93,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.6.0-1", + "resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.6.0-1.tgz", + "integrity": "sha512-Q9My45N9Z4irJc5/SvZJoSogLHKkqmqQkP6XdOEKerFAsPW/+x0gUNb45R0P7YpDjYe84nedtSuqlHxYzVnlhA==", "dependencies": { - "dateformat": "^4.0.0", - "fs-extra": "^9.0.1", - "semver": "^7.3.2", - "tar": "^6.0.5" + "fs-extra": "^11.1.1", + "reflect-metadata": "^0.1.13", + "semver": "^7.5.4", + "tar": "^6.1.15" } }, "node_modules/@types/node": { @@ -121,14 +121,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, - "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/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -156,14 +148,6 @@ "node": ">= 0.8" } }, - "node_modules/dateformat": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.5.1.tgz", - "integrity": "sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==", - "engines": { - "node": "*" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -214,17 +198,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": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.14" } }, "node_modules/fs-minipass": { @@ -238,10 +221,21 @@ "node": ">= 8" } }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/is-obj": { "version": "2.0.0", @@ -298,12 +292,9 @@ } }, "node_modules/minipass": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", - "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", - "dependencies": { - "yallist": "^4.0.0" - }, + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", "engines": { "node": ">=8" } @@ -320,6 +311,17 @@ "node": ">= 8" } }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -358,10 +360,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -373,19 +380,19 @@ } }, "node_modules/tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.1.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", + "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" }, "engines": { - "node": ">= 10" + "node": ">=10" } }, "node_modules/ts-mixer": { @@ -502,14 +509,14 @@ "integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==" }, "@squeebot/core": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.3.1.tgz", - "integrity": "sha512-pkLMbZ0ZLC0isBlGbOCyu28NalBOjmwAkC0RmPN19DysohEF7XBdMMBss72IT3fXeAK6mEKO7pHZS4XAHVZa0Q==", + "version": "3.6.0-1", + "resolved": "https://registry.npmjs.org/@squeebot/core/-/core-3.6.0-1.tgz", + "integrity": "sha512-Q9My45N9Z4irJc5/SvZJoSogLHKkqmqQkP6XdOEKerFAsPW/+x0gUNb45R0P7YpDjYe84nedtSuqlHxYzVnlhA==", "requires": { - "dateformat": "^4.0.0", - "fs-extra": "^9.0.1", - "semver": "^7.3.2", - "tar": "^6.0.5" + "fs-extra": "^11.1.1", + "reflect-metadata": "^0.1.13", + "semver": "^7.5.4", + "tar": "^6.1.15" } }, "@types/node": { @@ -530,11 +537,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, - "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==" - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -553,11 +555,6 @@ "delayed-stream": "~1.0.0" } }, - "dateformat": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.5.1.tgz", - "integrity": "sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==" - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -592,11 +589,10 @@ } }, "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": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" @@ -608,12 +604,22 @@ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", "requires": { "minipass": "^3.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "is-obj": { "version": "2.0.0", @@ -656,12 +662,9 @@ } }, "minipass": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", - "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", - "requires": { - "yallist": "^4.0.0" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" }, "minizlib": { "version": "2.1.2", @@ -670,6 +673,16 @@ "requires": { "minipass": "^3.0.0", "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } } }, "mkdirp": { @@ -695,22 +708,27 @@ "vali-date": "^1.0.0" } }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "requires": { "lru-cache": "^6.0.0" } }, "tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.1.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", + "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" diff --git a/package.json b/package.json index 55b36a6..43a6afe 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "@squeebot/core": "^3.3.1", + "@squeebot/core": "^3.6.0-1", "discord.js": "^13.1.0", "typescript": "^4.4.2" } diff --git a/squeebot.repo.json b/squeebot.repo.json index 0543aac..0534258 100644 --- a/squeebot.repo.json +++ b/squeebot.repo.json @@ -3,7 +3,7 @@ "plugins": [ { "name": "discord", - "version": "1.2.3" + "version": "1.3.0" } ], "typescript": true