Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Hello committed Aug 15, 2023
0 parents commit 1e4fe23
Show file tree
Hide file tree
Showing 72 changed files with 26,734 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
##################################################
# onebot12的配置项 #
#################################################

# 服务host
host = 127.0.0.1
# 服务端口
port = 8000
# 访问令牌
access_token = ""
# 心跳事件
heartbeat_enabled = false
# 心跳间隔(毫秒)
heartbeat_interval = 5000

# HTTP 通信
# 是否开启http api
enable_http_api = true
# 是否启用 get_latest_events 元动作,启用http api时生效
event_enabled = true
# 事件缓冲区大小,超过该大小将会丢弃最旧的事件,0 表示不限大小
event_buffer_size = 0

# HTTP Webhook
# 是否启用http webhook
enable_http_webhook = false
# webhook 上报地址,启用webhook生效
webhook_url = ["http://127.0.0.1:8080/onebot/v12/http/"]
# 上报请求超时时间,单位:毫秒,0 表示不超时
webhook_timeout = 5000

# websocket连接方式,只能是以下值
# - Unable 不开启websocket连接
# - Forward 正向websocket连接
# - Backward 反向websocket连接
websocekt_type = "Unable"
# 反向 WebSocket 连接地址,使用反向websocket时生效
websocket_url = ["ws://127.0.0.1:8080/onebot/v12/ws/"]
# 反向 WebSocket 重连间隔,单位:毫秒,必须大于 0
reconnect_interval = 5000
# 反向 WebSocket 的缓冲区大小,单位(Mb)
websocket_buffer_size = 4
##################################################
# 项目其他的配置项 #
#################################################

# 日志显示等级
log_level = "INFO"
# 日志保存天数
log_days = 10
# 文件缓存天数,为0则不清理缓存,每天凌晨清理
cache_days = 3
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env linguist-detectable=false
.bat linguist-detectable=false
*.py text eol=lf
21 changes: 21 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Docs

on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

# - name: vuepress-deploy
# uses: jenkey2011/vuepress-deploy@master
# env:
# ACCESS_TOKEN: ${{ secrets.BUILD_DOC }}
# TARGET_BRANCH: docs
# BUILD_SCRIPT: git config --global --add safe.directory "*" && npm ci && npm run docs:build
# BUILD_DIR: docs/.vuepress/dist/
76 changes: 76 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Package client with nuitka

on:
push:
tags:
- 'v*'
branches:
- main

jobs:
build_windows:
runs-on: windows-latest
steps:
- name: 检出
uses: actions/checkout@v3

- name: 获取tag名
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ github.ref }}
regex: 'refs/tags/([\S]+)'

- name: 创建python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'

- name: 安装依赖
run: |
python -m pip install --upgrade pip &&
python -m pip install -r requirements.txt
- name: 构建exe
uses: JustUndertaker/Nuitka-Action@v1.0
with:
nuitka-version: main
script-name: main.py
include-module: wechatbot_client.startup, tortoise.backends.sqlite, apscheduler.triggers.interval, apscheduler.triggers.cron
output-dir: dist

- name: 移动文件
run: |
mv ./dist/main.exe ./ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}.exe &&
mv ./depends/CWeChatRobot.exe ./CWeChatRobot.exe &&
mv ./depends/DWeChatRobot.dll ./DWeChatRobot.dll &&
mv ./depends/install.bat ./install.bat &&
mv ./depends/uninstall.bat ./uninstall.bat
- name: 打包文件
uses: vimtor/action-zip@v1
with:
files: ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}.exe .env CWeChatRobot.exe DWeChatRobot.dll install.bat uninstall.bat
dest: ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}.zip

- name: 发布版本
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ steps.regex-match.outputs.group1 }}
release_name: ${{ steps.regex-match.outputs.group1 }}
body: release of ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 上传文件
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}.zip
asset_name: ComWeChat-Client-${{ steps.regex-match.outputs.group1 }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
DWeChatRobot.dll
logs/
log/
file_cache/
data.json
data/
node_modules/
.temp
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
6 changes: 6 additions & 0 deletions .vscode/settiongs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
8 changes: 8 additions & 0 deletions ComWeChatBotClient.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {},
}
Loading

0 comments on commit 1e4fe23

Please sign in to comment.