/EEW

Earthquake early warning

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

EEW

Contributors Forks Stargazers Issues License

EEW

English | 繁體中文


A simple, powerful, free, and easily extensible earthquake early warning notification system!


This project uses the API provided by ExpTech. Please adhere to their Terms of Service.

Note: This project is currently in beta.

Installing

Python 3.8 or higher is required

1. Download the Project

First, download the source code of the project. You can obtain the project's source code by:

git clone https://github.com/watermelon1024/EEW.git
cd EEW

2. Use a Virtual Environment (Optional but Strongly Recommended)

Before installing the project, it's recommended to use a virtual environment to isolate the project's dependencies and prevent conflicts with dependencies of other projects.

Using Python's Built-in Virtual Environment Module

python -m venv venv

Using a Third-Party Virtual Environment Management Tool

pip install virtualenv

virtualenv venv

Then, activate the virtual environment:

# Windows
venv\Scripts\activate

# Linux/macOS
source venv/bin/activate

3. Set Up Environment Variables

Edit the .env file according to the format in .env.example and fill in the required environment variables.
For example:

DISCORD_BOT_TOKEN=  # Discord bot token

LINEBOT_ACCESS_TOKEN=  # Line bot access token
LINEBOT_CHANNEL_SECRET=  # Line bot channel secret

4. Edit the Configuration

Edit the config.toml file according to the format in config.toml.example and fill in the required values based on your needs.
For example:

# configuration
debug-mode = false  # debug mode

[discord-bot]
channels = [
    { id = 123456789, mention = "everyone" },  # mention everyone (@everyone)
    { id = 456789123, mention = 6543219870 },  # mention the role with ID `6543219870`
    { id = 987654321 },  # no mention
]

[line-bot]
channels = [
    "abcdefgh...",
    "ijklmnop...",
]  # user or group IDs

[log]
retention = 30  # days of logs to keep
format = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <level>{message}</level>"  # log output format

5. Install Dependencies

Install the required dependencies for the project.

pip install -r requirements.txt

6. Run the Project

After installing the dependencies and setting the environment variables, you can run the project!

python main.py

Custom Notification Client

If you haven't found an existing client that suits your needs, you can create a custom notification client for yourself!
See the development documentation.