worked on stats, database, ban
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 51b2bca..c9b6a8d 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -142,6 +142,11 @@
// console.log("Guild delete")
await this.guilds.deleteOne({ id: guild });
}
+
+ async staffChannels(): Promise<string[]> {
+ const entries = await this.guilds.find({ "logging.staff.channel": {$exists: true}}, { projection: { "logging.staff.channel": 1, _id: 0 } }).toArray();
+ return entries.map(e => e.logging.staff.channel!);
+ }
}
interface TranscriptEmbed {
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 9bbf61f..19b88b4 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,12 +1,25 @@
-import emojis from "../config/emojis.json" assert { type: "json" };
+import emojis from "../config/emojis.js"
import _ from "lodash";
interface EmojisIndex {
[key: string]: string | EmojisIndex | EmojisIndex[];
}
-function getEmojiByName(name: string | null, format?: string): string {
- if (!name) return "";
+const EMOJIPATHS: string[] = [];
+
+function getEmojiPaths(obj: EmojisIndex, path: string[] = []) {
+ for (const key in obj) {
+ if (typeof obj[key] === "string") {
+ EMOJIPATHS.push([...path, key].join("."));
+ } else {
+ getEmojiPaths(obj[key] as EmojisIndex, [...path, key]);
+ }
+ }
+}
+getEmojiPaths(emojis);
+
+
+function getEmojiByName(name: typeof EMOJIPATHS[number], format?: string): string {
const parts = name.split(".");
let id: string | EmojisIndex | EmojisIndex[] | undefined = emojis;
for (const part of parts) {