Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codecraft26/wheather-bot-server
https://github.com/codecraft26/wheather-bot-server
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/codecraft26/wheather-bot-server
- Owner: codecraft26
- Created: 2024-01-19T16:58:14.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-01-27T18:15:33.000Z (10 months ago)
- Last Synced: 2024-04-13T20:34:15.155Z (7 months ago)
- Language: TypeScript
- Size: 354 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## WeatherBot using NestJS
#### Prerequisites
- Node.js installed
- MongoDB installed
- Telegram Bot token from BotFather
- OpenWeatherMap API key
#### Steps
Clone the Repository
```bashgit clone https://github.com/codecraft26/wheather-bot-server
```
```bash
cd wheather-bot-server
```
#### Install Dependencies```bash
npm install
```
### a
##### Set Environment Variables
Create a .env file in the root directory with the following content:```bash
TELEGRAM_BOT_TOKEN=YOUR_TELEGRAM_BOT_TOKEN
MONGODB_URI=YOUR_MONGODB_URI
OPENWEATHERMAP_API_KEY=YOUR_OPENWEATHERMAP_API_KEY
Replace YOUR_TELEGRAM_BOT_TOKEN, YOUR_MONGODB_URI, and YOUR_OPENWEATHERMAP_API_KEY with your actual values.
```
#### Create Admin User in MongoDB
You can use a MongoDB GUI or shell to insert an admin user manually. Add a document to the users collection:```json
{
"username": "admin",
"password": "adminpassword",
"isAdmin": true
}```
#### Run the Application
```bashnpm start
```
The bot will be accessible at http://localhost:8000.##### Telegram Commands
- /start - Subscribe to daily weather updates.
- /stop - Unsubscribe from daily weather updates.
#### Admin Panel
- Access the admin panel at http://localhost:8000/admin.
- Use Google login to authenticate.
- Update bot settings and manage user accounts.
#### Weather Update
- The bot sends weather updates daily at 9 AM using the OpenWeatherMap API.