@open-discord-bots/framework 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -43,3 +43,6 @@ var pluginLauncher_1 = require("./startup/pluginLauncher");
43
43
  Object.defineProperty(exports, "loadAllPlugins", { enumerable: true, get: function () { return pluginLauncher_1.loadAllPlugins; } });
44
44
  var compilation_1 = require("./startup/compilation");
45
45
  Object.defineProperty(exports, "frameworkStartup", { enumerable: true, get: function () { return compilation_1.frameworkStartup; } });
46
+ const compilation_2 = require("./startup/compilation");
47
+ //check directory structure
48
+ (0, compilation_2.checkFrameworkAllowed)();
@@ -1,2 +1,3 @@
1
1
  import type { ODProjectType } from "../api/api";
2
+ export declare function checkFrameworkAllowed(project?: ODProjectType): void;
2
3
  export declare function frameworkStartup(startupFlags: string[], project: ODProjectType, startCallback: () => void): void;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkFrameworkAllowed = checkFrameworkAllowed;
6
7
  exports.frameworkStartup = frameworkStartup;
7
8
  const fs_1 = __importDefault(require("fs"));
8
9
  const typescript_1 = __importDefault(require("typescript"));
@@ -62,11 +63,8 @@ function saveNewCompilationHash() {
62
63
  const hash = sourceHash + ":" + pluginHash;
63
64
  fs_1.default.writeFileSync("./dist/hash.txt", hash);
64
65
  }
65
- function frameworkStartup(startupFlags, project, startCallback) {
66
- const logTitle = (project == "openticket") ? "OT" : "OM";
67
- //push additional startup flags (for pterodactyl panels)
68
- process.argv.push(...startupFlags);
69
- //check directory structure
66
+ function checkFrameworkAllowed(project) {
67
+ const logTitle = (project) ? ((project == "openticket") ? "OT" : "OM") : "OD";
70
68
  const requiredStructures = [
71
69
  "index.js",
72
70
  "./package.json",
@@ -94,6 +92,13 @@ function frameworkStartup(startupFlags, project, startCallback) {
94
92
  throw new Error(logTitle + ": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (2)");
95
93
  if (!readmeContents.includes("DJdj Development") || !readmeContents.includes("DJj123dj"))
96
94
  throw new Error(logTitle + ": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (3)");
95
+ }
96
+ function frameworkStartup(startupFlags, project, startCallback) {
97
+ const logTitle = (project == "openticket") ? "OT" : "OM";
98
+ //push additional startup flags (for pterodactyl panels)
99
+ process.argv.push(...startupFlags);
100
+ //check directory structure
101
+ checkFrameworkAllowed(project);
97
102
  //start compilation
98
103
  if (!process.argv.includes("--no-compile")) {
99
104
  const requiredDependencies = new Set();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@open-discord-bots/framework",
3
3
  "author": "DJj123dj",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "description": "The core framework of the popular open-source discord bots: Open Ticket & Open Moderation.",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
package/src/index.ts CHANGED
@@ -1,6 +1,11 @@
1
+
1
2
  export * as api from "./api/api"
2
3
  export * as utilities from "./api/utils"
3
4
  export * as cli from "./cli/cli"
4
5
  export { loadDumpCommand } from "./startup/dump"
5
6
  export { loadAllPlugins } from "./startup/pluginLauncher"
6
- export { frameworkStartup } from "./startup/compilation"
7
+ export { frameworkStartup } from "./startup/compilation"
8
+ import { checkFrameworkAllowed } from "./startup/compilation"
9
+
10
+ //check directory structure
11
+ checkFrameworkAllowed()
@@ -60,13 +60,8 @@ function saveNewCompilationHash(){
60
60
  fs.writeFileSync("./dist/hash.txt",hash)
61
61
  }
62
62
 
63
- export function frameworkStartup(startupFlags:string[],project:ODProjectType,startCallback:() => void){
64
- const logTitle = (project == "openticket") ? "OT" : "OM"
65
-
66
- //push additional startup flags (for pterodactyl panels)
67
- process.argv.push(...startupFlags)
68
-
69
- //check directory structure
63
+ export function checkFrameworkAllowed(project?:ODProjectType){
64
+ const logTitle = (project) ? ((project == "openticket") ? "OT" : "OM") : "OD"
70
65
  const requiredStructures: string[] = [
71
66
  "index.js",
72
67
  "./package.json",
@@ -92,7 +87,17 @@ export function frameworkStartup(startupFlags:string[],project:ODProjectType,sta
92
87
  !readmeContents.includes(`<img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation" width="650px">`)
93
88
  ) throw new Error(logTitle+": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (2)")
94
89
  if (!readmeContents.includes("DJdj Development") || !readmeContents.includes("DJj123dj")) throw new Error(logTitle+": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (3)")
90
+ }
95
91
 
92
+ export function frameworkStartup(startupFlags:string[],project:ODProjectType,startCallback:() => void){
93
+ const logTitle = (project == "openticket") ? "OT" : "OM"
94
+
95
+ //push additional startup flags (for pterodactyl panels)
96
+ process.argv.push(...startupFlags)
97
+
98
+ //check directory structure
99
+ checkFrameworkAllowed(project)
100
+
96
101
  //start compilation
97
102
  if (!process.argv.includes("--no-compile")){
98
103
  const requiredDependencies: Set<string> = new Set()