Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update requirements, fix icon download issus, add amd64_dockerfile an… #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 9 additions & 0 deletions HoshinoBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'

services:
ubuntu:
image: hoshino_local_image:latest
container_name: hoshinobot
volumes:
- ${PWD}/:/HoshinoBot
network_mode: host
7 changes: 7 additions & 0 deletions hoshino/modules/priconne/chara.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import importlib
import os
from io import BytesIO

import pygtrie
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 12 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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