Skip to content

Commit

Permalink
chore: remember to save the chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Sep 8, 2024
1 parent 7b10cbc commit ec53f82
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/bot/mtproto-api/workrooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ export async function createChat(context: Context<"issues.labeled", SupportedEve
})
);

const chatInfo = chat.toJSON().updates.toJSON()

if (!chatInfo) {
throw new Error("Failed to create chat");
}

let chatId;

if ("id" in chatInfo) {
chatId = chatInfo.id;
} else {
throw new Error("Failed to create chat");
}

await context.adapters.supabase.chats.saveChat(chatId, payload.issue.title, payload.issue.node_id);

return { status: 200, reason: "chat_created" };
} catch (er) {
context.logger.error("Failed to create chat", { er });
Expand Down

0 comments on commit ec53f82

Please sign in to comment.