From 2b9afaa260c53973ef4e12ec7cc8da3887f5c703 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Sun, 13 Aug 2023 18:31:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=9C=E6=B9=96=E8=B5=B7=E9=A3=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 160 ++++++++++++++++++ .idea/.gitignore | 3 + .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 10 ++ .idea/modules.xml | 8 + .idea/riic-recog.iml | 8 + .idea/vcs.xml | 6 + apps/__init__.py | 0 apps/riic_report_analysis.py | 7 + apps/wuhu_takeoff.py | 7 + bot.py | 24 +++ 11 files changed, 239 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/riic-recog.iml create mode 100644 .idea/vcs.xml create mode 100644 apps/__init__.py create mode 100644 apps/riic_report_analysis.py create mode 100644 apps/wuhu_takeoff.py create mode 100644 bot.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b069eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# 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/ +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/ +cover/ + +# 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 +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +.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 + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.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/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..2b2cfa0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..cb847e9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/riic-recog.iml b/.idea/riic-recog.iml new file mode 100644 index 0000000..fece6b2 --- /dev/null +++ b/.idea/riic-recog.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/__init__.py b/apps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/riic_report_analysis.py b/apps/riic_report_analysis.py new file mode 100644 index 0000000..f99ebfb --- /dev/null +++ b/apps/riic_report_analysis.py @@ -0,0 +1,7 @@ +from pepperbot.core.message.chain import MessageChain, Text + + +class RIICReportAnalysis: + async def group_message(self, chain: MessageChain): + if chain.pure_text == "芜湖": + await chain.onebot_reply(Text("起飞")) diff --git a/apps/wuhu_takeoff.py b/apps/wuhu_takeoff.py new file mode 100644 index 0000000..d52b6ba --- /dev/null +++ b/apps/wuhu_takeoff.py @@ -0,0 +1,7 @@ +from pepperbot.core.message.chain import MessageChain, Text + + +class WuHuTakeoff: + async def group_message(self, chain: MessageChain): + if chain.pure_text == "芜湖": + await chain.onebot_reply(Text("起飞")) diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..3baa04a --- /dev/null +++ b/bot.py @@ -0,0 +1,24 @@ +from pepperbot import PepperBot +from pepperbot.store.meta import BotRoute + +from apps.wuhu_takeoff import WuHuTakeoff + + +bot = PepperBot(port=5800) +bot.register_adapter( + bot_protocol="onebot", + receive_protocol="websocket", + backend_protocol="http", + backend_host="127.0.0.1", + backend_port=5700, +) + +bot.apply_routes( + [ + BotRoute( + groups="*", + friends=None, + handlers=[WuHuTakeoff], + ), + ] +)