summary refs log tree commit diff
path: root/src/util/Event.ts
blob: c75c909f0b4e8662bef4aed458cbd23d6c82a4bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import { Event, EventModel } from "fosscord-server-util";

export async function emitEvent(payload: Omit<Event, "created_at">) {
	const emitEvent = {
		created_at: Math.floor(Date.now() / 1000), // in seconds
		...payload,
	};

	return await new EventModel(emitEvent).save();
}