Add region to bot kwargs #214

Closed
opened 2026-10-05 02:03:57 +02:00 by adam · 4 comments
Owner

Thanks for adding the region decoder to the packet analyzer! It's a great feature 👍

Shouldn't be too difficult to add that info to the kwargs of the bot api, right?

(Be prepared for another feature request when this is implemented: adding the possibility to set the scope for bot outgoing messages..... would make it possible to reply with the same scope of an incoming message so that bot traffic is being scoped to what's necessary......)

Thanks for adding the region decoder to the packet analyzer! It's a great feature 👍 Shouldn't be too difficult to add that info to the kwargs of the bot api, right? (Be prepared for another feature request when this is implemented: adding the possibility to set the scope for bot outgoing messages..... would make it possible to reply with the same scope of an incoming message so that bot traffic is being scoped to what's necessary......) <!-- github-sync-id:4709861138 -->
adam closed this issue 2026-10-05 02:03:57 +02:00
Author
Owner

I've added the receiving region to kwargs and pushed that; will make a mutation to the outbound shape (probably accepting a dict with region) in it sometime next week. Sorry, running low on time this weekend.

I've added the receiving region to kwargs and pushed that; will make a mutation to the outbound shape (probably accepting a dict with region) in it sometime next week. Sorry, running low on time this weekend. <!-- github-comment-id:4815266210 -->
Author
Owner

No worries - I'm very grateful for the time you're sacrificing for this project!!!

Running on latest main now, works great so far!

Only two minor things are missing:

1.) Differentiation between "unknown scope" and "no scope at all"

Currently, region will be None in both cases.....

How about

region == None if there is no scope

region == "" if there is a scope but it could not be decoded?

2.) Region is None always for direct messages but in reality, also direct messages can have a scope: when they are sent as flood direct messages. In such cases, also the packet analyzer will show the scope, for example:

Message bytes: 08ecd1000040e7aa6aa94706d2d9bfa724619d5a2a8ce41d716c

Image
No worries - I'm very grateful for the time you're sacrificing for this project!!! Running on latest `main` now, works great so far! Only two minor things are missing: 1.) Differentiation between "unknown scope" and "no scope at all" Currently, `region` will be `None` in both cases..... How about `region == None` if there is no scope `region == ""` if there is a scope but it could not be decoded? 2.) Region is None always for direct messages but in reality, also direct messages can have a scope: when they are sent as flood direct messages. In such cases, also the packet analyzer will show the scope, for example: Message bytes: `08ecd1000040e7aa6aa94706d2d9bfa724619d5a2a8ce41d716c` <img width="1132" height="395" alt="Image" src="https://github.com/user-attachments/assets/15cb8716-a57b-433b-8d5d-a0c8f9b6c287" /> <!-- github-comment-id:4829407287 -->
Author
Owner

I'm about to merge a fix to support this more cleanly end to end; I've added scoped, a new bool that is true if this is a region-scoped message and false if not. So checks should use scoped to determine if the packet is scoped at all, and region for the decoded region if we have one available.

if not scoped:              # plain flood — no scope at all
elif region is None:        # scoped, but we couldn't decode which region
else:                       # scoped to a 

I'm about to merge a fix to support this more cleanly end to end; I've added `scoped`, a new bool that is true if this is a region-scoped message and false if not. So checks should use `scoped` to determine if the packet is scoped at all, and `region` for the decoded region if we have one available. ```python if not scoped: # plain flood — no scope at all elif region is None: # scoped, but we couldn't decode which region else: # scoped to a ``` <!-- github-comment-id:4920245940 -->
Author
Owner
scoped: True if the message carried a regional flood scope, False for
    plain/unscoped flood. Check this first — it is the meaningful signal.
    Set for scoped DMs too (flood-direct messages can carry a scope).
region: Only meaningful when scoped is True. When scoped is False, region
    is always None and should be ignored. When scoped is True, region is
    the decoded region name, or None if the scope matched none of your
    known_regions (i.e. scoped, but region unrecognized). region is never
    enough on its own to tell "unscoped" from "unrecognized" — use scoped.
``` scoped: True if the message carried a regional flood scope, False for plain/unscoped flood. Check this first — it is the meaningful signal. Set for scoped DMs too (flood-direct messages can carry a scope). region: Only meaningful when scoped is True. When scoped is False, region is always None and should be ignored. When scoped is True, region is the decoded region name, or None if the scope matched none of your known_regions (i.e. scoped, but region unrecognized). region is never enough on its own to tell "unscoped" from "unrecognized" — use scoped. ``` <!-- github-comment-id:4920269824 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Remote-Terminal-for-MeshCore#214