generated from nhcarrigan/template
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7cf349e0f2 | |||
| c032951865 | |||
| c128097f64 | |||
| c238207db8 | |||
| ead3bd18ad | |||
| 5d37ae0aa8 | |||
| d2c3f3d77c | |||
| adbc67390a | |||
| b293b5673a | |||
| 0739efa7fa | |||
| 68b806ccba | |||
| 6158fb73a6 | |||
| ad12241ad0 | |||
| deed8e6436 | |||
| 411a647d2d |
@@ -0,0 +1,47 @@
|
||||
name: Node.js CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: CI
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Files
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js v24
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- name: Ensure Dependencies are Pinned
|
||||
uses: naomi-lgbt/dependency-pin-check@main
|
||||
with:
|
||||
language: javascript
|
||||
dev-dependencies: true
|
||||
peer-dependencies: true
|
||||
optional-dependencies: true
|
||||
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint Source Files
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Verify Build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Run Tests
|
||||
run: pnpm run test
|
||||
@@ -0,0 +1,177 @@
|
||||
name: Security Scan and Upload
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '0 0 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
security-audit:
|
||||
name: Security & DefectDojo Upload
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# --- AUTO-SETUP PROJECT ---
|
||||
- name: Ensure DefectDojo Product Exists
|
||||
env:
|
||||
DD_URL: ${{ secrets.DD_URL }}
|
||||
DD_TOKEN: ${{ secrets.DD_TOKEN }}
|
||||
PRODUCT_NAME: ${{ github.repository }}
|
||||
PRODUCT_TYPE_ID: 1
|
||||
run: |
|
||||
sudo apt-get install jq -y > /dev/null
|
||||
|
||||
echo "Checking connection to $DD_URL..."
|
||||
|
||||
# Check if product exists - capture HTTP code to debug connection issues
|
||||
RESPONSE=$(curl --write-out "%{http_code}" --silent --output /tmp/response.json \
|
||||
-H "Authorization: Token $DD_TOKEN" \
|
||||
"$DD_URL/api/v2/products/?name=$PRODUCT_NAME")
|
||||
|
||||
# If response is not 200, print error
|
||||
if [ "$RESPONSE" != "200" ]; then
|
||||
echo "::error::Failed to query DefectDojo. HTTP Code: $RESPONSE"
|
||||
cat /tmp/response.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COUNT=$(cat /tmp/response.json | jq -r '.count')
|
||||
|
||||
if [ "$COUNT" = "0" ]; then
|
||||
echo "Creating product '$PRODUCT_NAME'..."
|
||||
curl -s -X POST "$DD_URL/api/v2/products/" \
|
||||
-H "Authorization: Token $DD_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{ "name": "'"$PRODUCT_NAME"'", "description": "Auto-created by Gitea Actions", "prod_type": '$PRODUCT_TYPE_ID' }'
|
||||
else
|
||||
echo "Product '$PRODUCT_NAME' already exists."
|
||||
fi
|
||||
|
||||
# --- 1. TRIVY (Dependencies & Misconfig) ---
|
||||
- name: Install Trivy
|
||||
run: |
|
||||
sudo apt-get install wget apt-transport-https gnupg lsb-release -y
|
||||
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
|
||||
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
|
||||
sudo apt-get update && sudo apt-get install trivy -y
|
||||
|
||||
- name: Run Trivy (FS Scan)
|
||||
run: |
|
||||
trivy fs . --scanners vuln,misconfig --format json --output trivy-results.json --exit-code 0
|
||||
|
||||
- name: Upload Trivy to DefectDojo
|
||||
env:
|
||||
DD_URL: ${{ secrets.DD_URL }}
|
||||
DD_TOKEN: ${{ secrets.DD_TOKEN }}
|
||||
run: |
|
||||
echo "Uploading Trivy results..."
|
||||
# Generate today's date in YYYY-MM-DD format
|
||||
TODAY=$(date +%Y-%m-%d)
|
||||
|
||||
HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \
|
||||
-H "Authorization: Token $DD_TOKEN" \
|
||||
-F "active=true" \
|
||||
-F "verified=true" \
|
||||
-F "scan_type=Trivy Scan" \
|
||||
-F "engagement_name=CI/CD Pipeline" \
|
||||
-F "product_name=${{ github.repository }}" \
|
||||
-F "scan_date=$TODAY" \
|
||||
-F "auto_create_context=true" \
|
||||
-F "file=@trivy-results.json")
|
||||
|
||||
if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then
|
||||
echo "::error::Upload Failed with HTTP $HTTP_CODE"
|
||||
echo "--- SERVER RESPONSE ---"
|
||||
cat response.txt
|
||||
echo "-----------------------"
|
||||
exit 1
|
||||
else
|
||||
echo "Upload Success!"
|
||||
fi
|
||||
|
||||
# --- 2. GITLEAKS (Secrets) ---
|
||||
- name: Install Gitleaks
|
||||
run: |
|
||||
wget -qO gitleaks.tar.gz https://github.com/gitleaks/gitleaks/releases/download/v8.18.0/gitleaks_8.18.0_linux_x64.tar.gz
|
||||
tar -xzf gitleaks.tar.gz
|
||||
sudo mv gitleaks /usr/local/bin/ && chmod +x /usr/local/bin/gitleaks
|
||||
|
||||
- name: Run Gitleaks
|
||||
run: gitleaks detect --source . -v --report-path gitleaks-results.json --report-format json --no-git || true
|
||||
|
||||
- name: Upload Gitleaks to DefectDojo
|
||||
env:
|
||||
DD_URL: ${{ secrets.DD_URL }}
|
||||
DD_TOKEN: ${{ secrets.DD_TOKEN }}
|
||||
run: |
|
||||
echo "Uploading Gitleaks results..."
|
||||
TODAY=$(date +%Y-%m-%d)
|
||||
|
||||
HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \
|
||||
-H "Authorization: Token $DD_TOKEN" \
|
||||
-F "active=true" \
|
||||
-F "verified=true" \
|
||||
-F "scan_type=Gitleaks Scan" \
|
||||
-F "engagement_name=CI/CD Pipeline" \
|
||||
-F "product_name=${{ github.repository }}" \
|
||||
-F "scan_date=$TODAY" \
|
||||
-F "auto_create_context=true" \
|
||||
-F "file=@gitleaks-results.json")
|
||||
|
||||
if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then
|
||||
echo "::error::Upload Failed with HTTP $HTTP_CODE"
|
||||
echo "--- SERVER RESPONSE ---"
|
||||
cat response.txt
|
||||
echo "-----------------------"
|
||||
exit 1
|
||||
else
|
||||
echo "Upload Success!"
|
||||
fi
|
||||
|
||||
# --- 3. SEMGREP (SAST) ---
|
||||
- name: Install Semgrep (via pipx)
|
||||
run: |
|
||||
sudo apt-get install pipx -y
|
||||
pipx install semgrep
|
||||
# Add pipx binary path to GITHUB_PATH so next steps can see 'semgrep'
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run Semgrep
|
||||
run: semgrep scan --config=p/security-audit --config=p/owasp-top-ten --json --output semgrep-results.json . || true
|
||||
|
||||
- name: Upload Semgrep to DefectDojo
|
||||
env:
|
||||
DD_URL: ${{ secrets.DD_URL }}
|
||||
DD_TOKEN: ${{ secrets.DD_TOKEN }}
|
||||
run: |
|
||||
echo "Uploading Semgrep results..."
|
||||
TODAY=$(date +%Y-%m-%d)
|
||||
|
||||
HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \
|
||||
-H "Authorization: Token $DD_TOKEN" \
|
||||
-F "active=true" \
|
||||
-F "verified=true" \
|
||||
-F "scan_type=Semgrep JSON Report" \
|
||||
-F "engagement_name=CI/CD Pipeline" \
|
||||
-F "product_name=${{ github.repository }}" \
|
||||
-F "scan_date=$TODAY" \
|
||||
-F "auto_create_context=true" \
|
||||
-F "file=@semgrep-results.json")
|
||||
|
||||
if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then
|
||||
echo "::error::Upload Failed with HTTP $HTTP_CODE"
|
||||
echo "--- SERVER RESPONSE ---"
|
||||
cat response.txt
|
||||
echo "-----------------------"
|
||||
exit 1
|
||||
else
|
||||
echo "Upload Success!"
|
||||
fi
|
||||
@@ -1 +1,2 @@
|
||||
node_modules
|
||||
prod
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Package Manager Configuration
|
||||
# Force pnpm usage - breaks npm/yarn intentionally
|
||||
node-linker=pnpm
|
||||
|
||||
# Security: Disable all lifecycle scripts
|
||||
ignore-scripts=true
|
||||
enable-pre-post-scripts=false
|
||||
|
||||
# Security: Require packages to be 10+ days old before installation
|
||||
minimum-release-age=14400
|
||||
|
||||
# Security: Verify package integrity hashes
|
||||
verify-store-integrity=true
|
||||
|
||||
# Security: Enforce strict trust policies
|
||||
trust-policy=strict
|
||||
|
||||
# Security: Strict peer dependency resolution
|
||||
strict-peer-dependencies=true
|
||||
|
||||
# Performance: Use symlinks for node_modules
|
||||
symlink=true
|
||||
|
||||
# Lockfile: Ensure lockfile is not modified during install
|
||||
frozen-lockfile=false
|
||||
@@ -18,7 +18,7 @@ This page is currently deployed. [View the live website.]
|
||||
|
||||
## Feedback and Bugs
|
||||
|
||||
If you have feedback or a bug report, please feel free to open a GitHub issue!
|
||||
If you have feedback or a bug report, please [log a ticket on our forum](https://support.nhcarrigan.com).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"lint": "eslint src --max-warnings 0",
|
||||
"start": "op run --env-file=prod.env --no-masking -- node prod/index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 0"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Naomi Carrigan",
|
||||
@@ -20,7 +20,7 @@
|
||||
"@types/node": "22.13.9",
|
||||
"@types/node-schedule": "2.1.7",
|
||||
"eslint": "9.21.0",
|
||||
"typescript": "5.8.2"
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@atproto/api": "0.14.8",
|
||||
|
||||
Generated
+76
-66
@@ -35,10 +35,10 @@ importers:
|
||||
devDependencies:
|
||||
'@nhcarrigan/eslint-config':
|
||||
specifier: 5.2.0
|
||||
version: 5.2.0(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(playwright@1.51.0)(react@19.0.0)(typescript@5.8.2)(vitest@3.0.8(@types/node@22.13.9))
|
||||
version: 5.2.0(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(playwright@1.51.0)(react@19.0.0)(typescript@5.9.3)(vitest@3.0.8(@types/node@22.13.9))
|
||||
'@nhcarrigan/typescript-config':
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0(typescript@5.8.2)
|
||||
version: 4.0.0(typescript@5.9.3)
|
||||
'@types/node':
|
||||
specifier: 22.13.9
|
||||
version: 22.13.9
|
||||
@@ -49,8 +49,8 @@ importers:
|
||||
specifier: 9.21.0
|
||||
version: 9.21.0
|
||||
typescript:
|
||||
specifier: 5.8.2
|
||||
version: 5.8.2
|
||||
specifier: 5.9.3
|
||||
version: 5.9.3
|
||||
|
||||
packages:
|
||||
|
||||
@@ -426,51 +426,61 @@ packages:
|
||||
resolution: {integrity: sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.34.9':
|
||||
resolution: {integrity: sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.34.9':
|
||||
resolution: {integrity: sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-loongarch64-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.34.9':
|
||||
resolution: {integrity: sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.34.9':
|
||||
resolution: {integrity: sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.34.9':
|
||||
resolution: {integrity: sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==}
|
||||
@@ -2429,8 +2439,8 @@ packages:
|
||||
resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
typescript@5.8.2:
|
||||
resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==}
|
||||
typescript@5.9.3:
|
||||
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
@@ -2874,19 +2884,19 @@ snapshots:
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.0': {}
|
||||
|
||||
'@nhcarrigan/eslint-config@5.2.0(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(playwright@1.51.0)(react@19.0.0)(typescript@5.8.2)(vitest@3.0.8(@types/node@22.13.9))':
|
||||
'@nhcarrigan/eslint-config@5.2.0(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(playwright@1.51.0)(react@19.0.0)(typescript@5.9.3)(vitest@3.0.8(@types/node@22.13.9))':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.21.0)
|
||||
'@eslint/compat': 1.2.4(eslint@9.21.0)
|
||||
'@eslint/eslintrc': 3.2.0
|
||||
'@eslint/js': 9.17.0
|
||||
'@stylistic/eslint-plugin': 2.12.1(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/eslint-plugin': 8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@vitest/eslint-plugin': 1.1.24(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(typescript@5.8.2)(vitest@3.0.8(@types/node@22.13.9))
|
||||
'@stylistic/eslint-plugin': 2.12.1(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@typescript-eslint/eslint-plugin': 8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@vitest/eslint-plugin': 1.1.24(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(typescript@5.9.3)(vitest@3.0.8(@types/node@22.13.9))
|
||||
eslint: 9.21.0
|
||||
eslint-plugin-deprecation: 3.0.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)
|
||||
eslint-plugin-deprecation: 3.0.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)
|
||||
eslint-plugin-jsdoc: 50.6.1(eslint@9.21.0)
|
||||
eslint-plugin-playwright: 2.1.0(eslint@9.21.0)
|
||||
eslint-plugin-react: 7.37.3(eslint@9.21.0)
|
||||
@@ -2895,7 +2905,7 @@ snapshots:
|
||||
globals: 15.14.0
|
||||
playwright: 1.51.0
|
||||
react: 19.0.0
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
vitest: 3.0.8(@types/node@22.13.9)
|
||||
transitivePeerDependencies:
|
||||
- '@typescript-eslint/utils'
|
||||
@@ -2905,9 +2915,9 @@ snapshots:
|
||||
|
||||
'@nhcarrigan/logger@1.0.0': {}
|
||||
|
||||
'@nhcarrigan/typescript-config@4.0.0(typescript@5.8.2)':
|
||||
'@nhcarrigan/typescript-config@4.0.0(typescript@5.9.3)':
|
||||
dependencies:
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
@@ -3057,9 +3067,9 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
'@stylistic/eslint-plugin@2.12.1(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@stylistic/eslint-plugin@2.12.1(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 8.26.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/utils': 8.26.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
eslint-visitor-keys: 4.2.0
|
||||
espree: 10.3.0
|
||||
@@ -3140,32 +3150,32 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/node': 22.13.9
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/eslint-plugin@8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.1
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@typescript-eslint/scope-manager': 8.19.0
|
||||
'@typescript-eslint/type-utils': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/utils': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/type-utils': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
'@typescript-eslint/visitor-keys': 8.19.0
|
||||
eslint: 9.21.0
|
||||
graphemer: 1.4.0
|
||||
ignore: 5.3.2
|
||||
natural-compare: 1.4.0
|
||||
ts-api-utils: 1.4.3(typescript@5.8.2)
|
||||
typescript: 5.8.2
|
||||
ts-api-utils: 1.4.3(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.19.0
|
||||
'@typescript-eslint/types': 8.19.0
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.8.2)
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.9.3)
|
||||
'@typescript-eslint/visitor-keys': 8.19.0
|
||||
debug: 4.4.0
|
||||
eslint: 9.21.0
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -3184,14 +3194,14 @@ snapshots:
|
||||
'@typescript-eslint/types': 8.26.0
|
||||
'@typescript-eslint/visitor-keys': 8.26.0
|
||||
|
||||
'@typescript-eslint/type-utils@8.19.0(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/type-utils@8.19.0(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.8.2)
|
||||
'@typescript-eslint/utils': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
debug: 4.4.0
|
||||
eslint: 9.21.0
|
||||
ts-api-utils: 1.4.3(typescript@5.8.2)
|
||||
typescript: 5.8.2
|
||||
ts-api-utils: 1.4.3(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -3201,7 +3211,7 @@ snapshots:
|
||||
|
||||
'@typescript-eslint/types@8.26.0': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@7.18.0(typescript@5.8.2)':
|
||||
'@typescript-eslint/typescript-estree@7.18.0(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 7.18.0
|
||||
'@typescript-eslint/visitor-keys': 7.18.0
|
||||
@@ -3210,13 +3220,13 @@ snapshots:
|
||||
is-glob: 4.0.3
|
||||
minimatch: 9.0.5
|
||||
semver: 7.7.1
|
||||
ts-api-utils: 1.4.3(typescript@5.8.2)
|
||||
ts-api-utils: 1.4.3(typescript@5.9.3)
|
||||
optionalDependencies:
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.19.0(typescript@5.8.2)':
|
||||
'@typescript-eslint/typescript-estree@8.19.0(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.19.0
|
||||
'@typescript-eslint/visitor-keys': 8.19.0
|
||||
@@ -3225,12 +3235,12 @@ snapshots:
|
||||
is-glob: 4.0.3
|
||||
minimatch: 9.0.5
|
||||
semver: 7.7.1
|
||||
ts-api-utils: 1.4.3(typescript@5.8.2)
|
||||
typescript: 5.8.2
|
||||
ts-api-utils: 1.4.3(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.26.0(typescript@5.8.2)':
|
||||
'@typescript-eslint/typescript-estree@8.26.0(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.26.0
|
||||
'@typescript-eslint/visitor-keys': 8.26.0
|
||||
@@ -3239,41 +3249,41 @@ snapshots:
|
||||
is-glob: 4.0.3
|
||||
minimatch: 9.0.5
|
||||
semver: 7.7.1
|
||||
ts-api-utils: 2.0.1(typescript@5.8.2)
|
||||
typescript: 5.8.2
|
||||
ts-api-utils: 2.0.1(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@7.18.0(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/utils@7.18.0(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.21.0)
|
||||
'@typescript-eslint/scope-manager': 7.18.0
|
||||
'@typescript-eslint/types': 7.18.0
|
||||
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.2)
|
||||
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@typescript-eslint/utils@8.19.0(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/utils@8.19.0(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.21.0)
|
||||
'@typescript-eslint/scope-manager': 8.19.0
|
||||
'@typescript-eslint/types': 8.19.0
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.8.2)
|
||||
'@typescript-eslint/typescript-estree': 8.19.0(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.8.2)':
|
||||
'@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.21.0)
|
||||
'@typescript-eslint/scope-manager': 8.26.0
|
||||
'@typescript-eslint/types': 8.26.0
|
||||
'@typescript-eslint/typescript-estree': 8.26.0(typescript@5.8.2)
|
||||
'@typescript-eslint/typescript-estree': 8.26.0(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -3292,12 +3302,12 @@ snapshots:
|
||||
'@typescript-eslint/types': 8.26.0
|
||||
eslint-visitor-keys: 4.2.0
|
||||
|
||||
'@vitest/eslint-plugin@1.1.24(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0)(typescript@5.8.2)(vitest@3.0.8(@types/node@22.13.9))':
|
||||
'@vitest/eslint-plugin@1.1.24(@typescript-eslint/utils@8.26.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0)(typescript@5.9.3)(vitest@3.0.8(@types/node@22.13.9))':
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 8.26.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/utils': 8.26.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
optionalDependencies:
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
vitest: 3.0.8(@types/node@22.13.9)
|
||||
|
||||
'@vitest/expect@3.0.8':
|
||||
@@ -3852,27 +3862,27 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint@9.21.0):
|
||||
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.21.0):
|
||||
dependencies:
|
||||
debug: 3.2.7
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-deprecation@3.0.0(eslint@9.21.0)(typescript@5.8.2):
|
||||
eslint-plugin-deprecation@3.0.0(eslint@9.21.0)(typescript@5.9.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 7.18.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/utils': 7.18.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
eslint: 9.21.0
|
||||
ts-api-utils: 1.4.3(typescript@5.8.2)
|
||||
ts-api-utils: 1.4.3(typescript@5.9.3)
|
||||
tslib: 2.8.1
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint@9.21.0):
|
||||
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint@9.21.0):
|
||||
dependencies:
|
||||
'@rtsao/scc': 1.1.0
|
||||
array-includes: 3.1.8
|
||||
@@ -3883,7 +3893,7 @@ snapshots:
|
||||
doctrine: 2.1.0
|
||||
eslint: 9.21.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint@9.21.0)
|
||||
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.19.0(eslint@9.21.0)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.21.0)
|
||||
hasown: 2.0.2
|
||||
is-core-module: 2.16.1
|
||||
is-glob: 4.0.3
|
||||
@@ -3895,7 +3905,7 @@ snapshots:
|
||||
string.prototype.trimend: 1.0.9
|
||||
tsconfig-paths: 3.15.0
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.8.2)
|
||||
'@typescript-eslint/parser': 8.19.0(eslint@9.21.0)(typescript@5.9.3)
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
@@ -5246,13 +5256,13 @@ snapshots:
|
||||
|
||||
toidentifier@1.0.1: {}
|
||||
|
||||
ts-api-utils@1.4.3(typescript@5.8.2):
|
||||
ts-api-utils@1.4.3(typescript@5.9.3):
|
||||
dependencies:
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
|
||||
ts-api-utils@2.0.1(typescript@5.8.2):
|
||||
ts-api-utils@2.0.1(typescript@5.9.3):
|
||||
dependencies:
|
||||
typescript: 5.8.2
|
||||
typescript: 5.9.3
|
||||
|
||||
ts-mixer@6.0.4: {}
|
||||
|
||||
@@ -5316,7 +5326,7 @@ snapshots:
|
||||
possible-typed-array-names: 1.1.0
|
||||
reflect.getprototypeof: 1.0.10
|
||||
|
||||
typescript@5.8.2: {}
|
||||
typescript@5.9.3: {}
|
||||
|
||||
uint8arrays@3.0.0:
|
||||
dependencies:
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { AtpAgent } from "@atproto/api";
|
||||
import pkg from "@slack/bolt";
|
||||
import { Client, Events } from "discord.js";
|
||||
import { scheduleJob } from "node-schedule";
|
||||
import { serve } from "./server/serve.js";
|
||||
import { getMommy } from "./utils/getMommy.js";
|
||||
import { logger } from "./utils/logger.js";
|
||||
const { App, FileInstallationStore } = pkg;
|
||||
const discord = new Client({ intents: [] });
|
||||
discord.on(Events.ClientReady, () => {
|
||||
void logger.log("info", "Connected to Discord!");
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- This is intentional.
|
||||
discord.on(Events.InteractionCreate, async (interaction) => {
|
||||
if (!interaction.isChatInputCommand()) {
|
||||
return;
|
||||
}
|
||||
await interaction.deferReply();
|
||||
const name = interaction.options.getString("name");
|
||||
const response = await getMommy(name ?? undefined);
|
||||
await interaction.editReply(response);
|
||||
});
|
||||
const slack = new App({
|
||||
clientId: process.env.SLACK_CLIENT_ID ?? "",
|
||||
clientSecret: process.env.SLACK_CLIENT_SECRET ?? "",
|
||||
installationStore: new FileInstallationStore(),
|
||||
installerOptions: {
|
||||
directInstall: true,
|
||||
},
|
||||
scopes: ["commands", "chat:write"],
|
||||
signingSecret: process.env.SLACK_SIGNING_SECRET ?? "",
|
||||
stateSecret: process.env.SLACK_STATE_SECRET ?? "",
|
||||
});
|
||||
slack.command("/mommy", async ({ ack, body, respond }) => {
|
||||
await ack();
|
||||
const response = await getMommy(body.text);
|
||||
await respond(response);
|
||||
});
|
||||
const bsky = new AtpAgent({
|
||||
service: "https://bsky.social",
|
||||
});
|
||||
await discord.login(process.env.DISCORD_TOKEN);
|
||||
await slack.start(8010);
|
||||
await logger.log("info", "Connected to Slack!");
|
||||
await bsky.login({
|
||||
identifier: "mommy.naomi.party",
|
||||
password: process.env.BSKY_PASSWORD ?? "",
|
||||
});
|
||||
await logger.log("info", "Connected to bsky.social!");
|
||||
scheduleJob("0 9 * * *", async () => {
|
||||
const response = await getMommy();
|
||||
await bsky.post({
|
||||
text: response,
|
||||
});
|
||||
await logger.log("info", "Posted to bsky.social!");
|
||||
});
|
||||
serve();
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import fastify from "fastify";
|
||||
import { logger } from "../utils/logger.js";
|
||||
const html = `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mommy Bot</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Mommy loves you~!" />
|
||||
<script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Mommy Bot</h1>
|
||||
<section>
|
||||
<p>Mommy loves you~!</p>
|
||||
<a href="https://slack.com/oauth/v2/authorize?client_id=8569765106322.8554301974567&scope=chat:write,commands&user_scope="><img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x" /></a>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
<a href="https://git.nhcarrigan.com/nhcarrigan/mommy-bot">
|
||||
<i class="fa-solid fa-code"></i> Source Code
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://docs.nhcarrigan.com/">
|
||||
<i class="fa-solid fa-book"></i> Documentation
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://chat.nhcarrigan.com">
|
||||
<i class="fa-solid fa-circle-info"></i> Support
|
||||
</a>
|
||||
</p>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>`;
|
||||
/**
|
||||
* Starts up a web server for health monitoring.
|
||||
*/
|
||||
export const serve = () => {
|
||||
try {
|
||||
const server = fastify({
|
||||
logger: false,
|
||||
});
|
||||
server.get("/", (_request, response) => {
|
||||
response.header("Content-Type", "text/html");
|
||||
response.send(html);
|
||||
});
|
||||
server.listen({ port: 8009 }, (error) => {
|
||||
if (error) {
|
||||
void logger.error("instantiate server", error);
|
||||
return;
|
||||
}
|
||||
void logger.log("debug", "Server listening on port 8009.");
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof Error) {
|
||||
void logger.error("instantiate server", error);
|
||||
return;
|
||||
}
|
||||
void logger.error("instantiate server", new Error("Unknown error"));
|
||||
}
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { isProfane } from "no-profanity";
|
||||
/**
|
||||
* Fetches a mommy quote from the API.
|
||||
* @param name - The user's name, if provided.
|
||||
* @returns The mommy quote.
|
||||
*/
|
||||
export const getMommy = async (name = "dear") => {
|
||||
const finalName = isProfane(name)
|
||||
? "dear"
|
||||
: name;
|
||||
const url = `https://mommy.nhcarrigan.com/api?name=${finalName}`;
|
||||
const request = await fetch(url);
|
||||
const response = await request.text();
|
||||
return response;
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { Logger } from "@nhcarrigan/logger";
|
||||
export const logger = new Logger("Mommy", process.env.LOG_TOKEN ?? "");
|
||||
+7
-6
@@ -6,12 +6,13 @@
|
||||
|
||||
import { AtpAgent } from "@atproto/api";
|
||||
import pkg from "@slack/bolt";
|
||||
import { Client, Events } from "discord.js";
|
||||
import { Client, Events, MessageFlags } from "discord.js";
|
||||
import { scheduleJob } from "node-schedule";
|
||||
import { serve } from "./server/serve.js";
|
||||
import { getMommy } from "./utils/getMommy.js";
|
||||
import { logger } from "./utils/logger.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Classes.
|
||||
const { App, FileInstallationStore } = pkg;
|
||||
|
||||
const discord = new Client({ intents: [ ] });
|
||||
@@ -25,7 +26,7 @@ discord.on(Events.InteractionCreate, async(interaction) => {
|
||||
if (!interaction.isChatInputCommand()) {
|
||||
return;
|
||||
}
|
||||
await interaction.deferReply();
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
const name = interaction.options.getString("name");
|
||||
const response = await getMommy(name ?? undefined);
|
||||
await interaction.editReply(response);
|
||||
@@ -38,19 +39,19 @@ const slack = new App({
|
||||
installerOptions: {
|
||||
directInstall: true,
|
||||
},
|
||||
scopes: [ "commands", "chat:write" ],
|
||||
scopes: [ "commands" ],
|
||||
signingSecret: process.env.SLACK_SIGNING_SECRET ?? "",
|
||||
stateSecret: process.env.SLACK_STATE_SECRET ?? "",
|
||||
});
|
||||
|
||||
slack.command("/mommy", async({ ack, body, say }) => {
|
||||
slack.command("/mommy", async({ ack, body, respond }) => {
|
||||
await ack();
|
||||
const trimmed = body.text.trim();
|
||||
const name = trimmed.length > 0
|
||||
? trimmed
|
||||
: undefined;
|
||||
const response = await getMommy(name);
|
||||
await say(response);
|
||||
await respond(response);
|
||||
});
|
||||
|
||||
const bsky = new AtpAgent({
|
||||
@@ -73,7 +74,7 @@ scheduleJob("0 9 * * *", async() => {
|
||||
await bsky.post({
|
||||
text: response,
|
||||
});
|
||||
await logger.log("info", "Posted to bsky.social!");
|
||||
await logger.log("info", "Posted to bsky!");
|
||||
});
|
||||
|
||||
serve();
|
||||
|
||||
+40
-28
@@ -9,40 +9,52 @@ import { logger } from "../utils/logger.js";
|
||||
|
||||
const html = `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mommy Bot</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Mommy loves you~!" />
|
||||
<script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
||||
<head>
|
||||
<title>Mommy Bot</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Mommy loves you~!" />
|
||||
<script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>Mommy Bot</h1>
|
||||
<img src="https://cdn.nhcarrigan.com/new-avatars/mommy-full.png" width="250" alt="Mommy" />
|
||||
<section>
|
||||
<p>Mommy loves you~!</p>
|
||||
<a href="https://mommy-slack.nhcarrigan.com/slack/install"><img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x" /></a>
|
||||
<a href="https://mommy-slack.nhcarrigan.com/slack/install" style="display: inline-block; background-color: #ffffff; color: black; padding: 10px 20px; text-decoration: none; border-radius: 4px; margin: 5px;">
|
||||
<i class="fab fa-slack"></i> Add to Slack
|
||||
</a>
|
||||
<a href="https://discord.com/oauth2/authorize?client_id=1347642447643017289" class="social-button discord-button" style="display: inline-block; background-color: #5865F2; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; margin: 5px;">
|
||||
<i class="fab fa-discord"></i> Add to Discord
|
||||
</a>
|
||||
<a href="https://bsky.app/profile/mommy.naomi.party" class="social-button bluesky-button" style="display: inline-block; background-color: #0085FF; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; margin: 5px;">
|
||||
<i class="fab fa-bluesky"></i> Follow on Bluesky
|
||||
</a>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
<a href="https://git.nhcarrigan.com/nhcarrigan/mommy-bot">
|
||||
<i class="fa-solid fa-code"></i> Source Code
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://docs.nhcarrigan.com/">
|
||||
<i class="fa-solid fa-book"></i> Documentation
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://chat.nhcarrigan.com">
|
||||
<i class="fa-solid fa-circle-info"></i> Support
|
||||
</a>
|
||||
</p>
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
<a href="https://git.nhcarrigan.com/nhcarrigan/mommy-bot">
|
||||
<i class="fa-solid fa-code"></i> Source Code
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://docs.nhcarrigan.com/">
|
||||
<i class="fa-solid fa-book"></i> Documentation
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://chat.nhcarrigan.com">
|
||||
<i class="fa-solid fa-circle-info"></i> Support
|
||||
</a>
|
||||
</p>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>`;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user