bot-himarpl
Konten ini belum tersedia dalam bahasa Anda.
The HIMARPL Telegram Bot named Phoenix Chan is available at @himarpl_bot.
Key Features
- Notification System for Blog Posts
- Command-based Interactions
- Rate Limiting Protection
- Webhook Integration
- Database Integration with NeonDB
- Edge Runtime Support
Core Dependencies
Framework & Runtime
- Next.js 14
- Node.js
- TypeScript
- Edge Runtime
Database & API
- DrizzleORM
- NeonDB
- tRPC
- Zod
Bot Integration
- Telegram Bot API
- node-telegram-bot-api Types
Development Tools
- ESLint
- Prettier
- TypeScript
- Drizzle Kit
Project Structure
/src/bot
- Bot logic and responses/src/server
- API routes and database schema/src/app
- Next.js app router pages/src/trpc
- tRPC configuration/src/lib
- Utility functions
Setup Local Development
This guide will walk you through setting up a local development environment for the HIMARPL Telegram Bot.
Prerequisites
Before installing the application, ensure you have:
- Node.js and npm installed
- Git installed
- A Telegram Bot Token (get from @BotFather) follow the Telegram API guide to obtain
TELEGRAM_BOT_TOKEN
andTELEGRAM_BOT_SECRET
. - NeonDB Database URL (follow the NeonDB guide for
DATABASE_URL
) - Upstash Redis for Rate Limiting (follow the Upstash Ratelimiting guide to obtain
UPSTASH_REDIS_REST_URL
andUPSTASH_REDIS_REST_TOKEN
)
Setup Steps
-
Fork and clone the repository:
-
Navigate to project directory:
-
Create
.env
file with required variables: -
Set up remote upstream:
-
Install dependencies and start development:
-
Create a new branch for your changes:
-
After making changes, commit and push:
-
Create Pull Request
Available Scripts
This repository contains several scripts and commands for various tasks. The most relevant commands are explained below.
Commands for Running & Building Website or Bot
npm run dev
runs the local Next.js development server, listening onhttp://localhost:3000/
.npm run build
builds the application in production mode. The output is located in the.next
folder by default.- This is used for HIMARPL Vercel Deployments (Preview & Production)
npm run start
starts the web server running the built content fromnpm run build
npm run ngrok
creates a local ngrok tunnel so your localhost can be accessed from the internet.npm run tl:set-webhook <URL_NGROK>
changes the Telegram webhook to the ngrok URL.npm run tl:set-command
sets the Telegram bot commands (make sure to write the commands in thesetCommands.js
file as well).
Commands for Maintenance and Testing
npm run db:push
pushes the database schema to NeonDB.npm run db:studio
runs prisma studio for database management.npm run lint
runs the linter for all files.npm run test
runs all tests locally
Support
For questions or issues:
- GitHub Issues
- Contact Departemen Kominfo HIMARPL
- Visit himarpl.com
License
This project is licensed under the MIT License - see the LICENSE file for details.