diff --git a/src/notify/index.ts b/src/notify/index.ts new file mode 100644 index 0000000..2201bac --- /dev/null +++ b/src/notify/index.ts @@ -0,0 +1,14 @@ +import { Module } from "../module"; +import { Feature, WhosOnlineResponse } from "./types"; + +export class NotifyModule extends Module { + public async fetchOnlineUsers(feature: Feature) { + return this.client._call( + WhosOnlineResponse, + "notify.whosonline", + { + feature: feature as string, + } + ); + } +} diff --git a/src/notify/types.ts b/src/notify/types.ts new file mode 100644 index 0000000..cb6bb32 --- /dev/null +++ b/src/notify/types.ts @@ -0,0 +1,14 @@ +import { TCResponse, TCResponseRaw } from "../types"; + +export class WhosOnlineResponse extends TCResponse { + users: { id: string }; + + public constructor(res: TCResponseRaw) { + super(res); + this.users = res["users"]; + } +} + +export enum Feature { + FORUM = "forum", +}