diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0a8b5539 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:20.04 + +ENV TZ=Asia/Shanghai +RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +COPY ./ /HoshinoBot/ + +RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list && \ + echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y python3.8 python3-pip tzdata + +WORKDIR /HoshinoBot +RUN python3.8 -m pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple + +CMD ["/usr/bin/python3.8", "run.py"] diff --git a/HoshinoBot.yml b/HoshinoBot.yml new file mode 100644 index 00000000..3f7f29e4 --- /dev/null +++ b/HoshinoBot.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + ubuntu: + image: hoshino_local_image:latest + container_name: hoshinobot + volumes: + - ${PWD}/:/HoshinoBot + network_mode: host diff --git a/hoshino/modules/priconne/chara.py b/hoshino/modules/priconne/chara.py index af078a9d..c35dedf3 100644 --- a/hoshino/modules/priconne/chara.py +++ b/hoshino/modules/priconne/chara.py @@ -1,5 +1,6 @@ import asyncio import importlib +import os from io import BytesIO import pygtrie @@ -111,6 +112,12 @@ async def gen_team_pic(team, size=64, star_slot_verbose=True): async def download_chara_icon(id_, star): url = f'https://redive.estertion.win/icon/unit/{id_}{star}1.webp' save_path = R.img(f'priconne/unit/icon_unit_{id_}{star}1.png').path + save_dir = os.path.dirname(save_path) + + if not os.path.exists(save_dir): + logger.info(f'Creating directory {save_dir}') + os.makedirs(save_dir) + logger.info(f'Downloading chara icon from {url}') try: rsp = await aiorequests.get(url, stream=True, timeout=5) diff --git a/requirements.txt b/requirements.txt index 0d25ae2e..f8783ecd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,21 +1,22 @@ -Quart==0.14.1 -MarkupSafe~=1.0 -Jinja2~=2.11.2 -werkzeug~=1.0.1 -wsproto~=0.15.0 +Quart==0.17.0 +MarkupSafe>=2.1.1 +Jinja2>=3.0.0 +werkzeug==2.0.3 +wsproto>=1.0.0 nonebot[scheduler]==1.8.0 -aiocqhttp~=1.4.0 +aiocqhttp~=1.4.4 aiohttp~=3.8.1 lxml>=4.9.1 pytz>=2019.3 +tzdata>=2024.1 requests>=2.23.0 sogou_tr_free~=0.0.8 zhconv~=1.4.1 Pillow~=9.1.0 -matplotlib~=3.2.1 -numpy~=1.22.3 -beautifulsoup4~=4.9.0 -pygtrie~=2.3.3 -tinydb~=4.1.1 +matplotlib>=3.3.0 +numpy>=1.22.3 +beautifulsoup4>=4.9.0 +pygtrie>=2.3.3 +tinydb>=4.1.1 peony-twitter[all]~=2.1.2 cloudscraper~=1.2.60