1 files changed, 4 insertions, 20 deletions
diff --git a/src/util/Event.ts b/src/util/Event.ts
index 53c08e2b..c75c909f 100644
--- a/src/util/Event.ts
+++ b/src/util/Event.ts
@@ -1,26 +1,10 @@
-import { db } from "fosscord-server-util";
+import { Event, EventModel } from "fosscord-server-util";
-export async function emitEvent({
- guild,
- user,
- channel,
- event,
- data,
-}: {
- guild?: bigint;
- channel?: bigint;
- user?: bigint;
- event: string;
- data: any;
-}) {
+export async function emitEvent(payload: Omit<Event, "created_at">) {
const emitEvent = {
created_at: Math.floor(Date.now() / 1000), // in seconds
- guild_id: guild,
- user_id: user,
- channel_id: channel,
- data,
- event,
+ ...payload,
};
- return await db.data.events.push(emitEvent);
+ return await new EventModel(emitEvent).save();
}
|