From 1603ca7f5dc89aaae6b3db00c18458b0fca8f72c Mon Sep 17 00:00:00 2001 From: Aaron Scherer Date: Fri, 21 Apr 2023 17:59:15 -0500 Subject: [PATCH] Fixing checkOwner and publish logic --- packages/core/project.json | 2 +- packages/discord/project.json | 2 +- packages/discord/src/Service/InteractionHandler.ts | 2 +- tools/scripts/{publish.mjs => publish.js} | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) rename tools/scripts/{publish.mjs => publish.js} (89%) diff --git a/packages/core/project.json b/packages/core/project.json index 7d2950c..a6591b1 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -18,7 +18,7 @@ "publish": { "executor": "nx:run-commands", "options": { - "command": "node tools/scripts/publish.mjs 3mf-parser {args.ver} {args.tag}" + "command": "node tools/scripts/publish.js @node-bambu/core {args.ver} {args.tag}" }, "dependsOn": ["build"] }, diff --git a/packages/discord/project.json b/packages/discord/project.json index 1bd57d6..fe930f8 100644 --- a/packages/discord/project.json +++ b/packages/discord/project.json @@ -17,7 +17,7 @@ "publish": { "executor": "nx:run-commands", "options": { - "command": "node tools/scripts/publish.mjs 3mf-parser {args.ver} {args.tag}" + "command": "node tools/scripts/publish.js @node-bambu/discord {args.ver} {args.tag}" }, "dependsOn": ["build"] }, diff --git a/packages/discord/src/Service/InteractionHandler.ts b/packages/discord/src/Service/InteractionHandler.ts index 13d4aab..31c0df8 100644 --- a/packages/discord/src/Service/InteractionHandler.ts +++ b/packages/discord/src/Service/InteractionHandler.ts @@ -57,7 +57,7 @@ export class InteractionHandler { } private checkOwner(interaction: ButtonInteraction, { printer: { owners } }: BambuRepositoryItem) { - return owners.includes(interaction.user.id); + return owners.map((x) => x.id).includes(interaction.user.id); } private async changeSpeed(interaction: ButtonInteraction, printer: BambuRepositoryItem, speedUp: boolean) { diff --git a/tools/scripts/publish.mjs b/tools/scripts/publish.js similarity index 89% rename from tools/scripts/publish.mjs rename to tools/scripts/publish.js index ee09103..0d6830a 100644 --- a/tools/scripts/publish.mjs +++ b/tools/scripts/publish.js @@ -7,10 +7,10 @@ * You might need to authenticate with NPM before running this script. */ -import { readCachedProjectGraph } from '@nrwl/devkit'; -import { execSync } from 'child_process'; -import { readFileSync, writeFileSync } from 'fs'; -import chalk from 'chalk'; +const { readCachedProjectGraph } = require('@nrwl/devkit'); +const { execSync } = require('node:child_process'); +const { readFileSync, writeFileSync } = require('node:fs'); +const chalk = require('chalk'); function invariant(condition, message) { if (!condition) {