From a94f7c76172d83b95f43b059b9a5af4299eb2f8d Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 14 Feb 2021 19:01:41 +0100 Subject: switch to mongoose --- src/util/Event.ts | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/util') 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) { 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(); } -- cgit 1.5.1