Skip to content

Commit fb606ca

Browse files
committed
fix: TypeScript type errors in webhook
- Updated Record types to include string[] and boolean - Added type assertion for name field - Build successful with 39 pages generated
1 parent 7182c1f commit fb606ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/api/telegram-webhook/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function POST(request: NextRequest) {
4040

4141
function parseToolFromMessage(text: string) {
4242
const lines = text.split('\n')
43-
const data: Record<string, string> = {}
43+
const data: Record<string, string | string[] | boolean> = {}
4444

4545
lines.forEach(line => {
4646
if (line.includes('*İsim:*')) data.name = line.split('*İsim:*')[1].trim()
@@ -51,7 +51,7 @@ function parseToolFromMessage(text: string) {
5151
})
5252

5353
// Generate ID
54-
data.id = data.name?.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '') || 'tool-' + Date.now()
54+
data.id = (data.name as string)?.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '') || 'tool-' + Date.now()
5555
data.fileName = `${data.id}.${data.language === 'python' ? 'py' : 'bat'}`
5656
data.features = ['Önizleme aracı', 'Topluluk katkısı']
5757
data.code = '# Kod yakında eklenecek'
@@ -61,7 +61,7 @@ function parseToolFromMessage(text: string) {
6161
return data
6262
}
6363

64-
async function addPendingTool(toolData: Record<string, string | boolean>) {
64+
async function addPendingTool(toolData: Record<string, string | string[] | boolean>) {
6565
const filePath = path.join(process.cwd(), 'lib', 'pending-tools.json')
6666
let pendingTools = []
6767

0 commit comments

Comments
 (0)