switch to mongoose
This commit is contained in:
+4
-20
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user