Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit ea3274e

Browse files
committed
⬆️ update dependencies
1 parent 1a513c5 commit ea3274e

File tree

7 files changed

+1278
-1560
lines changed

7 files changed

+1278
-1560
lines changed

.gitignore

Lines changed: 150 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,150 @@
1-
/*
2-
!/nonebot_plugin_mcstatus/
3-
__pycache__
4-
!pyproject.toml
5-
!poetry.lock
6-
!README.md
7-
!LICENSE
8-
!.gitignore
1+
# nonebot
2+
data
3+
bot.py
4+
.env
5+
6+
.vscode
7+
8+
# Created by https://www.toptal.com/developers/gitignore/api/python
9+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
10+
11+
### Python ###
12+
# Byte-compiled / optimized / DLL files
13+
__pycache__/
14+
*.py[cod]
15+
*$py.class
16+
17+
# C extensions
18+
*.so
19+
20+
# Distribution / packaging
21+
.Python
22+
build/
23+
develop-eggs/
24+
dist/
25+
downloads/
26+
eggs/
27+
.eggs/
28+
lib/
29+
lib64/
30+
parts/
31+
sdist/
32+
var/
33+
wheels/
34+
pip-wheel-metadata/
35+
share/python-wheels/
36+
*.egg-info/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# PyInstaller
42+
# Usually these files are written by a python script from a template
43+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
44+
*.manifest
45+
*.spec
46+
47+
# Installer logs
48+
pip-log.txt
49+
pip-delete-this-directory.txt
50+
51+
# Unit test / coverage reports
52+
htmlcov/
53+
.tox/
54+
.nox/
55+
.coverage
56+
.coverage.*
57+
.cache
58+
nosetests.xml
59+
coverage.xml
60+
*.cover
61+
*.py,cover
62+
.hypothesis/
63+
.pytest_cache/
64+
pytestdebug.log
65+
66+
# Translations
67+
*.mo
68+
*.pot
69+
70+
# Django stuff:
71+
*.log
72+
local_settings.py
73+
db.sqlite3
74+
db.sqlite3-journal
75+
76+
# Flask stuff:
77+
instance/
78+
.webassets-cache
79+
80+
# Scrapy stuff:
81+
.scrapy
82+
83+
# Sphinx documentation
84+
docs/_build/
85+
doc/_build/
86+
87+
# PyBuilder
88+
target/
89+
90+
# Jupyter Notebook
91+
.ipynb_checkpoints
92+
93+
# IPython
94+
profile_default/
95+
ipython_config.py
96+
97+
# pyenv
98+
.python-version
99+
100+
# pipenv
101+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
102+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
103+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
104+
# install all needed dependencies.
105+
#Pipfile.lock
106+
107+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
108+
.pdm-python
109+
__pypackages__/
110+
111+
# Celery stuff
112+
celerybeat-schedule
113+
celerybeat.pid
114+
115+
# SageMath parsed files
116+
*.sage.py
117+
118+
# Environments
119+
.env
120+
.venv
121+
env/
122+
venv/
123+
ENV/
124+
env.bak/
125+
venv.bak/
126+
127+
# Spyder project settings
128+
.spyderproject
129+
.spyproject
130+
131+
# Rope project settings
132+
.ropeproject
133+
134+
# mkdocs documentation
135+
/site
136+
137+
# mypy
138+
.mypy_cache/
139+
.dmypy.json
140+
dmypy.json
141+
142+
# Pyre type checker
143+
.pyre/
144+
145+
# pytype static type analyzer
146+
.pytype/
147+
148+
# End of https://www.toptal.com/developers/gitignore/api/python
149+
!docker/.env
150+
!docker/bot.py

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.3.0
23+
hooks:
24+
- id: black
25+
stages: [commit]
26+
27+
- repo: https://github.com/nonebot/nonemoji
28+
rev: v0.1.4
29+
hooks:
30+
- id: nonemoji
31+
stages: [prepare-commit-msg]

nonebot_plugin_mcstatus/__init__.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
11
from typing import cast
22

3-
import nonebot
4-
from mcstatus import JavaServer
53
from nonebot import get_bots
4+
from mcstatus import JavaServer
5+
from nonebot.params import ShellCommandArgs
6+
from nonebot.plugin import PluginMetadata, require, on_shell_command
67
from nonebot.adapters.onebot.v11 import (
78
Bot,
8-
GroupMessageEvent,
99
MessageEvent,
10+
GroupMessageEvent,
1011
PrivateMessageEvent,
1112
)
12-
from nonebot.params import ShellCommandArgs
13-
from nonebot.plugin import on_shell_command, require
1413

15-
from nonebot_plugin_mcstatus.data import Data, ServerList
1614
from nonebot_plugin_mcstatus.handle import Handle
15+
from nonebot_plugin_mcstatus.data import Data, ServerList
1716
from nonebot_plugin_mcstatus.parser import ArgNamespace, mc_parser
1817

1918
require("nonebot_plugin_apscheduler")
2019
from nonebot_plugin_apscheduler import scheduler
2120

21+
__plugin_meta__ = PluginMetadata(
22+
name="Minecraft 服务器状态查询",
23+
description="顾名思义",
24+
usage="""mc list 查看当前会话(群/私聊)的关注服务器列表
25+
mc add server address 添加服务器到当前会话(群/私聊)的关注服务器列表
26+
mc remove server 从当前会话(群/私聊)的关注服务器列表移除服务器
27+
mc check address 查看指定地址的服务器状态(一次性)""",
28+
type="application",
29+
homepage="https://github.com/nonepkg/plugin-mcstatus",
30+
supported_adapters={"~onebot.v11"},
31+
)
32+
2233
# 注册 shell_like 事件响应器
2334
mc = on_shell_command("mc", parser=mc_parser, priority=5)
2435

36+
2537
# 每分钟进行一次检测
2638
@scheduler.scheduled_job("cron", minute="*/5", id="mcstatus")
2739
async def _():
2840
data = Data()
2941
server_list = cast(ServerList, data.get_server_list())
30-
bots = nonebot.get_bots()
42+
bots = get_bots()
3143

3244
for type in server_list:
3345
for id in server_list[type]:

nonebot_plugin_mcstatus/data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import Dict, List, Optional, Union, cast
2+
from typing import Dict, List, Union, Optional, cast
33

44
import yaml
55
from pydantic import BaseModel
@@ -25,7 +25,6 @@ def __init__(self, path: Path = Path() / "data" / "mcstatus" / "server_list.yml"
2525
def get_server_list(
2626
self, user_id: Optional[int] = None, group_id: Optional[int] = None
2727
) -> Union[ServerList, List[Server]]:
28-
2928
server_list = self.__server_list
3029

3130
if user_id:
@@ -62,7 +61,6 @@ def remove_server(
6261
user_id: Optional[int] = None,
6362
group_id: Optional[int] = None,
6463
):
65-
6664
server_list = list(
6765
filter(
6866
lambda server: server.name != name,

0 commit comments

Comments
 (0)