feat: relax telegram ACL to chat id (#26)
This commit is contained in:
+1
-1
@@ -162,7 +162,7 @@ See `docs/adding-a-runner.md` for the full guide and a worked example.
|
|||||||
```
|
```
|
||||||
Telegram Update
|
Telegram Update
|
||||||
↓
|
↓
|
||||||
poll_updates() drains backlog, long-polls, filters chat_id == from_id == cfg.chat_id
|
poll_updates() drains backlog, long-polls, filters chat_id == cfg.chat_id
|
||||||
↓
|
↓
|
||||||
run_main_loop() spawns tasks in TaskGroup
|
run_main_loop() spawns tasks in TaskGroup
|
||||||
↓
|
↓
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ if you prefer no notifications, `--no-final-notify` edits the progress message i
|
|||||||
|
|
||||||
## notes
|
## notes
|
||||||
|
|
||||||
* private chat only: the bot only responds to the configured `chat_id`
|
* the bot only responds to the configured `chat_id` (private or group)
|
||||||
* run only one takopi instance per bot token: multiple instances will race telegram's `getUpdates` offsets and cause missed updates
|
* run only one takopi instance per bot token: multiple instances will race telegram's `getUpdates` offsets and cause missed updates
|
||||||
|
|
||||||
## development
|
## development
|
||||||
|
|||||||
@@ -679,7 +679,7 @@ async def poll_updates(cfg: BridgeConfig) -> AsyncIterator[dict[str, Any]]:
|
|||||||
msg = upd["message"]
|
msg = upd["message"]
|
||||||
if "text" not in msg:
|
if "text" not in msg:
|
||||||
continue
|
continue
|
||||||
if not (msg["chat"]["id"] == msg["from"]["id"] == cfg.chat_id):
|
if msg["chat"]["id"] != cfg.chat_id:
|
||||||
continue
|
continue
|
||||||
yield msg
|
yield msg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user