@open-discord-bots/framework 0.0.4 → 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/README.md +3 -3
- package/dist/index.js +3 -0
- package/dist/startup/compilation.d.ts +1 -0
- package/dist/startup/compilation.js +20 -7
- package/package.json +2 -2
- package/src/index.ts +6 -1
- package/src/startup/compilation.ts +21 -9
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://apis.dj-dj.be/cdn/opendiscord/logo.png" alt="Open
|
|
2
|
+
<img src="https://apis.dj-dj.be/cdn/opendiscord/logo.png" alt="Open Discord Logo" width="650px"><br>
|
|
3
3
|
<span align="center"><b>A modular framework for the next-generation of Discord bots</b></span><br><br>
|
|
4
|
-
<a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket" height="55px"></a>
|
|
5
|
-
<a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation" height="60px"></a><br><br>
|
|
4
|
+
<a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket Logo" height="55px"></a>
|
|
5
|
+
<a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation Logo" height="60px"></a><br><br>
|
|
6
6
|
<a href="https://discord.com/invite/26vT9wt3n3"><img alt="Discord Invite Link" src="https://img.shields.io/badge/discord-support%20server-5865F2.svg?style=flat-square&logo=discord"></img></a>
|
|
7
7
|
<a href="https://github.com/open-discord-bots/plugins/blob/main/LICENSE"><img alt="Open Discord Plugins License" src="https://img.shields.io/badge/license-MIT-important.svg?style=flat-square"></img></a>
|
|
8
8
|
<a href="https://discord.dj-dj.be"><img alt="Open Discord Plugins Stars" src="https://img.shields.io/github/stars/open-discord-bots/framework?color=yellow&label=stars&logo=github&style=flat-square"></img></a>
|
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)();
|
|
@@ -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
|
|
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",
|
|
@@ -80,12 +78,27 @@ function frameworkStartup(startupFlags, project, startCallback) {
|
|
|
80
78
|
"./plugins/",
|
|
81
79
|
"./.github/",
|
|
82
80
|
"./.github/FUNDING.yml",
|
|
83
|
-
"./.github/SECURITY.
|
|
81
|
+
"./.github/SECURITY.md"
|
|
84
82
|
];
|
|
85
83
|
for (const path of requiredStructures) {
|
|
86
84
|
if (!fs_1.default.existsSync(path))
|
|
87
|
-
throw new Error(logTitle + ": Project uses invalid structure for Open Discord! (" + path + ")");
|
|
85
|
+
throw new Error(logTitle + ": Project uses invalid structure for Open Discord! (missing: " + path + ")");
|
|
88
86
|
}
|
|
87
|
+
if (!fs_1.default.readFileSync("./.github/FUNDING.yml").toString().startsWith("github: DJj123dj"))
|
|
88
|
+
throw new Error(logTitle + ": Please do not use this framework in third party bots outside Open Ticket/Moderation! (1)");
|
|
89
|
+
const readmeContents = fs_1.default.readFileSync("./README.md").toString();
|
|
90
|
+
if (!readmeContents.includes(`<img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket" width="650px">`) &&
|
|
91
|
+
!readmeContents.includes(`<img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation" width="650px">`))
|
|
92
|
+
throw new Error(logTitle + ": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (2)");
|
|
93
|
+
if (!readmeContents.includes("DJdj Development") || !readmeContents.includes("DJj123dj"))
|
|
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);
|
|
89
102
|
//start compilation
|
|
90
103
|
if (!process.argv.includes("--no-compile")) {
|
|
91
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.
|
|
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",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"build": "node ./tools/cleanup.js && tsc -p ./tsconfig.json"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "GPL-3.0-only",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@discordjs/rest": "^2.6.0",
|
|
15
15
|
"@types/terminal-kit": "^2.5.7",
|
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
|
|
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",
|
|
@@ -80,12 +75,29 @@ export function frameworkStartup(startupFlags:string[],project:ODProjectType,sta
|
|
|
80
75
|
"./plugins/",
|
|
81
76
|
"./.github/",
|
|
82
77
|
"./.github/FUNDING.yml",
|
|
83
|
-
"./.github/SECURITY.
|
|
78
|
+
"./.github/SECURITY.md"
|
|
84
79
|
]
|
|
85
80
|
for (const path of requiredStructures){
|
|
86
|
-
if (!fs.existsSync(path)) throw new Error(logTitle+": Project uses invalid structure for Open Discord! ("+path+")")
|
|
81
|
+
if (!fs.existsSync(path)) throw new Error(logTitle+": Project uses invalid structure for Open Discord! (missing: "+path+")")
|
|
87
82
|
}
|
|
83
|
+
if (!fs.readFileSync("./.github/FUNDING.yml").toString().startsWith("github: DJj123dj")) throw new Error(logTitle+": Please do not use this framework in third party bots outside Open Ticket/Moderation! (1)")
|
|
84
|
+
const readmeContents = fs.readFileSync("./README.md").toString()
|
|
85
|
+
if (
|
|
86
|
+
!readmeContents.includes(`<img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket" width="650px">`) &&
|
|
87
|
+
!readmeContents.includes(`<img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation" width="650px">`)
|
|
88
|
+
) throw new Error(logTitle+": Please do not use this framework in third party bots or outside Open Ticket/Moderation! (2)")
|
|
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
|
+
}
|
|
88
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
|
+
|
|
89
101
|
//start compilation
|
|
90
102
|
if (!process.argv.includes("--no-compile")){
|
|
91
103
|
const requiredDependencies: Set<string> = new Set()
|