feat(SuggestionBox): add TN for every ticket
部署到 Cloudflare Pages / deploy (push) Has been cancelled Details
Run markdownlint / lint (push) Has been cancelled Details

pull/537/head
BeiyanYunyi 2025-02-18 22:23:51 +08:00
parent f84d31ed50
commit 8d00fdb20c
No known key found for this signature in database
GPG Key ID: F2A689A496B72B62
4 changed files with 22 additions and 17 deletions

View File

@ -4,6 +4,9 @@ import { Bot, InputFile, InputMediaBuilder } from 'grammy'
import { Hono } from 'hono'
import { env } from 'hono/adapter'
import { handle } from 'hono/cloudflare-pages'
import { customAlphabet } from 'nanoid'
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 8)
const IP_HEADER = 'CF-Connecting-IP'
@ -69,7 +72,7 @@ app.post('/api/v1/suggestion', async (c) => {
return c.json(newErrorFormat400(), 400)
}
const msgs = [`<b>意见箱收到新消息</b>\n`]
const msgs = [`<b>意见箱收到新消息</b> #TN-${nanoid()}\n`]
msgs.push(`${replaceHtmlTag(textContent)}\n`)
contactContent
&& msgs.push(

View File

@ -8,7 +8,7 @@
"dependencies": {
"grammy": "^1.21.1",
"hono": "^4.0.8",
"nano-id": "^1.1.0"
"nanoid": "^5.1.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240208.0"

View File

@ -1,21 +1,21 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"jsx": "preserve",
"lib": [
"ESNext"
],
"module": "ESNext",
"moduleResolution": "Bundler",
"types": [
"@cloudflare/workers-types"
],
"jsx": "preserve",
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true
},
"skipDefaultLibCheck": true,
"skipLibCheck": true
}
}

View File

@ -66,9 +66,9 @@ importers:
hono:
specifier: ^4.0.8
version: 4.6.13
nano-id:
specifier: ^1.1.0
version: 1.1.0
nanoid:
specifier: ^5.1.0
version: 5.1.0
devDependencies:
'@cloudflare/workers-types':
specifier: ^4.20240208.0
@ -2639,14 +2639,16 @@ packages:
ms@2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
nano-id@1.1.0:
resolution: {integrity: sha512-vQB87xWh4CCBZq2d7/wF46uiwZOx+n6ShQ4QBuiejQhBSijkTeK6Ugv1EhgjVAg8fwIu9wtWk3GhCN4ViD0TJQ==}
nanoid@3.3.8:
resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
nanoid@5.1.0:
resolution: {integrity: sha512-zDAl/llz8Ue/EblwSYwdxGBYfj46IM1dhjVi8dyp9LQffoIGxJEAHj2oeZ4uNcgycSRcQ83CnfcZqEJzVDLcDw==}
engines: {node: ^18 || >=20}
hasBin: true
natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
@ -6380,10 +6382,10 @@ snapshots:
ms@2.1.3: {}
nano-id@1.1.0: {}
nanoid@3.3.8: {}
nanoid@5.1.0: {}
natural-compare@1.4.0: {}
natural-orderby@5.0.0: {}