mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-16 07:04:24 -04:00
refactor: Reexport UserLimits, change getLimits to get limits (#167)
* refactor: Reexport UserLimits, change getLimits to get limits Signed-off-by: Jacob Schlecht <dadadah@echoha.us> * fix: Use new userlimits on the client class Signed-off-by: Jacob Schlecht <dadadah@echoha.us> --------- Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
This commit is contained in:
+7
-4
@@ -4,14 +4,14 @@ import { batch, createSignal } from "solid-js";
|
||||
import { ReactiveMap } from "@solid-primitives/map";
|
||||
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
|
||||
import { API } from "stoat-api";
|
||||
import type { DataLogin, RevoltConfig, Role, UserLimits } from "stoat-api";
|
||||
import type { DataLogin, RevoltConfig, Role } from "stoat-api";
|
||||
|
||||
import type { Channel } from "./classes/Channel.js";
|
||||
import type { Emoji } from "./classes/Emoji.js";
|
||||
import type { Message } from "./classes/Message.js";
|
||||
import type { Server } from "./classes/Server.js";
|
||||
import type { ServerMember } from "./classes/ServerMember.js";
|
||||
import type { User } from "./classes/User.js";
|
||||
import type { User, UserLimits } from "./classes/User.js";
|
||||
import { AccountCollection } from "./collections/AccountCollection.js";
|
||||
import { BotCollection } from "./collections/BotCollection.js";
|
||||
import { ChannelCollection } from "./collections/ChannelCollection.js";
|
||||
@@ -611,11 +611,14 @@ export class Client extends AsyncEventEmitter<Events> {
|
||||
this.#slowmodeTimers.set(channelId, timer);
|
||||
}
|
||||
|
||||
getLimits(): UserLimits | undefined {
|
||||
/**
|
||||
* Backend enforced limits for the logged in user
|
||||
*/
|
||||
get limits(): UserLimits | undefined {
|
||||
if (!this.configured() || !this.user) {
|
||||
return;
|
||||
}
|
||||
|
||||
return this.user.getLimits();
|
||||
return this.user.limits;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-2
@@ -1,8 +1,8 @@
|
||||
import type {
|
||||
User as APIUser,
|
||||
UserLimits as APIUserLimits,
|
||||
DataEditUser,
|
||||
Presence,
|
||||
UserLimits,
|
||||
} from "stoat-api";
|
||||
import { decodeTime } from "ulid";
|
||||
|
||||
@@ -14,6 +14,8 @@ import type { Channel } from "./Channel.js";
|
||||
import type { File } from "./File.js";
|
||||
import { UserProfile } from "./UserProfile.js";
|
||||
|
||||
export type UserLimits = APIUserLimits;
|
||||
|
||||
/**
|
||||
* User Class
|
||||
*/
|
||||
@@ -347,7 +349,10 @@ export class User {
|
||||
);
|
||||
}
|
||||
|
||||
getLimits(): UserLimits | undefined {
|
||||
/**
|
||||
* Backend enforced limits for a user
|
||||
*/
|
||||
get limits(): UserLimits | undefined {
|
||||
if (!this.#collection.client.configured()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user