mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-18 16:34:27 -04:00
fix: create user object when creating bot
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stoat.js",
|
||||
"version": "7.3.4",
|
||||
"version": "7.3.5",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./lib/index.js"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user