diff --git a/src/classes/Bot.ts b/src/classes/Bot.ts index 503adb12..f68a0a70 100644 --- a/src/classes/Bot.ts +++ b/src/classes/Bot.ts @@ -3,6 +3,7 @@ import { decodeTime } from "ulid"; import type { BotCollection } from "../collections/BotCollection.js"; import type { BotFlags } from "../hydration/bot.js"; +import { hydrate } from "../hydration/index.js"; import { PublicBot } from "./PublicBot.js"; import type { User } from "./User.js"; @@ -139,7 +140,15 @@ export class Bot { * @param data Changes */ async edit(data: DataEditBot): Promise { - await this.#collection.client.api.patch(`/bots/${this.id as ""}`, data); + this.#collection.updateUnderlyingObject( + this.id, + hydrate( + "bot", + await this.#collection.client.api.patch(`/bots/${this.id as ""}`, data), + this.#collection.client, + false, + ), + ); } /** diff --git a/src/classes/User.ts b/src/classes/User.ts index 296650f5..31cc86d9 100644 --- a/src/classes/User.ts +++ b/src/classes/User.ts @@ -2,6 +2,7 @@ import type { User as APIUser, DataEditUser, Presence } from "stoat-api"; import { decodeTime } from "ulid"; import type { UserCollection } from "../collections/UserCollection.js"; +import { hydrate } from "../hydration/index.js"; import { U32_MAX, UserPermission } from "../permissions/definitions.js"; import type { Channel } from "./Channel.js"; @@ -225,11 +226,19 @@ export class User { * @param data Changes */ async edit(data: DataEditUser): Promise { - await this.#collection.client.api.patch( - `/users/${ - this.id === this.#collection.client.user?.id ? "@me" : this.id - }`, - data, + this.#collection.updateUnderlyingObject( + this.id, + hydrate( + "user", + await this.#collection.client.api.patch( + `/users/${ + this.id === this.#collection.client.user?.id ? "@me" : this.id + }`, + data, + ), + this.#collection.client, + false, + ), ); }