This view is limited to 50 files because it contains too many changes.  See the raw diff here.
Files changed (50) hide show
  1. .gitattributes +0 -3
  2. .gitignore +0 -2
  3. .pre-commit-config.yaml +18 -18
  4. Dockerfile +16 -20
  5. Dockerfile.memebot +0 -58
  6. README.md +0 -1
  7. docker/config.toml.template +1 -1
  8. docker/start_memebot.sh +0 -7
  9. docs/develop.md +1 -0
  10. docs/docker.md +12 -9
  11. docs/images/bluearchive.jpg +0 -0
  12. docs/images/certificate.png +0 -3
  13. docs/images/clown.png +0 -3
  14. docs/images/clown_instance0.png +0 -3
  15. docs/images/clown_instance1.png +0 -3
  16. docs/images/daynight.jpg +0 -0
  17. docs/images/dog_dislike.gif +0 -3
  18. docs/images/dog_dislike_instance0.gif +0 -3
  19. docs/images/dog_dislike_instance1.gif +0 -3
  20. docs/images/frieren_take.jpg +0 -0
  21. docs/images/lim_x_0.jpg +0 -0
  22. docs/images/listen_music.gif +0 -3
  23. docs/images/little_angel.jpg +0 -0
  24. docs/images/loading.jpg +0 -0
  25. docs/images/look_flat.jpg +0 -0
  26. docs/images/look_this_icon.jpg +0 -0
  27. docs/images/lost_dog.jpg +0 -0
  28. docs/images/love_you.gif +0 -3
  29. docs/images/luoyonghao_say.jpg +0 -0
  30. docs/images/luxun_say.jpg +0 -0
  31. docs/images/maikease.gif +0 -3
  32. docs/images/maimai_awaken.jpg +0 -0
  33. docs/images/maimai_join.jpg +0 -0
  34. docs/images/make_friend.jpg +0 -0
  35. docs/images/marriage.jpg +0 -0
  36. docs/images/meteor.jpg +0 -0
  37. docs/images/mihoyo.png +0 -3
  38. docs/images/mourning.jpg +0 -0
  39. docs/images/mourning_instance0.jpg +0 -0
  40. docs/images/mourning_instance1.jpg +0 -0
  41. docs/images/murmur.jpg +0 -0
  42. docs/images/my_friend.jpg +0 -0
  43. docs/images/my_wife.jpg +0 -0
  44. docs/images/name_generator.jpg +0 -0
  45. docs/images/need.jpg +0 -0
  46. docs/images/nekoha_holdsign.jpg +0 -0
  47. docs/images/nihaosaoa.gif +0 -3
  48. docs/images/nijika_holdsign.jpg +0 -0
  49. docs/images/no_response.jpg +0 -0
  50. 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: "style: auto fix by pre-commit hooks"
3
  autofix_prs: true
4
- autoupdate_branch: main
5
- autoupdate_schedule: quarterly
6
- autoupdate_commit_msg: "chore: auto update by pre-commit hooks"
7
  repos:
8
- - repo: https://github.com/astral-sh/ruff-pre-commit
9
- rev: v0.3.5
10
  hooks:
11
- - id: ruff
12
- args: [--fix, --exit-non-zero-on-fix]
 
 
 
 
 
13
  stages: [commit]
14
- - id: ruff-format
15
 
16
- - repo: https://github.com/pre-commit/mirrors-prettier
17
- rev: v4.0.0-alpha.8
18
  hooks:
19
- - id: prettier
20
- types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
21
  stages: [commit]
22
- exclude: |
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
- RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
 
12
 
13
  FROM python:3.10-slim as app
14
 
15
  WORKDIR /app
16
 
17
- EXPOSE 2233
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 = 2233
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` | `'["/data/memes"]'` | 额外表情路径 |
22
- | `MEME_DISABLED_LIST` | `'[]'` | 禁用表情列表 |
23
- | `GIF_MAX_SIZE` | `10.0` | 限制生成的 gif 文件大小 |
24
- | `GIF_MAX_FRAMES` | `100` | 限制生成的 gif 文件帧数 |
25
- | `BAIDU_TRANS_APPID` | `''` | 百度翻译 appid |
26
- | `BAIDU_TRANS_APIKEY` | `''` | 百度翻译 apikey |
27
- | `LOG_LEVEL` | `'INFO'` | 日志等级 |
 
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

  • SHA256: 2ba077918e7fed9ad1617e82e8b15e25833efe7a9381553fccf0ab24b2b87dec
  • Pointer size: 132 Bytes
  • Size of remote file: 1.83 MB
docs/images/clown.png DELETED

Git LFS Details

  • SHA256: 017a9a7467b61b65c478f0b72e1e0f115f865746af196fb779115b6199d415d4
  • Pointer size: 131 Bytes
  • Size of remote file: 467 kB
docs/images/clown_instance0.png DELETED

Git LFS Details

  • SHA256: 610cd9e872c4c4c78731b4ac493f303ffe2ed6580c3091ffaae50d5528d08ee5
  • Pointer size: 131 Bytes
  • Size of remote file: 477 kB
docs/images/clown_instance1.png DELETED

Git LFS Details

  • SHA256: 8ea0f59962e0d5eaeecfa8eff729b0d65f7d8f8e1f97ca89b34d1d7e2d0fa022
  • Pointer size: 131 Bytes
  • Size of remote file: 506 kB
docs/images/daynight.jpg DELETED
Binary file (33.4 kB)
 
docs/images/dog_dislike.gif DELETED

Git LFS Details

  • SHA256: 6bfa37e78e853a4d2f6418509a40ca5382f48089b72780810f5164540d786f52
  • Pointer size: 132 Bytes
  • Size of remote file: 1.17 MB
docs/images/dog_dislike_instance0.gif DELETED

Git LFS Details

  • SHA256: 251033bc6ed4dcce37943d46e5a02961da0cb69cb3055e307faaa1df56d2756d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.2 MB
docs/images/dog_dislike_instance1.gif DELETED

Git LFS Details

  • SHA256: ab8738f588608466129783ad1618733512cb54fce594b88e2699a0e4eac9bb5d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
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

  • SHA256: a5c9e11105067999e47422feda856c9dd7e5d6817ff1b0264702d06419495d13
  • Pointer size: 131 Bytes
  • Size of remote file: 778 kB
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

  • SHA256: c2a50ea572f11f657fbc34293fa5b293d0fd8ed56e5b168ae391eafdbba5f999
  • Pointer size: 130 Bytes
  • Size of remote file: 15.2 kB
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

  • SHA256: bed930e075b151063738c9ed6915bcba2a746a37b3d2fbb3e4df66babbbdccc7
  • Pointer size: 132 Bytes
  • Size of remote file: 2.99 MB
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

  • SHA256: 9b6e53d99ee6206791821fea74de00f5dd29c1acc60864561fc833bd4d1923eb
  • Pointer size: 131 Bytes
  • Size of remote file: 147 kB
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

  • SHA256: 40a3ba7497a2b7c4ba28d33d114b13102f77dbdb243fc3995a6578c5d5a4c217
  • Pointer size: 132 Bytes
  • Size of remote file: 1.11 MB
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)