New edit and delete logs
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 1bb1904..96cd068 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -471,8 +471,12 @@
if (child.type === ComponentType.Button) {
obj.style = child.style;
obj.label = child.label ?? "";
- } else if (child.type > 2) {
- // FIXME: Can we write this more clearly to make it obvious what we mean by 2 here?
+ } else if (
+ child.type === ComponentType.StringSelect ||
+ child.type === ComponentType.UserSelect ||
+ child.type === ComponentType.ChannelSelect ||
+ child.type === ComponentType.RoleSelect
+ ) {
obj.placeholder = child.placeholder ?? "";
}
return obj;
diff --git a/src/utils/defaults.ts b/src/utils/defaults.ts
index 0d4c9e3..ec337f4 100644
--- a/src/utils/defaults.ts
+++ b/src/utils/defaults.ts
@@ -43,3 +43,10 @@
export { Embed };
export const unknownServerIcon = "";
+
+export const imageDataEasterEgg =
+ "The image in this embed contains data about the below log.\n" +
+ "It isn't designed to be read by humans, but you can decode it with any base64 decoder, and then read it as JSON.\n" +
+ "We use base 64 to get around people using virus tests and the file being blocked, and an image to have the embed hidden (files can't be suppressed)\n" +
+ "If you've got to this point and are reading this hidden message, you should come and work with us " +
+ "at https://discord.gg/w35pXdrxKW (Internal development server) and let us know how you got here!";
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 2679fd6..b2b078d 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -16,7 +16,7 @@
color: number;
emoji: string;
timestamp: number;
- buttons?: { buttonText: string, buttonId: string, buttonStyle: Discord.ButtonStyle }[];
+ buttons?: { buttonText: string; buttonId: string; buttonStyle: Discord.ButtonStyle }[];
imageData?: string;
};
list: Record<string | symbol | number, unknown>;
@@ -43,7 +43,7 @@
red: 0xf27878,
yellow: 0xf2d478,
green: 0x68d49e,
- blue: 0x72aef5,
+ blue: 0x72aef5
};
export const Logger = {
@@ -61,6 +61,13 @@
t = Math.floor((t /= 1000));
return `<t:${t}:R> (<t:${t}:D> at <t:${t}:T>)`;
},
+ renderDateFooter(t: number) {
+ if (isNaN(t)) return "Unknown";
+ const date = new Date(t);
+ return `${date.getUTCFullYear()}-${
+ date.getUTCMonth() + 1
+ }-${date.getUTCDate()} at ${date.getUTCHours()}:${date.getUTCMinutes()}:${date.getUTCSeconds()} UTC`;
+ },
renderNumberDelta(num1: number, num2: number) {
const delta = num2 - num1;
return `${num1} -> ${num2} (${delta > 0 ? "+" : ""}${delta})`;
@@ -119,7 +126,6 @@
description[key] = value;
}
});
- console.log("imageData", log.meta.imageData)
if (channel) {
log.separate = log.separate ?? {};
const messageOptions: Parameters<Discord.TextChannel["send"]>[0] = {};
@@ -138,14 +144,14 @@
.setImage(log.meta.imageData ? "attachment://extra_log_data.json.base64" : null)
];
if (log.meta.buttons) {
- const buttons = []
+ const buttons = [];
for (const button of log.meta.buttons) {
buttons.push(
new Discord.ButtonBuilder()
.setCustomId(button.buttonId)
.setLabel(button.buttonText)
.setStyle(button.buttonStyle)
- )
+ );
}
components.addComponents(buttons);
messageOptions.components = [components];
@@ -153,7 +159,7 @@
if (log.meta.imageData) {
messageOptions.files = [
{
- attachment: Buffer.from(btoa(log.meta.imageData), "utf-8"), // Use base 64 to prevent virus scanning (EICAR)Buffer.from(log.meta.imageData, "base64"),
+ attachment: Buffer.from(btoa(log.meta.imageData), "utf-8"), // Use base 64 to prevent virus scanning (EICAR)
name: "extra_log_data.json.base64"
}
];