Skip to content

feat: tags - #91

Open
hmd-ali wants to merge 27 commits into
mainfrom
feat/tags
Open

feat: tags#91
hmd-ali wants to merge 27 commits into
mainfrom
feat/tags

Conversation

@hmd-ali

@hmd-ali hmd-ali commented Aug 17, 2026

Copy link
Copy Markdown
Contributor
  • chore: add prisma and SQLite deps
  • feat: add prisma schema
  • ci: enhance CI/CD workflows with rollback support and Prisma integration
  • chore: add lru-cache package
  • feat: add TAG_ACCESS_ROLE_ID env
  • feat: add prisma to tsconfig
  • feat: add utils
  • feat: export prisma singleton
  • feat: add ErrorMessages class
  • feat: add bot options
  • feat: add tags feature

@hmd-ali
hmd-ali marked this pull request as draft August 17, 2026 19:16
@wiktoriavh wiktoriavh linked an issue Aug 17, 2026 that may be closed by this pull request
@hmd-ali
hmd-ali marked this pull request as ready for review August 18, 2026 17:42
@hmd-ali
hmd-ali requested a review from wiktoriavh August 18, 2026 17:42
@hmd-ali
hmd-ali marked this pull request as draft August 19, 2026 01:17
@hmd-ali
hmd-ali marked this pull request as ready for review August 19, 2026 18:34
@@ -1,58 +1,126 @@
name: Build, Test and Deploy Discord Bot to VPS

name: Deploy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you rename it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main purpose of the of this workflow is deploying the bot

Comment thread .github/workflows/deploy.yml
Comment thread .github/workflows/deploy.yml
Comment on lines +125 to +126
REPO_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
REF: ${{ github.event.inputs.ref != '' && github.event.inputs.ref || 'main' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain this, too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variables for the Deploy via SSH step, (imagine this is TS file and these are const REPO_URL = ...). makes it cleaner than hardcoding/duplicating them in the scripts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that it is setting a var, but i don't get the purpose here. why is it https://x-access-token:? i have never seen this before, so that is why those two lines confuse me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah mb, repo is public anyways, we don't need that. (first line)
second line (REF) is allowing us to optionally pick a commit SHA when manually triggering a deployment. Pushes to main always deploy main

Comment thread prisma/schema.prisma
Comment thread docker-compose.yml
services:
# Production service - optimized runtime
bot-prod:
bot:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you rename it to bot?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the docker file in 2, this one and a .dev.yml one.
we don't need to specify that is bot-prod, since, this docker compose file, is used only in production.

Comment thread package.json
"test": "tsx --test '**/*.test.ts'",
"test:ci": "NODE_ENV=test node --test \"dist/**/*.test.js\"",
"prepare": "husky",
"prepare": "husky || true",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

@hmd-ali hmd-ali Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm install automatically calls pnpm prepare if present, husky is a dev dep, it won't be available when running in production.
|| true fixes this, if husky is present, run husky, else do nothing.
Otherwise this will break and the process will exit.

Comment thread package.json
"@prisma/client": "^7.8.0",
"discord.js": "^14.26.4",
"dotenv": "^17.4.2",
"lru-cache": "^11.5.2",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this in-memory? can you tell my more on why it was added?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah in-memory.
used in the tags cache, to avoid hitting the db on every tag usage.
when someone uses a tag for a first time, they're persisted in-memory

Comment thread package.json
"@prisma/adapter-better-sqlite3": "^7.8.0",
"@prisma/client": "^7.8.0",
"discord.js": "^14.26.4",
"dotenv": "^17.4.2",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the decision for dotenv?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added when I added prisma, I'm not using it directly, will check if removing it affects prisma

Comment thread tsup.config.ts
format: ['esm'],
target: 'esnext',
entry: ['src/**/*.ts', 'scripts/**/*.ts'],
entry: ['src/**/*.ts'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove scripts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have scripts anymore, (changed in previous PRs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's in src now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate the tags functionality to the community bot

2 participants