Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/bot.amplify.aws/src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { PrismaClient } from '@hey-amplify/prisma-client'

export const prisma = new PrismaClient()
21 changes: 20 additions & 1 deletion apps/discord-bot/tests/discord-bot.test.ts
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
test.todo('discord-bot')
import { Events, Message } from 'discord.js'
import { createBot } from '@hey-amplify/discord'
import type { Client } from 'discord.js'

let bot: Client
beforeAll(async () => {
bot = await createBot()
})

afterAll(() => {
bot?.destroy()
})

describe('discord-bot', () => {
// TODO: add tests
it('should respond', async () => {
// bot.emit(Events.MessageCreate, {
// })
})
})
3 changes: 2 additions & 1 deletion apps/discord-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true
}
},
"include": ["env.d.ts", "discord-bot.ts", "tests/**/*.ts"]
}
8 changes: 8 additions & 0 deletions apps/discord-bot/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ['tests/*.test.ts'],
globals: true,
},
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"prisma": {
"schema": "./packages/prisma-client/schema.prisma",
"seed": "vite-node ./packages/prisma-client/scripts/init.ts"
"seed": "vite-node ./packages/prisma-scripts/init.ts"
},
"prettier": {
"tabWidth": 2,
Expand Down
5 changes: 3 additions & 2 deletions packages/discord/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ client.on(Events.ThreadUpdate, async (thread) => {
console.log(`Thread ${thread.id} updated`)
})

export function createBot(token = process.env.DISCORD_BOT_TOKEN) {
return client.login(token)
export async function createBot(token = process.env.DISCORD_BOT_TOKEN) {
await client.login(token)
return client
}

// capture SIGINT (Ctrl+C) to gracefully shutdown
Expand Down
4 changes: 0 additions & 4 deletions packages/prisma-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
"@prisma/client": "^4.12.0"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"@hey-amplify/constants": "workspace:*",
"@hey-amplify/discord": "workspace:*",
"@hey-amplify/features": "workspace:*",
"prisma": "^4.12.0"
}
}
3 changes: 0 additions & 3 deletions packages/prisma-client/scripts/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PrismaClient } from '../build/generated/client/index.js'
import { PrismaClient } from '@hey-amplify/prisma-client'
import { ACCESS_LEVELS, FEATURE_TYPES } from '@hey-amplify/constants'
import { integrations, types as featureTypes } from '@hey-amplify/features'
import { createCommandFeatures } from '@hey-amplify/discord'
Expand Down
19 changes: 19 additions & 0 deletions packages/prisma-scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@hey-amplify/prisma-scripts",
"private": true,
"type": "module",
"version": "1.0.0",
"exports": {
"./package.json": "./package.json"
},
"scripts": {
"build": "echo 'no build needed'"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"@hey-amplify/constants": "workspace:*",
"@hey-amplify/discord": "workspace:*",
"@hey-amplify/features": "workspace:*",
"@hey-amplify/prisma-client": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { faker } from '@faker-js/faker'
import { ACCESS_LEVELS } from '@hey-amplify/constants'
import { PrismaClient } from '../build/generated/client/index.js'
import { PrismaClient } from '@hey-amplify/prisma-client'
import type {
DiscordUser,
DiscordRole,
Prisma,
} from '../build/generated/client/index.js'
} from '@hey-amplify/prisma-client'

const prisma = new PrismaClient()

Expand Down
18 changes: 11 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.