Spaces:
Sleeping
Sleeping
123
#1
by
LeafLeafLeaf
- opened
This view is limited to 50 files because it contains too many changes.
See the raw diff here.
- .gitattributes +0 -3
- .gitignore +0 -2
- .pre-commit-config.yaml +18 -18
- Dockerfile +16 -20
- Dockerfile.memebot +0 -58
- README.md +0 -1
- docker/config.toml.template +1 -1
- docker/start_memebot.sh +0 -7
- docs/develop.md +1 -0
- docs/docker.md +12 -9
- docs/images/bluearchive.jpg +0 -0
- docs/images/certificate.png +0 -3
- docs/images/clown.png +0 -3
- docs/images/clown_instance0.png +0 -3
- docs/images/clown_instance1.png +0 -3
- docs/images/daynight.jpg +0 -0
- docs/images/dog_dislike.gif +0 -3
- docs/images/dog_dislike_instance0.gif +0 -3
- docs/images/dog_dislike_instance1.gif +0 -3
- docs/images/frieren_take.jpg +0 -0
- docs/images/lim_x_0.jpg +0 -0
- docs/images/listen_music.gif +0 -3
- docs/images/little_angel.jpg +0 -0
- docs/images/loading.jpg +0 -0
- docs/images/look_flat.jpg +0 -0
- docs/images/look_this_icon.jpg +0 -0
- docs/images/lost_dog.jpg +0 -0
- docs/images/love_you.gif +0 -3
- docs/images/luoyonghao_say.jpg +0 -0
- docs/images/luxun_say.jpg +0 -0
- docs/images/maikease.gif +0 -3
- docs/images/maimai_awaken.jpg +0 -0
- docs/images/maimai_join.jpg +0 -0
- docs/images/make_friend.jpg +0 -0
- docs/images/marriage.jpg +0 -0
- docs/images/meteor.jpg +0 -0
- docs/images/mihoyo.png +0 -3
- docs/images/mourning.jpg +0 -0
- docs/images/mourning_instance0.jpg +0 -0
- docs/images/mourning_instance1.jpg +0 -0
- docs/images/murmur.jpg +0 -0
- docs/images/my_friend.jpg +0 -0
- docs/images/my_wife.jpg +0 -0
- docs/images/name_generator.jpg +0 -0
- docs/images/need.jpg +0 -0
- docs/images/nekoha_holdsign.jpg +0 -0
- docs/images/nihaosaoa.gif +0 -3
- docs/images/nijika_holdsign.jpg +0 -0
- docs/images/no_response.jpg +0 -0
- docs/images/nokia.jpg +0 -0
.gitattributes
CHANGED
@@ -57,6 +57,3 @@ resources/fonts/HiraginoMin-W5-90-RKSJ-H-2.ttc filter=lfs diff=lfs merge=lfs -te
|
|
57 |
resources/fonts/NotoSansSC-Regular.otf filter=lfs diff=lfs merge=lfs -text
|
58 |
resources/fonts/NotoSerifSC-Regular.otf filter=lfs diff=lfs merge=lfs -text
|
59 |
*.png filter=lfs diff=lfs merge=lfs -text
|
60 |
-
*.gif filter=lfs diff=lfs merge=lfs -text
|
61 |
-
*.otf filter=lfs diff=lfs merge=lfs -text
|
62 |
-
*.ttf filter=lfs diff=lfs merge=lfs -text
|
|
|
57 |
resources/fonts/NotoSansSC-Regular.otf filter=lfs diff=lfs merge=lfs -text
|
58 |
resources/fonts/NotoSerifSC-Regular.otf filter=lfs diff=lfs merge=lfs -text
|
59 |
*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
.gitignore
CHANGED
@@ -4,8 +4,6 @@ dist/
|
|
4 |
.idea/
|
5 |
venv/
|
6 |
.venv/
|
7 |
-
node_modules/
|
8 |
-
pdm.lock
|
9 |
|
10 |
result.png
|
11 |
result.jpg
|
|
|
4 |
.idea/
|
5 |
venv/
|
6 |
.venv/
|
|
|
|
|
7 |
|
8 |
result.png
|
9 |
result.jpg
|
.pre-commit-config.yaml
CHANGED
@@ -1,26 +1,26 @@
|
|
|
|
1 |
ci:
|
2 |
-
autofix_commit_msg: "
|
3 |
autofix_prs: true
|
4 |
-
autoupdate_branch:
|
5 |
-
autoupdate_schedule:
|
6 |
-
autoupdate_commit_msg: "
|
7 |
repos:
|
8 |
-
- repo: https://github.com/
|
9 |
-
rev:
|
10 |
hooks:
|
11 |
-
- id:
|
12 |
-
args: [--
|
|
|
|
|
|
|
|
|
|
|
13 |
stages: [commit]
|
14 |
-
- id: ruff-format
|
15 |
|
16 |
-
- repo: https://github.com/
|
17 |
-
rev:
|
18 |
hooks:
|
19 |
-
- id:
|
20 |
-
types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
|
21 |
stages: [commit]
|
22 |
-
|
23 |
-
(?x)^(
|
24 |
-
resources/resource_list.json|
|
25 |
-
docs/memes.md
|
26 |
-
)$
|
|
|
1 |
+
default_install_hook_types: [pre-commit, prepare-commit-msg]
|
2 |
ci:
|
3 |
+
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks"
|
4 |
autofix_prs: true
|
5 |
+
autoupdate_branch: master
|
6 |
+
autoupdate_schedule: monthly
|
7 |
+
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
8 |
repos:
|
9 |
+
- repo: https://github.com/hadialqattan/pycln
|
10 |
+
rev: v2.1.3
|
11 |
hooks:
|
12 |
+
- id: pycln
|
13 |
+
args: [--config, pyproject.toml]
|
14 |
+
|
15 |
+
- repo: https://github.com/pycqa/isort
|
16 |
+
rev: 5.12.0
|
17 |
+
hooks:
|
18 |
+
- id: isort
|
19 |
stages: [commit]
|
|
|
20 |
|
21 |
+
- repo: https://github.com/psf/black
|
22 |
+
rev: 23.1.0
|
23 |
hooks:
|
24 |
+
- id: black
|
|
|
25 |
stages: [commit]
|
26 |
+
|
|
|
|
|
|
|
|
Dockerfile
CHANGED
@@ -2,24 +2,35 @@ FROM python:3.10 as tmp
|
|
2 |
|
3 |
WORKDIR /tmp
|
4 |
|
5 |
-
RUN curl -sSL https://install.python-poetry.org | python -
|
6 |
-
|
7 |
ENV PATH="${PATH}:/root/.local/bin"
|
8 |
|
9 |
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
FROM python:3.10-slim as app
|
14 |
|
15 |
WORKDIR /app
|
16 |
|
17 |
-
EXPOSE
|
18 |
|
19 |
VOLUME /data
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
ENV TZ=Asia/Shanghai \
|
22 |
LC_ALL=zh_CN.UTF-8 \
|
|
|
|
|
23 |
LOAD_BUILTIN_MEMES=true \
|
24 |
MEME_DIRS="[\"/data/memes\"]" \
|
25 |
MEME_DISABLED_LIST="[]" \
|
@@ -29,27 +40,12 @@ ENV TZ=Asia/Shanghai \
|
|
29 |
BAIDU_TRANS_APIKEY="" \
|
30 |
LOG_LEVEL="INFO"
|
31 |
|
32 |
-
COPY --from=tmp /tmp/requirements.txt /app/requirements.txt
|
33 |
-
|
34 |
-
COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/
|
35 |
-
|
36 |
-
RUN apt-get update \
|
37 |
-
&& apt-get install -y --no-install-recommends locales fontconfig fonts-noto-color-emoji gettext \
|
38 |
-
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
|
39 |
-
&& fc-cache -fv \
|
40 |
-
&& apt-get purge -y --auto-remove \
|
41 |
-
&& rm -rf /var/lib/apt/lists/* \
|
42 |
-
&& pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
43 |
-
|
44 |
COPY ./meme_generator /app/meme_generator
|
45 |
|
46 |
-
|
47 |
-
|
48 |
COPY ./docker/config.toml.template /app/config.toml.template
|
49 |
COPY ./docker/start.sh /app/start.sh
|
50 |
RUN mkdir -p /.config
|
51 |
RUN chmod -R 777 /.config
|
52 |
RUN chmod +x /app/start.sh
|
53 |
-
RUN python -m meme_generator.cli
|
54 |
|
55 |
CMD ["/app/start.sh"]
|
|
|
2 |
|
3 |
WORKDIR /tmp
|
4 |
|
|
|
|
|
5 |
ENV PATH="${PATH}:/root/.local/bin"
|
6 |
|
7 |
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
8 |
+
RUN pip install poetry \
|
9 |
+
&& poetry config virtualenvs.in-project true \
|
10 |
+
&& poetry install --only main --no-interaction --no-ansi
|
11 |
|
12 |
FROM python:3.10-slim as app
|
13 |
|
14 |
WORKDIR /app
|
15 |
|
16 |
+
EXPOSE 7860
|
17 |
|
18 |
VOLUME /data
|
19 |
|
20 |
+
COPY --from=tmp /tmp/.venv /app/.venv
|
21 |
+
|
22 |
+
COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/
|
23 |
+
RUN apt-get update \
|
24 |
+
&& apt-get install -y --no-install-recommends locales fontconfig fonts-noto-cjk fonts-noto-color-emoji gettext \
|
25 |
+
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
|
26 |
+
&& fc-cache -fv \
|
27 |
+
&& apt-get purge -y --auto-remove \
|
28 |
+
&& rm -rf /var/lib/apt/lists/*
|
29 |
+
|
30 |
ENV TZ=Asia/Shanghai \
|
31 |
LC_ALL=zh_CN.UTF-8 \
|
32 |
+
PATH="/app/.venv/bin:${PATH}" \
|
33 |
+
VIRTUAL_ENV="/app/.venv" \
|
34 |
LOAD_BUILTIN_MEMES=true \
|
35 |
MEME_DIRS="[\"/data/memes\"]" \
|
36 |
MEME_DISABLED_LIST="[]" \
|
|
|
40 |
BAIDU_TRANS_APIKEY="" \
|
41 |
LOG_LEVEL="INFO"
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
COPY ./meme_generator /app/meme_generator
|
44 |
|
|
|
|
|
45 |
COPY ./docker/config.toml.template /app/config.toml.template
|
46 |
COPY ./docker/start.sh /app/start.sh
|
47 |
RUN mkdir -p /.config
|
48 |
RUN chmod -R 777 /.config
|
49 |
RUN chmod +x /app/start.sh
|
|
|
50 |
|
51 |
CMD ["/app/start.sh"]
|
Dockerfile.memebot
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
FROM python:3.10 as tmp
|
2 |
-
|
3 |
-
WORKDIR /tmp
|
4 |
-
|
5 |
-
RUN curl -sSL https://install.python-poetry.org | python -
|
6 |
-
|
7 |
-
ENV PATH="${PATH}:/root/.local/bin"
|
8 |
-
|
9 |
-
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
10 |
-
|
11 |
-
RUN apt-get update \
|
12 |
-
&& apt-get install -y --no-install-recommends git \
|
13 |
-
&& poetry export -f requirements.txt --output requirements.txt --without-hashes \
|
14 |
-
&& git clone --depth=1 https://github.com/MeetWq/github-meme-bot
|
15 |
-
|
16 |
-
FROM python:3.10-slim as app
|
17 |
-
|
18 |
-
WORKDIR /app
|
19 |
-
|
20 |
-
EXPOSE 2233
|
21 |
-
|
22 |
-
VOLUME /data
|
23 |
-
|
24 |
-
ENV TZ=Asia/Shanghai \
|
25 |
-
LC_ALL=zh_CN.UTF-8 \
|
26 |
-
LOAD_BUILTIN_MEMES=true \
|
27 |
-
MEME_DIRS="[\"/data/memes\"]" \
|
28 |
-
MEME_DISABLED_LIST="[]" \
|
29 |
-
GIF_MAX_SIZE=10.0 \
|
30 |
-
GIF_MAX_FRAMES=100 \
|
31 |
-
BAIDU_TRANS_APPID="" \
|
32 |
-
BAIDU_TRANS_APIKEY="" \
|
33 |
-
LOG_LEVEL="INFO"
|
34 |
-
|
35 |
-
COPY --from=tmp /tmp/requirements.txt /app/requirements.txt
|
36 |
-
COPY --from=tmp /tmp/github-meme-bot/src /app/src
|
37 |
-
COPY --from=tmp /tmp/github-meme-bot/bot.py /app/bot.py
|
38 |
-
COPY --from=tmp /tmp/github-meme-bot/.env /app/.env
|
39 |
-
|
40 |
-
COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/
|
41 |
-
|
42 |
-
RUN apt-get update \
|
43 |
-
&& apt-get install -y --no-install-recommends locales fontconfig fonts-noto-color-emoji gettext \
|
44 |
-
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
|
45 |
-
&& fc-cache -fv \
|
46 |
-
&& apt-get purge -y --auto-remove \
|
47 |
-
&& rm -rf /var/lib/apt/lists/* \
|
48 |
-
&& pip install --no-cache-dir --upgrade -r /app/requirements.txt \
|
49 |
-
&& pip install --no-cache-dir --upgrade nonebot2 nonebot-adapter-github
|
50 |
-
|
51 |
-
COPY ./meme_generator /app/meme_generator
|
52 |
-
|
53 |
-
COPY ./docker/config.toml.template /app/config.toml.template
|
54 |
-
COPY ./docker/start_memebot.sh /app/start_memebot.sh
|
55 |
-
RUN chmod +x /app/start_memebot.sh
|
56 |
-
RUN python -m meme_generator.cli
|
57 |
-
|
58 |
-
CMD ["/app/start_memebot.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
@@ -4,7 +4,6 @@ emoji: 🌖
|
|
4 |
colorFrom: purple
|
5 |
colorTo: indigo
|
6 |
sdk: docker
|
7 |
-
app_port: 2233
|
8 |
pinned: false
|
9 |
---
|
10 |
|
|
|
4 |
colorFrom: purple
|
5 |
colorTo: indigo
|
6 |
sdk: docker
|
|
|
7 |
pinned: false
|
8 |
---
|
9 |
|
docker/config.toml.template
CHANGED
@@ -13,7 +13,7 @@ baidu_trans_apikey = "$BAIDU_TRANS_APIKEY"
|
|
13 |
|
14 |
[server]
|
15 |
host = "0.0.0.0"
|
16 |
-
port =
|
17 |
|
18 |
[log]
|
19 |
log_level = "$LOG_LEVEL"
|
|
|
13 |
|
14 |
[server]
|
15 |
host = "0.0.0.0"
|
16 |
+
port = 7860
|
17 |
|
18 |
[log]
|
19 |
log_level = "$LOG_LEVEL"
|
docker/start_memebot.sh
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
#! /usr/bin/env bash
|
2 |
-
|
3 |
-
mkdir -p ~/.config/meme_generator
|
4 |
-
|
5 |
-
envsubst < /app/config.toml.template > ~/.config/meme_generator/config.toml
|
6 |
-
|
7 |
-
exec python /app/bot.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/develop.md
CHANGED
@@ -72,6 +72,7 @@ add_meme(
|
|
72 |
|
73 |
也可以一个文件中注册多个表情,如:[gif_subtitle](../meme_generator/memes/gif_subtitle/__init__.py)
|
74 |
|
|
|
75 |
## 参数定义
|
76 |
|
77 |
部分表情需要额外的参数。表情参数的类型定义如下:
|
|
|
72 |
|
73 |
也可以一个文件中注册多个表情,如:[gif_subtitle](../meme_generator/memes/gif_subtitle/__init__.py)
|
74 |
|
75 |
+
|
76 |
## 参数定义
|
77 |
|
78 |
部分表情需要额外的参数。表情参数的类型定义如下:
|
docs/docker.md
CHANGED
@@ -14,17 +14,19 @@ docker run -d \
|
|
14 |
|
15 |
运行后可通过 api 方式调用
|
16 |
|
|
|
17 |
### 环境变量
|
18 |
|
19 |
-
| 变量名
|
20 |
-
|
|
21 |
-
| `MEME_DIRS`
|
22 |
-
| `MEME_DISABLED_LIST` | `'[]'`
|
23 |
-
| `GIF_MAX_SIZE`
|
24 |
-
| `GIF_MAX_FRAMES`
|
25 |
-
| `BAIDU_TRANS_APPID`
|
26 |
-
| `BAIDU_TRANS_APIKEY` | `''`
|
27 |
-
| `LOG_LEVEL`
|
|
|
28 |
|
29 |
### 加载额外表情
|
30 |
|
@@ -34,6 +36,7 @@ docker run -d \
|
|
34 |
|
35 |
将额外表情放置于 `<YOUR_DATA_DIR>/memes` 即可
|
36 |
|
|
|
37 |
完整的运行示例:
|
38 |
|
39 |
```shell
|
|
|
14 |
|
15 |
运行后可通过 api 方式调用
|
16 |
|
17 |
+
|
18 |
### 环境变量
|
19 |
|
20 |
+
| 变量名 | 默认值 | 说明 |
|
21 |
+
| --- | --- | --- |
|
22 |
+
| `MEME_DIRS` | `'["/data/memes"]'` | 额外表情路径 |
|
23 |
+
| `MEME_DISABLED_LIST` | `'[]'` | 禁用表情列表 |
|
24 |
+
| `GIF_MAX_SIZE` | `10.0` | 限制生成的 gif 文件大小 |
|
25 |
+
| `GIF_MAX_FRAMES` | `100` | 限制生成的 gif 文件帧数 |
|
26 |
+
| `BAIDU_TRANS_APPID` | `''` | 百度翻译 appid |
|
27 |
+
| `BAIDU_TRANS_APIKEY` | `''` | 百度翻译 apikey |
|
28 |
+
| `LOG_LEVEL` | `'INFO'` | 日志等级 |
|
29 |
+
|
30 |
|
31 |
### 加载额外表情
|
32 |
|
|
|
36 |
|
37 |
将额外表情放置于 `<YOUR_DATA_DIR>/memes` 即可
|
38 |
|
39 |
+
|
40 |
完整的运行示例:
|
41 |
|
42 |
```shell
|
docs/images/bluearchive.jpg
DELETED
Binary file (38.7 kB)
|
|
docs/images/certificate.png
DELETED
Git LFS Details
|
docs/images/clown.png
DELETED
Git LFS Details
|
docs/images/clown_instance0.png
DELETED
Git LFS Details
|
docs/images/clown_instance1.png
DELETED
Git LFS Details
|
docs/images/daynight.jpg
DELETED
Binary file (33.4 kB)
|
|
docs/images/dog_dislike.gif
DELETED
Git LFS Details
|
docs/images/dog_dislike_instance0.gif
DELETED
Git LFS Details
|
docs/images/dog_dislike_instance1.gif
DELETED
Git LFS Details
|
docs/images/frieren_take.jpg
DELETED
Binary file (49.9 kB)
|
|
docs/images/lim_x_0.jpg
DELETED
Binary file (151 kB)
|
|
docs/images/listen_music.gif
DELETED
Git LFS Details
|
docs/images/little_angel.jpg
DELETED
Binary file (47.1 kB)
|
|
docs/images/loading.jpg
DELETED
Binary file (20.8 kB)
|
|
docs/images/look_flat.jpg
DELETED
Binary file (18.2 kB)
|
|
docs/images/look_this_icon.jpg
DELETED
Binary file (92.8 kB)
|
|
docs/images/lost_dog.jpg
DELETED
Binary file (91.8 kB)
|
|
docs/images/love_you.gif
DELETED
Git LFS Details
|
docs/images/luoyonghao_say.jpg
DELETED
Binary file (25.2 kB)
|
|
docs/images/luxun_say.jpg
DELETED
Binary file (34.3 kB)
|
|
docs/images/maikease.gif
DELETED
Git LFS Details
|
docs/images/maimai_awaken.jpg
DELETED
Binary file (46.5 kB)
|
|
docs/images/maimai_join.jpg
DELETED
Binary file (35.1 kB)
|
|
docs/images/make_friend.jpg
DELETED
Binary file (52.6 kB)
|
|
docs/images/marriage.jpg
DELETED
Binary file (77.5 kB)
|
|
docs/images/meteor.jpg
DELETED
Binary file (31 kB)
|
|
docs/images/mihoyo.png
DELETED
Git LFS Details
|
docs/images/mourning.jpg
DELETED
Binary file (185 kB)
|
|
docs/images/mourning_instance0.jpg
DELETED
Binary file (185 kB)
|
|
docs/images/mourning_instance1.jpg
DELETED
Binary file (180 kB)
|
|
docs/images/murmur.jpg
DELETED
Binary file (16.9 kB)
|
|
docs/images/my_friend.jpg
DELETED
Binary file (8.56 kB)
|
|
docs/images/my_wife.jpg
DELETED
Binary file (66.2 kB)
|
|
docs/images/name_generator.jpg
DELETED
Binary file (56.9 kB)
|
|
docs/images/need.jpg
DELETED
Binary file (33 kB)
|
|
docs/images/nekoha_holdsign.jpg
DELETED
Binary file (89.7 kB)
|
|
docs/images/nihaosaoa.gif
DELETED
Git LFS Details
|
docs/images/nijika_holdsign.jpg
DELETED
Binary file (26.9 kB)
|
|
docs/images/no_response.jpg
DELETED
Binary file (90 kB)
|
|
docs/images/nokia.jpg
DELETED
Binary file (144 kB)
|
|