fix: create user object when creating bot

This commit is contained in:
izzy
2025-11-16 14:22:33 +00:00
parent ec178587bf
commit dd74283320
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "stoat.js",
"version": "7.3.4",
"version": "7.3.5",
"type": "module",
"exports": {
".": "./lib/index.js"
+2 -1
View File
@@ -71,10 +71,11 @@ export class BotCollection extends ClassCollection<Bot, HydratedBot> {
* @returns The newly-created bot
*/
async createBot(name: string): Promise<Bot> {
const bot = await this.client.api.post(`/bots/create`, {
const { user, ...bot } = await this.client.api.post(`/bots/create`, {
name,
});
this.client.users.getOrCreate(user._id, user);
return this.getOrCreate(bot._id, bot);
}
}