Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
}
9 changes: 7 additions & 2 deletions src/classes/User.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {
User as APIUser,
UserLimits as APIUserLimits,
DataEditUser,
Presence,
UserLimits,
} from "stoat-api";
import { decodeTime } from "ulid";

Expand All @@ -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
*/
Expand Down Expand Up @@ -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;
}
Expand Down
Loading