MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / findOrCreateLinenBot

Function findOrCreateLinenBot

apps/web/services/users/findOrCreateLinenBot.ts:4–26  ·  view source on GitHub ↗
(accountId: string)

Source from the content-addressed store, hash-verified

2import { config } from 'config';
3
4export async function findOrCreateLinenBot(accountId: string) {
5 let linenBot = await prisma.users.findUnique({
6 where: {
7 externalUserId_accountsId: {
8 accountsId: accountId,
9 externalUserId: config.linen.bot.externalId,
10 },
11 },
12 });
13 if (!linenBot) {
14 linenBot = await prisma.users.create({
15 data: {
16 isAdmin: false,
17 isBot: true,
18 accountsId: accountId,
19 externalUserId: config.linen.bot.externalId,
20 displayName: config.linen.bot.displayName,
21 profileImageUrl: config.linen.squareLogo,
22 },
23 });
24 }
25 return linenBot;
26}

Callers 2

notifyChannelsFunction · 0.90
eventNewThreadFunction · 0.90

Calls 1

createMethod · 0.45

Tested by

no test coverage detected