mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-21 04:25:27 -04:00
fix: weird typing issues, added TODOs
This commit is contained in:
@@ -20,7 +20,12 @@ export class PublicBot {
|
||||
this.#client = client;
|
||||
this.id = data._id;
|
||||
this.username = data.username;
|
||||
this.avatar = data.avatar ? new File(client, data.avatar) : undefined;
|
||||
this.avatar = data.avatar
|
||||
? new File(client, {
|
||||
_id: data.avatar,
|
||||
tag: "avatars",
|
||||
} as API.File)
|
||||
: undefined;
|
||||
this.description = data.description!;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { batch } from "solid-js";
|
||||
|
||||
import type {
|
||||
AllMemberResponse,
|
||||
Category,
|
||||
DataBanCreate,
|
||||
DataCreateChannel,
|
||||
@@ -590,9 +591,10 @@ export class Server {
|
||||
* @returns List of the server's members and their user objects
|
||||
*/
|
||||
async fetchMembers() {
|
||||
const data = await this.#collection.client.api.get(
|
||||
const data = (await this.#collection.client.api.get(
|
||||
// @ts-expect-error TODO weird typing issue
|
||||
`/servers/${this.id as ""}/members`
|
||||
);
|
||||
)) as AllMemberResponse;
|
||||
|
||||
return batch(() => ({
|
||||
members: data.members.map((member) =>
|
||||
|
||||
@@ -21,7 +21,10 @@ export class ServerCollection extends ClassCollection<Server, HydratedServer> {
|
||||
async fetch(id: string): Promise<Server> {
|
||||
const server = this.get(id);
|
||||
if (server) return server;
|
||||
const data = await this.client.api.get(`/servers/${id as ""}`);
|
||||
const data = (await this.client.api.get(
|
||||
// @ts-expect-error TODO weird typing issue
|
||||
`/servers/${id as ""}`
|
||||
)) as API.Server;
|
||||
return this.getOrCreate(data._id, data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user