feat(SuggestionBox): ✨ add TN for every ticket
parent
f84d31ed50
commit
8d00fdb20c
|
@ -4,6 +4,9 @@ import { Bot, InputFile, InputMediaBuilder } from 'grammy'
|
||||||
import { Hono } from 'hono'
|
import { Hono } from 'hono'
|
||||||
import { env } from 'hono/adapter'
|
import { env } from 'hono/adapter'
|
||||||
import { handle } from 'hono/cloudflare-pages'
|
import { handle } from 'hono/cloudflare-pages'
|
||||||
|
import { customAlphabet } from 'nanoid'
|
||||||
|
|
||||||
|
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 8)
|
||||||
|
|
||||||
const IP_HEADER = 'CF-Connecting-IP'
|
const IP_HEADER = 'CF-Connecting-IP'
|
||||||
|
|
||||||
|
@ -69,7 +72,7 @@ app.post('/api/v1/suggestion', async (c) => {
|
||||||
return c.json(newErrorFormat400(), 400)
|
return c.json(newErrorFormat400(), 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
const msgs = [`<b>意见箱收到新消息</b>\n`]
|
const msgs = [`<b>意见箱收到新消息</b> #TN-${nanoid()}\n`]
|
||||||
msgs.push(`${replaceHtmlTag(textContent)}\n`)
|
msgs.push(`${replaceHtmlTag(textContent)}\n`)
|
||||||
contactContent
|
contactContent
|
||||||
&& msgs.push(
|
&& msgs.push(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"grammy": "^1.21.1",
|
"grammy": "^1.21.1",
|
||||||
"hono": "^4.0.8",
|
"hono": "^4.0.8",
|
||||||
"nano-id": "^1.1.0"
|
"nanoid": "^5.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cloudflare/workers-types": "^4.20240208.0"
|
"@cloudflare/workers-types": "^4.20240208.0"
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"module": "ESNext",
|
"jsx": "preserve",
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"strict": true,
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
"types": [
|
"types": [
|
||||||
"@cloudflare/workers-types"
|
"@cloudflare/workers-types"
|
||||||
],
|
],
|
||||||
"jsx": "preserve",
|
"strict": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"skipLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,9 @@ importers:
|
||||||
hono:
|
hono:
|
||||||
specifier: ^4.0.8
|
specifier: ^4.0.8
|
||||||
version: 4.6.13
|
version: 4.6.13
|
||||||
nano-id:
|
nanoid:
|
||||||
specifier: ^1.1.0
|
specifier: ^5.1.0
|
||||||
version: 1.1.0
|
version: 5.1.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@cloudflare/workers-types':
|
'@cloudflare/workers-types':
|
||||||
specifier: ^4.20240208.0
|
specifier: ^4.20240208.0
|
||||||
|
@ -2639,14 +2639,16 @@ packages:
|
||||||
ms@2.1.3:
|
ms@2.1.3:
|
||||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||||
|
|
||||||
nano-id@1.1.0:
|
|
||||||
resolution: {integrity: sha512-vQB87xWh4CCBZq2d7/wF46uiwZOx+n6ShQ4QBuiejQhBSijkTeK6Ugv1EhgjVAg8fwIu9wtWk3GhCN4ViD0TJQ==}
|
|
||||||
|
|
||||||
nanoid@3.3.8:
|
nanoid@3.3.8:
|
||||||
resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
|
resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
|
||||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
nanoid@5.1.0:
|
||||||
|
resolution: {integrity: sha512-zDAl/llz8Ue/EblwSYwdxGBYfj46IM1dhjVi8dyp9LQffoIGxJEAHj2oeZ4uNcgycSRcQ83CnfcZqEJzVDLcDw==}
|
||||||
|
engines: {node: ^18 || >=20}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
natural-compare@1.4.0:
|
natural-compare@1.4.0:
|
||||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||||
|
|
||||||
|
@ -6380,10 +6382,10 @@ snapshots:
|
||||||
|
|
||||||
ms@2.1.3: {}
|
ms@2.1.3: {}
|
||||||
|
|
||||||
nano-id@1.1.0: {}
|
|
||||||
|
|
||||||
nanoid@3.3.8: {}
|
nanoid@3.3.8: {}
|
||||||
|
|
||||||
|
nanoid@5.1.0: {}
|
||||||
|
|
||||||
natural-compare@1.4.0: {}
|
natural-compare@1.4.0: {}
|
||||||
|
|
||||||
natural-orderby@5.0.0: {}
|
natural-orderby@5.0.0: {}
|
||||||
|
|
Loading…
Reference in New Issue