Metadata-Version: 2.1
Name: nonebot-plugin-shorturl
Version: 0.3.0
Summary: Generate short url by bot for bypassing censorship
Home-page: https://github.com/StarHeartHunt/nonebot-plugin-shorturl
License: MIT
Keywords: nonebot,nonebot2,shorturl
Author: StarHeartHunt
Author-email: starheart233@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: all
Provides-Extra: diskcache
Provides-Extra: redis
Requires-Dist: diskcache (>=5.6.3,<6.0.0) ; extra == "diskcache" or extra == "all"
Requires-Dist: nonebot2[fastapi] (>=2.0.0,<3.0.0)
Requires-Dist: redis[hiredis] (>=5.0.0,<6.0.0) ; extra == "redis" or extra == "all"
Project-URL: Documentation, https://github.com/StarHeartHunt/nonebot-plugin-shorturl#readme
Project-URL: Repository, https://github.com/StarHeartHunt/nonebot-plugin-shorturl
Description-Content-Type: text/markdown

<!-- markdownlint-disable MD033 MD036 MD041 -->

<p align="center">
  <a href="https://nonebot.dev/">
    <img src="https://nonebot.dev/logo.png" height="100" alt="nonebot">
  </a>
</p>

<div align="center">

# nonebot-plugin-shorturl

_✨ 为 NoneBot 插件提供短链接服务支持 ✨_

</div>

<p align="center">
  <a href="https://github.com/StarHeartHunt/nonebot-plugin-shorturl/master/LICENSE">
    <img src="https://img.shields.io/github/license/StarHeartHunt/nonebot-plugin-shorturl.svg" alt="license">
  </a>
  <a href="https://pypi.python.org/pypi/nonebot-plugin-shorturl">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-shorturl.svg" alt="pypi">
  </a>
  <img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
</p>

## 安装

```bash
pip install nonebot-plugin-shorturl
poetry add nonebot-plugin-shorturl
pdm add nonebot-plugin-shorturl

# 特定后端
pip install nonebot-plugin-shorturl[redis]
pip install nonebot-plugin-shorturl[diskcache]

# 所有后端
pip install nonebot-plugin-shorturl[all]
```

## 使用方式

在 `.env` 文件中添加必填的配置项

## 配置项

### 通用配置项

- `SHORTURL_HOST`（必填）：用于为外部插件构造完整的包含域名的短链接。示例值：`http://localhost:8080`
- `SHORTURL_ENDPOINT`：指定短链接服务的入口点模板。默认值：`/shorturl/{token}`，可以自定义为 `/s/{token}` 等
- `SHORTURL_CACHE_TYPE`：指定短链接服务的后端缓存类型，可选值：`memory` | `diskcache` | `redis`

### 差分配置项

#### Redis

- `SHORTURL_REDIS_HOST`：Redis 后端的地址
- `SHORTURL_REDIS_PORT`：Redis 后端的端口
- `SHORTURL_REDIS_DB`：Redis DB 配置项
- `SHORTURL_REDIS_USERNAME`：Redis 用户名
- `SHORTURL_REDIS_PASSWORD`：Redis 密码

#### Diskcache

- `SHORTURL_DISKCACHE_FOLDER`：Diskcache 文件持久化目录

