Archived
added enabled property for every system message
This commit is contained in:
1 parent
2424a13975
commit
245d9a36df
1 file changed
+6
-4
@@ -12,6 +12,7 @@ import { Command, PermissionsError } from "./Command.js";
|
|||||||
|
|
||||||
export type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND";
|
export type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND";
|
||||||
export interface SystemMessageAppearance {
|
export interface SystemMessageAppearance {
|
||||||
|
enabled: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
bottomText?: string;
|
bottomText?: string;
|
||||||
accentColor?: ColorResolvable;
|
accentColor?: ColorResolvable;
|
||||||
@@ -26,15 +27,14 @@ interface SystemMessageData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SystemMessageManager {
|
export class SystemMessageManager {
|
||||||
enabled: boolean;
|
|
||||||
PERMISSION: SystemMessageAppearance;
|
PERMISSION: SystemMessageAppearance;
|
||||||
ERROR: SystemMessageAppearance;
|
ERROR: SystemMessageAppearance;
|
||||||
NOT_FOUND: SystemMessageAppearance;
|
NOT_FOUND: SystemMessageAppearance;
|
||||||
deleteTimeout: number;
|
deleteTimeout: number;
|
||||||
|
|
||||||
constructor(botName?: string) {
|
constructor(botName?: string) {
|
||||||
this.enabled = true;
|
|
||||||
this.PERMISSION = {
|
this.PERMISSION = {
|
||||||
|
enabled: true,
|
||||||
title: "👮♂️ Insufficient permissions",
|
title: "👮♂️ Insufficient permissions",
|
||||||
bottomText: "You don't have enough permissions to run this command",
|
bottomText: "You don't have enough permissions to run this command",
|
||||||
accentColor: "#1d1dc4",
|
accentColor: "#1d1dc4",
|
||||||
@@ -42,6 +42,7 @@ export class SystemMessageManager {
|
|||||||
footer: botName,
|
footer: botName,
|
||||||
};
|
};
|
||||||
this.ERROR = {
|
this.ERROR = {
|
||||||
|
enabled: true,
|
||||||
title: "❌ An error occurred",
|
title: "❌ An error occurred",
|
||||||
bottomText: "Something went wrong while processing your request.",
|
bottomText: "Something went wrong while processing your request.",
|
||||||
accentColor: "#ff0000",
|
accentColor: "#ff0000",
|
||||||
@@ -49,6 +50,7 @@ export class SystemMessageManager {
|
|||||||
footer: botName,
|
footer: botName,
|
||||||
};
|
};
|
||||||
this.NOT_FOUND = {
|
this.NOT_FOUND = {
|
||||||
|
enabled: true,
|
||||||
title: "🔍 Command not found",
|
title: "🔍 Command not found",
|
||||||
accentColor: "#ff5500",
|
accentColor: "#ff5500",
|
||||||
showTimestamp: true,
|
showTimestamp: true,
|
||||||
@@ -69,10 +71,10 @@ export class SystemMessageManager {
|
|||||||
data?: SystemMessageData,
|
data?: SystemMessageData,
|
||||||
channel?: TextChannel | DMChannel | NewsChannel
|
channel?: TextChannel | DMChannel | NewsChannel
|
||||||
): Promise<MessageEmbed | Message | void> {
|
): Promise<MessageEmbed | Message | void> {
|
||||||
if (!this.enabled) {
|
if (this[type]) {
|
||||||
|
if (this[type].enabled === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this[type]) {
|
|
||||||
const embed = new MessageEmbed();
|
const embed = new MessageEmbed();
|
||||||
embed.setTitle(this[type].title);
|
embed.setTitle(this[type].title);
|
||||||
if (this[type].bottomText)
|
if (this[type].bottomText)
|
||||||
|
|||||||
Reference in new issue
Block a user