Metadata-Version: 2.1
Name: starbot-bilibili-datasource
Version: 1.2.2
Summary: StarBot 推送配置数据源
Home-page: https://github.com/Starlwr/StarBotDataSource
License: AGPL-3.0-only
Keywords: starbot,bilibili,bot
Author: Starlwr
Author-email: lwr1104@qq.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: pydantic (>=2.0.3,<3.0.0)
Requires-Dist: starbot-executor (>=1.4.0,<2.0.0)
Project-URL: Repository, https://github.com/Starlwr/StarBotDataSource
Description-Content-Type: text/markdown

<div align="center">

# StarBotDataSource

[![PyPI](https://img.shields.io/pypi/v/starbot-bilibili-datasource)](https://pypi.org/project/starbot-bilibili-datasource)
[![Python](https://img.shields.io/badge/python-3.10%20|%203.11-blue)](https://www.python.org)
[![License](https://img.shields.io/github/license/Starlwr/StarBotDataSource)](https://github.com/Starlwr/StarBotDataSource/blob/master/LICENSE)
[![STARS](https://img.shields.io/github/stars/Starlwr/StarBotDataSource?color=yellow&label=Stars)](https://github.com/Starlwr/StarBotDataSource/stargazers)

**StarBot 推送配置数据源**
</div>

## 用途

* 已内置 JSON 数据源(JsonDataSource) 实现
* 可自行实现其他来源的推送配置数据源

## 快速开始
### 安装

```shell
pip install starbot-bilibili-datasource
```

### 开发

通过继承抽象类 DataSource 并实现其中的 load 抽象方法，即可实现其他来源的推送配置数据源

```python
from typing import NoReturn

from loguru import logger
from starbot_datasource import DataSource


class CustomDataSource(DataSource):
    """
    自定义推送配置数据源实现
    """
    async def load(self) -> NoReturn:
        """
        初始化配置
        """
        if self.ups:
            return

        logger.info("已选用 自定义来源 作为 Bot 数据源")
        logger.info("开始从 自定义来源 中初始化 Bot 配置")
        
        # 在此实现初始化逻辑
        pass

        logger.success(f"成功从 自定义来源 中导入了 {len(self.ups)} 个 UP 主")
```

## 相关项目

* [StarBotExecutor](https://github.com/Starlwr/StarBotExecutor): 一个基于订阅发布模式的异步执行器

