Two related issues in `Spond.send_message()` surfaced during the docstring audit in #237.
1. Missing `await`
`spond/spond.py:285`:
```python
if chat_id is not None:
return self._continue_chat(chat_id, text)
```
`_continue_chat()` is declared `async def` (line 225), so this returns an unawaited coroutine object rather than the actual chat-continuation result. The caller would get a `<coroutine object ...>` value plus a `RuntimeWarning: coroutine '_continue_chat' was never awaited` at GC time. Should be:
```python
if chat_id is not None:
return await self._continue_chat(chat_id, text)
```
2. Return type contract violation
The method is annotated `-> JSONDict` but two branches return non-dict values:
- Line 287-289: returns a dict, but the dict has only an `"error"` key rather than raising — callers can't tell success from failure just by checking the result type. Either should raise an exception, or document this sentinel shape in the docstring.
- Line 295: returns `False` when `user_obj` is falsy. In practice unreachable (`get_person()` raises `KeyError` rather than returning falsy), but the return type is wrong (`bool` vs `JSONDict`).
Suggested fix
- Add `await` on the `_continue_chat` call.
- Decide between (a) raising an exception when args are inconsistent, or (b) keeping the sentinel dict but adjusting the annotation and documenting it.
- Remove the unreachable `return False` branch (or make it raise).
Caught during the pdoc audit but not fixed in #237 to keep scope tight.
Two related issues in `Spond.send_message()` surfaced during the docstring audit in #237.
1. Missing `await`
`spond/spond.py:285`:
```python
if chat_id is not None:
return self._continue_chat(chat_id, text)
```
`_continue_chat()` is declared `async def` (line 225), so this returns an unawaited coroutine object rather than the actual chat-continuation result. The caller would get a `<coroutine object ...>` value plus a `RuntimeWarning: coroutine '_continue_chat' was never awaited` at GC time. Should be:
```python
if chat_id is not None:
return await self._continue_chat(chat_id, text)
```
2. Return type contract violation
The method is annotated `-> JSONDict` but two branches return non-dict values:
Suggested fix
Caught during the pdoc audit but not fixed in #237 to keep scope tight.