From 0ea2058a7c2c7bc73ea69b713063b014e6e17600 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Thu, 16 May 2024 09:17:12 -0700 Subject: [PATCH] add notify module --- src/notify/index.ts | 14 ++++++++++++++ src/notify/types.ts | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/notify/index.ts create mode 100644 src/notify/types.ts 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", +}