Skip to content

Commit 4573e6b

Browse files
authored
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>
1 parent afdd11f commit 4573e6b

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/Client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { batch, createSignal } from "solid-js";
44
import { ReactiveMap } from "@solid-primitives/map";
55
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
66
import { API } from "stoat-api";
7-
import type { DataLogin, RevoltConfig, Role, UserLimits } from "stoat-api";
7+
import type { DataLogin, RevoltConfig, Role } from "stoat-api";
88

99
import type { Channel } from "./classes/Channel.js";
1010
import type { Emoji } from "./classes/Emoji.js";
1111
import type { Message } from "./classes/Message.js";
1212
import type { Server } from "./classes/Server.js";
1313
import type { ServerMember } from "./classes/ServerMember.js";
14-
import type { User } from "./classes/User.js";
14+
import type { User, UserLimits } from "./classes/User.js";
1515
import { AccountCollection } from "./collections/AccountCollection.js";
1616
import { BotCollection } from "./collections/BotCollection.js";
1717
import { ChannelCollection } from "./collections/ChannelCollection.js";
@@ -611,11 +611,14 @@ export class Client extends AsyncEventEmitter<Events> {
611611
this.#slowmodeTimers.set(channelId, timer);
612612
}
613613

614-
getLimits(): UserLimits | undefined {
614+
/**
615+
* Backend enforced limits for the logged in user
616+
*/
617+
get limits(): UserLimits | undefined {
615618
if (!this.configured() || !this.user) {
616619
return;
617620
}
618621

619-
return this.user.getLimits();
622+
return this.user.limits;
620623
}
621624
}

src/classes/User.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type {
22
User as APIUser,
3+
UserLimits as APIUserLimits,
34
DataEditUser,
45
Presence,
5-
UserLimits,
66
} from "stoat-api";
77
import { decodeTime } from "ulid";
88

@@ -14,6 +14,8 @@ import type { Channel } from "./Channel.js";
1414
import type { File } from "./File.js";
1515
import { UserProfile } from "./UserProfile.js";
1616

17+
export type UserLimits = APIUserLimits;
18+
1719
/**
1820
* User Class
1921
*/
@@ -347,7 +349,10 @@ export class User {
347349
);
348350
}
349351

350-
getLimits(): UserLimits | undefined {
352+
/**
353+
* Backend enforced limits for a user
354+
*/
355+
get limits(): UserLimits | undefined {
351356
if (!this.#collection.client.configured()) {
352357
return;
353358
}

0 commit comments

Comments
 (0)