@open-discord-bots/framework 0.0.6 → 0.0.8
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.
|
@@ -288,9 +288,11 @@ export declare class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
|
|
|
288
288
|
#private;
|
|
289
289
|
/**The class responsible for rendering the livestatus messages. */
|
|
290
290
|
renderer: ODLiveStatusRenderer;
|
|
291
|
-
constructor(debug: ODDebugger,
|
|
291
|
+
constructor(debug: ODDebugger, console: ODConsoleManager);
|
|
292
292
|
/**Get the messages from all sources combined! */
|
|
293
293
|
getAllMessages(): Promise<ODLiveStatusSourceData[]>;
|
|
294
|
+
/**Set the opendiscord `ODMain` class to use for fetching message filters. */
|
|
295
|
+
useMain(main: ODMain): void;
|
|
294
296
|
}
|
|
295
297
|
/**## ODLiveStatusRenderer `class`
|
|
296
298
|
* This is the Open Discord livestatus renderer.
|
|
@@ -526,14 +526,15 @@ class ODLiveStatusManager extends base_1.ODManager {
|
|
|
526
526
|
/**The class responsible for rendering the livestatus messages. */
|
|
527
527
|
renderer;
|
|
528
528
|
/**A reference to the ODMain or "opendiscord" global variable */
|
|
529
|
-
#main;
|
|
530
|
-
constructor(debug,
|
|
529
|
+
#main = null;
|
|
530
|
+
constructor(debug, console) {
|
|
531
531
|
super(debug, "livestatus source");
|
|
532
|
-
this.renderer = new ODLiveStatusRenderer(
|
|
533
|
-
this.#main = main;
|
|
532
|
+
this.renderer = new ODLiveStatusRenderer(console);
|
|
534
533
|
}
|
|
535
534
|
/**Get the messages from all sources combined! */
|
|
536
535
|
async getAllMessages() {
|
|
536
|
+
if (!this.#main)
|
|
537
|
+
throw new base_1.ODSystemError("ODLiveStatusManager:getAllMessages() --> Unable to get messages, 'opendiscord/ODMain' has not been connected!");
|
|
537
538
|
const messages = [];
|
|
538
539
|
for (const source of this.getAll()) {
|
|
539
540
|
try {
|
|
@@ -543,6 +544,10 @@ class ODLiveStatusManager extends base_1.ODManager {
|
|
|
543
544
|
}
|
|
544
545
|
return messages;
|
|
545
546
|
}
|
|
547
|
+
/**Set the opendiscord `ODMain` class to use for fetching message filters. */
|
|
548
|
+
useMain(main) {
|
|
549
|
+
this.#main = main;
|
|
550
|
+
}
|
|
546
551
|
}
|
|
547
552
|
exports.ODLiveStatusManager = ODLiveStatusManager;
|
|
548
553
|
/**## ODLiveStatusRenderer `class`
|
|
@@ -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/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.8",
|
|
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",
|
|
@@ -592,16 +592,16 @@ export class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
|
|
|
592
592
|
/**The class responsible for rendering the livestatus messages. */
|
|
593
593
|
renderer: ODLiveStatusRenderer
|
|
594
594
|
/**A reference to the ODMain or "opendiscord" global variable */
|
|
595
|
-
#main: ODMain
|
|
595
|
+
#main: ODMain|null = null
|
|
596
596
|
|
|
597
|
-
constructor(debug:ODDebugger,
|
|
597
|
+
constructor(debug:ODDebugger,console:ODConsoleManager){
|
|
598
598
|
super(debug,"livestatus source")
|
|
599
|
-
this.renderer = new ODLiveStatusRenderer(
|
|
600
|
-
this.#main = main
|
|
599
|
+
this.renderer = new ODLiveStatusRenderer(console)
|
|
601
600
|
}
|
|
602
601
|
|
|
603
602
|
/**Get the messages from all sources combined! */
|
|
604
603
|
async getAllMessages(): Promise<ODLiveStatusSourceData[]> {
|
|
604
|
+
if (!this.#main) throw new ODSystemError("ODLiveStatusManager:getAllMessages() --> Unable to get messages, 'opendiscord/ODMain' has not been connected!")
|
|
605
605
|
const messages: ODLiveStatusSourceData[] = []
|
|
606
606
|
for (const source of this.getAll()){
|
|
607
607
|
try {
|
|
@@ -610,6 +610,10 @@ export class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
|
|
|
610
610
|
}
|
|
611
611
|
return messages
|
|
612
612
|
}
|
|
613
|
+
/**Set the opendiscord `ODMain` class to use for fetching message filters. */
|
|
614
|
+
useMain(main:ODMain){
|
|
615
|
+
this.#main = main
|
|
616
|
+
}
|
|
613
617
|
}
|
|
614
618
|
|
|
615
619
|
/**## ODLiveStatusRenderer `class`
|
|
@@ -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
|
}
|