uy/sun 90816796c7
🚚 修改 nonebot_bison 项目结构 (#211)
* 🎨 修改 nonebot_bison 目录位置

* auto fix by pre-commit hooks

* 🚚 fix frontend build target

* 🚚 use soft link

* Revert "🚚 use soft link"

This reverts commit de21f79d5ae1bd5515b04f42a4138cb25ddf3e62.

* 🚚 modify dockerfile

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: felinae98 <731499577@qq.com>
2023-03-09 17:32:51 +08:00

55 lines
1.0 KiB
Python

from dataclasses import dataclass
from datetime import time
from typing import Any, Literal, NamedTuple, NewType
from httpx import URL
from pydantic import BaseModel
RawPost = NewType("RawPost", Any)
Target = NewType("Target", str)
Category = int
Tag = str
@dataclass(eq=True, frozen=True)
class User:
user: int
user_type: Literal["group", "private"]
@dataclass(eq=True, frozen=True)
class PlatformTarget:
target: str
platform_name: str
target_name: str
class UserSubInfo(NamedTuple):
user: User
categories: list[Category]
tags: list[Tag]
class TimeWeightConfig(BaseModel):
start_time: time
end_time: time
weight: int
class WeightConfig(BaseModel):
default: int
time_config: list[TimeWeightConfig]
class PlatformWeightConfigResp(BaseModel):
target: Target
target_name: str
platform_name: str
weight: WeightConfig
class ApiError(Exception):
def __init__(self, url: URL) -> None:
msg = f"api {url} error"
super().__init__(msg)