matrix-python 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {matrix_python-1.0.1/matrix_python.egg-info → matrix_python-1.0.2}/PKG-INFO +9 -9
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/_version.py +3 -3
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/bot.py +6 -4
- {matrix_python-1.0.1 → matrix_python-1.0.2/matrix_python.egg-info}/PKG-INFO +9 -9
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix_python.egg-info/requires.txt +8 -8
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix_python.egg-info/scm_file_list.json +98 -98
- matrix_python-1.0.2/matrix_python.egg-info/scm_version.json +8 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/pyproject.toml +8 -8
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_bot.py +42 -1
- matrix_python-1.0.1/matrix_python.egg-info/scm_version.json +0 -8
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/ISSUE_TEMPLATE/feature--good-first.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/dependabot.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/pull_request_template.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/CODEOWNERS +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/codeql.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/docs.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/publish.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/scorecard.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.github/workflows/tests.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.gitignore +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/.pre-commit-config.yaml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/CODE_OF_CONDUCT.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/CONTRIBUTING.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/LICENSE +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/README.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/checks.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/cooldown.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/error-handling.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/extension.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/index.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/ping.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/reaction.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/examples/scheduler.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/bigger-bot.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/checks.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/commands.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/component.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/configuration.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/error-handling.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/events.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/groups.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/index.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/guides/introduction.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/img/favicon.svg +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/img/matrixpy-black.svg +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/img/matrixpy-white.svg +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/index.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/bot.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/checks.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/command.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/component.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/config.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/content.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/context.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/errors.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/extension.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/group.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/message.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/protocols.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/registry.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/room.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/scheduler.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/space.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/reference/types.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/docs/stylesheets/extra.css +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/docs/mkdocs.yml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/README.md +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/checks.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/config.yaml +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/cooldown.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/error_handling.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/extension.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/member.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/ping.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/reaction.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/scheduler.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/examples/table.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/__init__.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/_error_handler.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/api.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/checks.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/command.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/component.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/config.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/content.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/context.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/errors.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/extension.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/group.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/help/__init__.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/help/help_command.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/help/pagination.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/member.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/message.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/protocols.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/py.typed +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/registry.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/room.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/scheduler.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/space.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix/types.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix_python.egg-info/SOURCES.txt +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix_python.egg-info/dependency_links.txt +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/matrix_python.egg-info/top_level.txt +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/mypy.ini +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/setup.cfg +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/help/test_default_help_command.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/help/test_help_command.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/help/test_pagination.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_api.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_checks.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_command.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_component.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_config.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_context.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_error_handler.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_extension.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_group.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_member.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_message.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_registry.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_room.py +0 -0
- {matrix_python-1.0.1 → matrix_python-1.0.2}/tests/test_space.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: matrix-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: An easy-to-use Matrix bot framework designed for quick development and minimal setup
|
|
5
5
|
Author: Simon Roy, Chris Dedman Rollet
|
|
6
6
|
Maintainer-email: Code Society Lab <admin@codesociety.xyz>
|
|
@@ -34,18 +34,18 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
Requires-Dist: matrix-nio==0.26.0
|
|
35
35
|
Requires-Dist: logger
|
|
36
36
|
Requires-Dist: PyYAML==6.0.3
|
|
37
|
-
Requires-Dist: markdown==3.10.
|
|
37
|
+
Requires-Dist: markdown==3.10.3
|
|
38
38
|
Requires-Dist: APScheduler==3.11.3
|
|
39
39
|
Requires-Dist: envyaml==1.10.211231
|
|
40
40
|
Provides-Extra: dev
|
|
41
|
-
Requires-Dist: pytest==9.
|
|
41
|
+
Requires-Dist: pytest==9.2.0; extra == "dev"
|
|
42
42
|
Requires-Dist: pytest-cov==7.1.0; extra == "dev"
|
|
43
|
-
Requires-Dist: pytest-asyncio==1.4.
|
|
44
|
-
Requires-Dist: black==26.
|
|
45
|
-
Requires-Dist: mypy==2.1
|
|
46
|
-
Requires-Dist: pre-commit==4.6.
|
|
47
|
-
Requires-Dist: types-PyYAML==6.0.12.
|
|
48
|
-
Requires-Dist: types-Markdown==3.
|
|
43
|
+
Requires-Dist: pytest-asyncio==1.4.1; extra == "dev"
|
|
44
|
+
Requires-Dist: black==26.10.1; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy==2.4.1; extra == "dev"
|
|
46
|
+
Requires-Dist: pre-commit==4.6.2; extra == "dev"
|
|
47
|
+
Requires-Dist: types-PyYAML==6.0.12.20260906; extra == "dev"
|
|
48
|
+
Requires-Dist: types-Markdown==3.11.2.20261029; extra == "dev"
|
|
49
49
|
Provides-Extra: doc
|
|
50
50
|
Requires-Dist: mkdocs==1.6.1; extra == "doc"
|
|
51
51
|
Requires-Dist: mkdocs-material==9.7.7; extra == "doc"
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 0,
|
|
21
|
+
__version__ = version = '1.0.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 0, 2)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g451ecb6e4'
|
|
@@ -5,7 +5,7 @@ import logging
|
|
|
5
5
|
|
|
6
6
|
from typing import Optional, Any
|
|
7
7
|
|
|
8
|
-
from nio import AsyncClient, Event, MatrixRoom
|
|
8
|
+
from nio import AsyncClient, Event, MatrixRoom, SyncResponse
|
|
9
9
|
|
|
10
10
|
from .room import Room, make_room
|
|
11
11
|
from .space import Space
|
|
@@ -297,6 +297,7 @@ class Bot(Registry):
|
|
|
297
297
|
self.register_command(self.help)
|
|
298
298
|
|
|
299
299
|
self.client.add_event_callback(self._on_matrix_event, Event)
|
|
300
|
+
self.client.add_response_callback(self._on_sync, SyncResponse)
|
|
300
301
|
self._auto_register_events()
|
|
301
302
|
|
|
302
303
|
def start(self, *, config: Config | str) -> None:
|
|
@@ -351,15 +352,16 @@ class Bot(Registry):
|
|
|
351
352
|
async def _wait_until_synced(self) -> None:
|
|
352
353
|
await self._synced.wait()
|
|
353
354
|
|
|
355
|
+
async def _on_sync(self, _response: SyncResponse) -> None:
|
|
356
|
+
"""Mark the bot as synced once a sync with the homeserver completes."""
|
|
357
|
+
self._synced.set()
|
|
358
|
+
|
|
354
359
|
# MATRIX EVENTS
|
|
355
360
|
|
|
356
361
|
async def on_message(self, room: Room, event: Event) -> None:
|
|
357
362
|
await self._process_commands(room, event)
|
|
358
363
|
|
|
359
364
|
async def _on_matrix_event(self, matrix_room: MatrixRoom, event: Event) -> None:
|
|
360
|
-
if not self._synced.is_set():
|
|
361
|
-
self._synced.set()
|
|
362
|
-
|
|
363
365
|
# ignore bot events
|
|
364
366
|
if event.sender == self.client.user:
|
|
365
367
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: matrix-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: An easy-to-use Matrix bot framework designed for quick development and minimal setup
|
|
5
5
|
Author: Simon Roy, Chris Dedman Rollet
|
|
6
6
|
Maintainer-email: Code Society Lab <admin@codesociety.xyz>
|
|
@@ -34,18 +34,18 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
Requires-Dist: matrix-nio==0.26.0
|
|
35
35
|
Requires-Dist: logger
|
|
36
36
|
Requires-Dist: PyYAML==6.0.3
|
|
37
|
-
Requires-Dist: markdown==3.10.
|
|
37
|
+
Requires-Dist: markdown==3.10.3
|
|
38
38
|
Requires-Dist: APScheduler==3.11.3
|
|
39
39
|
Requires-Dist: envyaml==1.10.211231
|
|
40
40
|
Provides-Extra: dev
|
|
41
|
-
Requires-Dist: pytest==9.
|
|
41
|
+
Requires-Dist: pytest==9.2.0; extra == "dev"
|
|
42
42
|
Requires-Dist: pytest-cov==7.1.0; extra == "dev"
|
|
43
|
-
Requires-Dist: pytest-asyncio==1.4.
|
|
44
|
-
Requires-Dist: black==26.
|
|
45
|
-
Requires-Dist: mypy==2.1
|
|
46
|
-
Requires-Dist: pre-commit==4.6.
|
|
47
|
-
Requires-Dist: types-PyYAML==6.0.12.
|
|
48
|
-
Requires-Dist: types-Markdown==3.
|
|
43
|
+
Requires-Dist: pytest-asyncio==1.4.1; extra == "dev"
|
|
44
|
+
Requires-Dist: black==26.10.1; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy==2.4.1; extra == "dev"
|
|
46
|
+
Requires-Dist: pre-commit==4.6.2; extra == "dev"
|
|
47
|
+
Requires-Dist: types-PyYAML==6.0.12.20260906; extra == "dev"
|
|
48
|
+
Requires-Dist: types-Markdown==3.11.2.20261029; extra == "dev"
|
|
49
49
|
Provides-Extra: doc
|
|
50
50
|
Requires-Dist: mkdocs==1.6.1; extra == "doc"
|
|
51
51
|
Requires-Dist: mkdocs-material==9.7.7; extra == "doc"
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
matrix-nio==0.26.0
|
|
2
2
|
logger
|
|
3
3
|
PyYAML==6.0.3
|
|
4
|
-
markdown==3.10.
|
|
4
|
+
markdown==3.10.3
|
|
5
5
|
APScheduler==3.11.3
|
|
6
6
|
envyaml==1.10.211231
|
|
7
7
|
|
|
8
8
|
[dev]
|
|
9
|
-
pytest==9.
|
|
9
|
+
pytest==9.2.0
|
|
10
10
|
pytest-cov==7.1.0
|
|
11
|
-
pytest-asyncio==1.4.
|
|
12
|
-
black==26.
|
|
13
|
-
mypy==2.1
|
|
14
|
-
pre-commit==4.6.
|
|
15
|
-
types-PyYAML==6.0.12.
|
|
16
|
-
types-Markdown==3.
|
|
11
|
+
pytest-asyncio==1.4.1
|
|
12
|
+
black==26.10.1
|
|
13
|
+
mypy==2.4.1
|
|
14
|
+
pre-commit==4.6.2
|
|
15
|
+
types-PyYAML==6.0.12.20260906
|
|
16
|
+
types-Markdown==3.11.2.20261029
|
|
17
17
|
|
|
18
18
|
[doc]
|
|
19
19
|
mkdocs==1.6.1
|
|
@@ -1,118 +1,118 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [
|
|
3
|
-
".pre-commit-config.yaml",
|
|
4
|
-
"CONTRIBUTING.md",
|
|
5
|
-
"pyproject.toml",
|
|
6
|
-
"CODE_OF_CONDUCT.md",
|
|
7
|
-
"LICENSE",
|
|
8
|
-
"README.md",
|
|
9
|
-
"mypy.ini",
|
|
10
|
-
".gitignore",
|
|
11
|
-
".github/pull_request_template.md",
|
|
12
|
-
".github/dependabot.yml",
|
|
13
3
|
".github/ISSUE_TEMPLATE/bug_report.md",
|
|
14
4
|
".github/ISSUE_TEMPLATE/feature--good-first.md",
|
|
15
5
|
".github/ISSUE_TEMPLATE/feature_request.md",
|
|
16
|
-
".github/
|
|
6
|
+
".github/dependabot.yml",
|
|
7
|
+
".github/pull_request_template.md",
|
|
17
8
|
".github/workflows/CODEOWNERS",
|
|
18
|
-
".github/workflows/scorecard.yml",
|
|
19
9
|
".github/workflows/codeql.yml",
|
|
20
|
-
".github/workflows/publish.yml",
|
|
21
10
|
".github/workflows/docs.yml",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
11
|
+
".github/workflows/publish.yml",
|
|
12
|
+
".github/workflows/scorecard.yml",
|
|
13
|
+
".github/workflows/tests.yml",
|
|
14
|
+
".gitignore",
|
|
15
|
+
".pre-commit-config.yaml",
|
|
16
|
+
"CODE_OF_CONDUCT.md",
|
|
17
|
+
"CONTRIBUTING.md",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"README.md",
|
|
20
|
+
"docs/docs/examples/checks.md",
|
|
21
|
+
"docs/docs/examples/cooldown.md",
|
|
22
|
+
"docs/docs/examples/error-handling.md",
|
|
23
|
+
"docs/docs/examples/extension.md",
|
|
24
|
+
"docs/docs/examples/index.md",
|
|
25
|
+
"docs/docs/examples/ping.md",
|
|
26
|
+
"docs/docs/examples/reaction.md",
|
|
27
|
+
"docs/docs/examples/scheduler.md",
|
|
28
|
+
"docs/docs/guides/bigger-bot.md",
|
|
29
|
+
"docs/docs/guides/checks.md",
|
|
30
|
+
"docs/docs/guides/commands.md",
|
|
31
|
+
"docs/docs/guides/component.md",
|
|
32
|
+
"docs/docs/guides/configuration.md",
|
|
33
|
+
"docs/docs/guides/error-handling.md",
|
|
34
|
+
"docs/docs/guides/events.md",
|
|
35
|
+
"docs/docs/guides/groups.md",
|
|
36
|
+
"docs/docs/guides/index.md",
|
|
37
|
+
"docs/docs/guides/introduction.md",
|
|
38
|
+
"docs/docs/img/favicon.svg",
|
|
39
|
+
"docs/docs/img/matrixpy-black.svg",
|
|
40
|
+
"docs/docs/img/matrixpy-white.svg",
|
|
41
|
+
"docs/docs/index.md",
|
|
42
|
+
"docs/docs/reference/bot.md",
|
|
43
|
+
"docs/docs/reference/checks.md",
|
|
44
|
+
"docs/docs/reference/command.md",
|
|
45
|
+
"docs/docs/reference/component.md",
|
|
46
|
+
"docs/docs/reference/config.md",
|
|
47
|
+
"docs/docs/reference/content.md",
|
|
48
|
+
"docs/docs/reference/context.md",
|
|
49
|
+
"docs/docs/reference/errors.md",
|
|
50
|
+
"docs/docs/reference/extension.md",
|
|
51
|
+
"docs/docs/reference/group.md",
|
|
52
|
+
"docs/docs/reference/message.md",
|
|
53
|
+
"docs/docs/reference/protocols.md",
|
|
54
|
+
"docs/docs/reference/registry.md",
|
|
55
|
+
"docs/docs/reference/room.md",
|
|
56
|
+
"docs/docs/reference/scheduler.md",
|
|
57
|
+
"docs/docs/reference/space.md",
|
|
58
|
+
"docs/docs/reference/types.md",
|
|
59
|
+
"docs/docs/stylesheets/extra.css",
|
|
60
|
+
"docs/mkdocs.yml",
|
|
61
|
+
"examples/README.md",
|
|
25
62
|
"examples/checks.py",
|
|
26
|
-
"examples/cooldown.py",
|
|
27
|
-
"examples/ping.py",
|
|
28
|
-
"examples/table.py",
|
|
29
63
|
"examples/config.yaml",
|
|
64
|
+
"examples/cooldown.py",
|
|
30
65
|
"examples/error_handling.py",
|
|
31
|
-
"examples/
|
|
66
|
+
"examples/extension.py",
|
|
67
|
+
"examples/member.py",
|
|
68
|
+
"examples/ping.py",
|
|
32
69
|
"examples/reaction.py",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"tests/test_component.py",
|
|
36
|
-
"tests/test_registry.py",
|
|
37
|
-
"tests/test_message.py",
|
|
38
|
-
"tests/test_error_handler.py",
|
|
39
|
-
"tests/test_command.py",
|
|
40
|
-
"tests/test_group.py",
|
|
41
|
-
"tests/test_space.py",
|
|
42
|
-
"tests/test_bot.py",
|
|
43
|
-
"tests/test_extension.py",
|
|
44
|
-
"tests/test_api.py",
|
|
45
|
-
"tests/test_checks.py",
|
|
46
|
-
"tests/test_room.py",
|
|
47
|
-
"tests/test_config.py",
|
|
48
|
-
"tests/help/test_help_command.py",
|
|
49
|
-
"tests/help/test_default_help_command.py",
|
|
50
|
-
"tests/help/test_pagination.py",
|
|
51
|
-
"matrix/scheduler.py",
|
|
52
|
-
"matrix/types.py",
|
|
53
|
-
"matrix/group.py",
|
|
54
|
-
"matrix/room.py",
|
|
55
|
-
"matrix/errors.py",
|
|
56
|
-
"matrix/extension.py",
|
|
57
|
-
"matrix/config.py",
|
|
58
|
-
"matrix/_error_handler.py",
|
|
59
|
-
"matrix/member.py",
|
|
60
|
-
"matrix/py.typed",
|
|
70
|
+
"examples/scheduler.py",
|
|
71
|
+
"examples/table.py",
|
|
61
72
|
"matrix/__init__.py",
|
|
62
|
-
"matrix/
|
|
63
|
-
"matrix/checks.py",
|
|
64
|
-
"matrix/message.py",
|
|
65
|
-
"matrix/component.py",
|
|
66
|
-
"matrix/bot.py",
|
|
73
|
+
"matrix/_error_handler.py",
|
|
67
74
|
"matrix/api.py",
|
|
68
|
-
"matrix/
|
|
69
|
-
"matrix/
|
|
75
|
+
"matrix/bot.py",
|
|
76
|
+
"matrix/checks.py",
|
|
70
77
|
"matrix/command.py",
|
|
71
|
-
"matrix/
|
|
78
|
+
"matrix/component.py",
|
|
79
|
+
"matrix/config.py",
|
|
72
80
|
"matrix/content.py",
|
|
73
|
-
"matrix/
|
|
81
|
+
"matrix/context.py",
|
|
82
|
+
"matrix/errors.py",
|
|
83
|
+
"matrix/extension.py",
|
|
84
|
+
"matrix/group.py",
|
|
74
85
|
"matrix/help/__init__.py",
|
|
75
86
|
"matrix/help/help_command.py",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"docs/docs/reference/content.md",
|
|
107
|
-
"docs/docs/guides/bigger-bot.md",
|
|
108
|
-
"docs/docs/guides/groups.md",
|
|
109
|
-
"docs/docs/guides/commands.md",
|
|
110
|
-
"docs/docs/guides/configuration.md",
|
|
111
|
-
"docs/docs/guides/checks.md",
|
|
112
|
-
"docs/docs/guides/component.md",
|
|
113
|
-
"docs/docs/guides/introduction.md",
|
|
114
|
-
"docs/docs/guides/events.md",
|
|
115
|
-
"docs/docs/guides/error-handling.md",
|
|
116
|
-
"docs/docs/guides/index.md"
|
|
87
|
+
"matrix/help/pagination.py",
|
|
88
|
+
"matrix/member.py",
|
|
89
|
+
"matrix/message.py",
|
|
90
|
+
"matrix/protocols.py",
|
|
91
|
+
"matrix/py.typed",
|
|
92
|
+
"matrix/registry.py",
|
|
93
|
+
"matrix/room.py",
|
|
94
|
+
"matrix/scheduler.py",
|
|
95
|
+
"matrix/space.py",
|
|
96
|
+
"matrix/types.py",
|
|
97
|
+
"mypy.ini",
|
|
98
|
+
"pyproject.toml",
|
|
99
|
+
"tests/help/test_default_help_command.py",
|
|
100
|
+
"tests/help/test_help_command.py",
|
|
101
|
+
"tests/help/test_pagination.py",
|
|
102
|
+
"tests/test_api.py",
|
|
103
|
+
"tests/test_bot.py",
|
|
104
|
+
"tests/test_checks.py",
|
|
105
|
+
"tests/test_command.py",
|
|
106
|
+
"tests/test_component.py",
|
|
107
|
+
"tests/test_config.py",
|
|
108
|
+
"tests/test_context.py",
|
|
109
|
+
"tests/test_error_handler.py",
|
|
110
|
+
"tests/test_extension.py",
|
|
111
|
+
"tests/test_group.py",
|
|
112
|
+
"tests/test_member.py",
|
|
113
|
+
"tests/test_message.py",
|
|
114
|
+
"tests/test_registry.py",
|
|
115
|
+
"tests/test_room.py",
|
|
116
|
+
"tests/test_space.py"
|
|
117
117
|
]
|
|
118
118
|
}
|
|
@@ -20,21 +20,21 @@ dependencies = [
|
|
|
20
20
|
"matrix-nio==0.26.0",
|
|
21
21
|
"logger",
|
|
22
22
|
"PyYAML==6.0.3",
|
|
23
|
-
"markdown==3.10.
|
|
23
|
+
"markdown==3.10.3",
|
|
24
24
|
"APScheduler==3.11.3",
|
|
25
25
|
"envyaml==1.10.211231",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
29
29
|
dev = [
|
|
30
|
-
"pytest==9.
|
|
30
|
+
"pytest==9.2.0",
|
|
31
31
|
"pytest-cov==7.1.0",
|
|
32
|
-
"pytest-asyncio==1.4.
|
|
33
|
-
"black==26.
|
|
34
|
-
"mypy==2.1
|
|
35
|
-
"pre-commit==4.6.
|
|
36
|
-
"types-PyYAML==6.0.12.
|
|
37
|
-
"types-Markdown==3.
|
|
32
|
+
"pytest-asyncio==1.4.1",
|
|
33
|
+
"black==26.10.1",
|
|
34
|
+
"mypy==2.4.1",
|
|
35
|
+
"pre-commit==4.6.2",
|
|
36
|
+
"types-PyYAML==6.0.12.20260906",
|
|
37
|
+
"types-Markdown==3.11.2.20261029",
|
|
38
38
|
]
|
|
39
39
|
doc = [
|
|
40
40
|
"mkdocs==1.6.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
3
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
4
|
-
from nio import MatrixRoom, RoomMessageText, LoginError
|
|
4
|
+
from nio import MatrixRoom, RoomMessageText, LoginError, SyncResponse
|
|
5
5
|
|
|
6
6
|
from matrix import Bot, Config, Context, Extension, Room, Space
|
|
7
7
|
from matrix.errors import (
|
|
@@ -720,6 +720,47 @@ def test_start_handles_keyboard_interrupt(caplog):
|
|
|
720
720
|
bot._client.close.assert_awaited_once()
|
|
721
721
|
|
|
722
722
|
|
|
723
|
+
def test_load_config_registers_sync_response_callback():
|
|
724
|
+
bot = Bot()
|
|
725
|
+
bot._load_config(Config(username="grace", password="grace1234"))
|
|
726
|
+
|
|
727
|
+
assert any(
|
|
728
|
+
cb.func == bot._on_sync and cb.filter is SyncResponse
|
|
729
|
+
for cb in bot.client.response_callbacks
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
@pytest.mark.asyncio
|
|
734
|
+
async def test_room_event_does_not_mark_synced(bot, room, event):
|
|
735
|
+
with patch.object(bot, "_dispatch_matrix_event", new_callable=AsyncMock):
|
|
736
|
+
await bot._on_matrix_event(room, event)
|
|
737
|
+
|
|
738
|
+
assert not bot._synced.is_set()
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
@pytest.mark.asyncio
|
|
742
|
+
async def test_run_becomes_ready_after_first_sync_without_room_events(bot_with_token):
|
|
743
|
+
async def sync_forever(**_kwargs):
|
|
744
|
+
# A completed sync with no room events, then the loop keeps going.
|
|
745
|
+
await bot_with_token._on_sync(MagicMock(spec=SyncResponse))
|
|
746
|
+
await asyncio.Event().wait()
|
|
747
|
+
|
|
748
|
+
bot_with_token._client.sync_forever = AsyncMock(side_effect=sync_forever)
|
|
749
|
+
bot_with_token._on_ready = AsyncMock()
|
|
750
|
+
bot_with_token.scheduler.start = MagicMock()
|
|
751
|
+
|
|
752
|
+
task = asyncio.create_task(bot_with_token.run())
|
|
753
|
+
|
|
754
|
+
await asyncio.wait_for(bot_with_token._synced.wait(), timeout=1.0)
|
|
755
|
+
await asyncio.sleep(0)
|
|
756
|
+
|
|
757
|
+
task.cancel()
|
|
758
|
+
await asyncio.gather(task, return_exceptions=True)
|
|
759
|
+
|
|
760
|
+
bot_with_token._on_ready.assert_awaited_once()
|
|
761
|
+
bot_with_token.scheduler.start.assert_called_once()
|
|
762
|
+
|
|
763
|
+
|
|
723
764
|
@pytest.mark.asyncio
|
|
724
765
|
async def test_on_ready_called_only_once(bot):
|
|
725
766
|
# Prepare
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|