This GitHub repository hosts an Express server built with TypeScript that uses the Telegram Bot API to create a chatbot for querying automatically collected pr0game player stats. It handles HTTP requests, processes JSON files, outputs nicely formatted ASCII message.
- TypeScript: Statically typed JS with high strictness level and compile target ESNext.
- Express: A minimalist web framework for Node.js used to build the server-side application.
- Axios: A promise-based HTTP client for making requests to the backend API and handling asynchronous operations.
- Morgan: HTTP request logger middleware for Node.js.
- Node.js: A JavaScript runtime environment used for executing server-side code.
- Telegram Bot API: Used for creating a Telegram chatbot to communicate extracted data from the JSON files to users.
- Nodemon: Hot Reload upon file changes of the server during development, enhancing the development workflow.
- ts-node: Executing TypeScript files directly without the need for compilation, enhancing the development workflow.
- ESLint and Prettier: Linter and Formatter for ensuring code quality and enforcing coding standards.
Dependencies
- Node.js: Ensure that Node.js is installed on your local machine, with a minimum version of 14.x. You can download Node.js from here.
Installation
- Clone the Repository:
git clone https://github.com/your-username/express-pr0game-stats-chatbot.git
- Navigate to the Project Folder:
cd express-pr0game-stats-chatbot
- Install Dependencies:
npm install
-
Configure Environment Variables:
- Create a
.env
file in the root directory. - Define the following variables:
- REST_PW
- TELEGRAM_ADMIN_BOT_TOKEN
- TELEGRAM_ADMIN_USER_CHAT_ID
- TELEGRAM_ADMIN_BOT_USERNAME
- TELEGRAM_CHAT_BOT_TOKEN
- TELEGRAM_CHAT_BOT_USERNAME
- Create a
- Run the Server:
npm run server
-
Telegram Bot:
- Start a conversation with your Telegram bot using the provided username.
- Interact with the bot to receive data extracted from the JSON files.
Once the server is up and running, it will be ready to handle HTTP requests containing .json files and interact with users via Telegram and Discord chatbots.
This project is licensed under the MIT License.