@open-discord-bots/framework 0.0.5 → 0.0.7
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.
|
@@ -1110,16 +1110,9 @@ class ODModalResponderInstance {
|
|
|
1110
1110
|
async reply(msg) {
|
|
1111
1111
|
try {
|
|
1112
1112
|
const msgFlags = msg.ephemeral ? [discord.MessageFlags.Ephemeral] : [];
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
return { success: true, message: sent };
|
|
1117
|
-
}
|
|
1118
|
-
else {
|
|
1119
|
-
const sent = await this.interaction.reply(Object.assign(msg.message, { flags: msgFlags }));
|
|
1120
|
-
this.didReply = true;
|
|
1121
|
-
return { success: true, message: await sent.fetch() };
|
|
1122
|
-
}
|
|
1113
|
+
const sent = await this.interaction.followUp(Object.assign(msg.message, { flags: msgFlags }));
|
|
1114
|
+
this.didReply = true;
|
|
1115
|
+
return { success: true, message: sent };
|
|
1123
1116
|
}
|
|
1124
1117
|
catch {
|
|
1125
1118
|
return { success: false, message: null };
|
|
@@ -1134,8 +1127,11 @@ class ODModalResponderInstance {
|
|
|
1134
1127
|
this.didReply = true;
|
|
1135
1128
|
return { success: true, message: await sent.fetch() };
|
|
1136
1129
|
}
|
|
1137
|
-
else
|
|
1138
|
-
|
|
1130
|
+
else {
|
|
1131
|
+
const sent = await this.interaction.reply(Object.assign(msg.message, { flags: msgFlags }));
|
|
1132
|
+
this.didReply = true;
|
|
1133
|
+
return { success: true, message: await sent.fetch() };
|
|
1134
|
+
}
|
|
1139
1135
|
}
|
|
1140
1136
|
catch {
|
|
1141
1137
|
return { success: false, message: null };
|
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",
|
|
@@ -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.
|
|
4
|
+
"version": "0.0.7",
|
|
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",
|
|
@@ -1071,15 +1071,9 @@ export class ODModalResponderInstance {
|
|
|
1071
1071
|
async reply(msg:ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>> {
|
|
1072
1072
|
try{
|
|
1073
1073
|
const msgFlags: number[] = msg.ephemeral ? [discord.MessageFlags.Ephemeral] : []
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
return {success:true,message:sent}
|
|
1078
|
-
}else{
|
|
1079
|
-
const sent = await this.interaction.reply(Object.assign(msg.message,{flags:msgFlags}))
|
|
1080
|
-
this.didReply = true
|
|
1081
|
-
return {success:true,message:await sent.fetch()}
|
|
1082
|
-
}
|
|
1074
|
+
const sent = await this.interaction.followUp(Object.assign(msg.message,{flags:msgFlags}))
|
|
1075
|
+
this.didReply = true
|
|
1076
|
+
return {success:true,message:sent}
|
|
1083
1077
|
}catch{
|
|
1084
1078
|
return {success:false,message:null}
|
|
1085
1079
|
}
|
|
@@ -1092,7 +1086,11 @@ export class ODModalResponderInstance {
|
|
|
1092
1086
|
const sent = await this.interaction.editReply(Object.assign(msg.message,{flags:msgFlags}))
|
|
1093
1087
|
this.didReply = true
|
|
1094
1088
|
return {success:true,message:await sent.fetch()}
|
|
1095
|
-
}else
|
|
1089
|
+
}else{
|
|
1090
|
+
const sent = await this.interaction.reply(Object.assign(msg.message,{flags:msgFlags}))
|
|
1091
|
+
this.didReply = true
|
|
1092
|
+
return {success:true,message:await sent.fetch()}
|
|
1093
|
+
}
|
|
1096
1094
|
}catch{
|
|
1097
1095
|
return {success:false,message:null}
|
|
1098
1096
|
}
|
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",
|
|
@@ -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()
|