mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 19:36:43 +08:00
🐛 修复一些类型错误
This commit is contained in:
parent
ffa180e8a6
commit
77e9fc3b50
@ -52,7 +52,7 @@ def init_fastapi():
|
|||||||
app.mount("/bison", nonebot_app, "nonebot-bison")
|
app.mount("/bison", nonebot_app, "nonebot-bison")
|
||||||
|
|
||||||
driver = get_driver()
|
driver = get_driver()
|
||||||
register_router_fastapi(driver, socket_app)
|
register_router_fastapi(driver, socket_app) # type: ignore
|
||||||
host = str(driver.config.host)
|
host = str(driver.config.host)
|
||||||
port = driver.config.port
|
port = driver.config.port
|
||||||
if host in ["0.0.0.0", "127.0.0.1"]:
|
if host in ["0.0.0.0", "127.0.0.1"]:
|
||||||
|
@ -11,7 +11,7 @@ from .abstract_post import BasePost, AbstractPost
|
|||||||
@dataclass
|
@dataclass
|
||||||
class _CustomPost(BasePost):
|
class _CustomPost(BasePost):
|
||||||
ms_factories: list[MessageSegmentFactory] = field(default_factory=list)
|
ms_factories: list[MessageSegmentFactory] = field(default_factory=list)
|
||||||
css_path: str | None = None # 模板文件所用css路径
|
css_path: str = "" # 模板文件所用css路径
|
||||||
|
|
||||||
async def generate_text_messages(self) -> list[MessageSegmentFactory]:
|
async def generate_text_messages(self) -> list[MessageSegmentFactory]:
|
||||||
return self.ms_factories
|
return self.ms_factories
|
||||||
|
@ -46,7 +46,9 @@ def update_time_feed_1():
|
|||||||
root = ET.fromstring(file)
|
root = ET.fromstring(file)
|
||||||
item = root.find("channel/item")
|
item = root.find("channel/item")
|
||||||
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
||||||
|
assert item is not None
|
||||||
pubdate_elem = item.find("pubDate")
|
pubdate_elem = item.find("pubDate")
|
||||||
|
assert pubdate_elem is not None
|
||||||
pubdate_elem.text = current_time
|
pubdate_elem.text = current_time
|
||||||
return ET.tostring(root, encoding="unicode")
|
return ET.tostring(root, encoding="unicode")
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ def update_time_feed_2():
|
|||||||
root = ET.fromstring(file)
|
root = ET.fromstring(file)
|
||||||
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
||||||
published_element = root.find(".//{*}published")
|
published_element = root.find(".//{*}published")
|
||||||
|
assert published_element is not None
|
||||||
published_element.text = current_time
|
published_element.text = current_time
|
||||||
return ET.tostring(root, encoding="unicode")
|
return ET.tostring(root, encoding="unicode")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user