Hi! I have a simple little ping bot and which tries to pretty-print the path by seperating its components with commas:
if path is None or len(path)==0:
path = "direct"
elif len(path)%2 == 0:
path = ",".join([path[2*i:2*i+2] for i in range(len(path)//2)])
return f"Pong @[{sender_name}] path {path}"
But of course, this only works for 1-byte-paths.
But I'm already receiving messages with multi-byte-paths - at least according to the frontend.
=> need a way to detect this within the bot callback.
A simple int argument indicating the number of bytes (1, 2, or 4) would suffice...
Hi! I have a simple little ping bot and which tries to pretty-print the path by seperating its components with commas:
```{python}
if path is None or len(path)==0:
path = "direct"
elif len(path)%2 == 0:
path = ",".join([path[2*i:2*i+2] for i in range(len(path)//2)])
return f"Pong @[{sender_name}] path {path}"
```
But of course, this only works for 1-byte-paths.
But I'm already receiving messages with multi-byte-paths - at least according to the frontend.
<img width="439" height="189" alt="Image" src="https://github.com/user-attachments/assets/f1bc7491-d77c-48f8-8701-970f248bf523" />
=> need a way to detect this within the bot callback.
A simple int argument indicating the number of bytes (1, 2, or 4) would suffice...
<!-- github-sync-id:4065070040 -->
Okay I've added that in 30f6f95, which adds path_bytes_per_hop and also nudges people towards using kwargs for less thrashing in the future on new fields (which will hopefully be minimal).
Let me know if that works for your purposes.
Okay I've added that in 30f6f95, which adds `path_bytes_per_hop` and also nudges people towards using kwargs for less thrashing in the future on new fields (which will hopefully be minimal).
Let me know if that works for your purposes.
<!-- github-comment-id:4048654098 -->
just a minor but breaking issue so far: I cannot save with function header from example:
def bot(**kwargs) -> str | list[str] | None:
frontend will complain about missing positional arguments.
just a minor but breaking issue so far: I cannot save with function header from example:
```
def bot(**kwargs) -> str | list[str] | None:
```
frontend will complain about missing positional arguments.
<!-- github-comment-id:4048760580 -->
...and it kinda works (ping reply being performed properly), but raises runtime errors:
2026-03-12 18:00:59 - app.fanout.bot_exec - ERROR - Bot function execution failed
Traceback (most recent call last):
File "/home/ak/Remote-Terminal-for-MeshCore/app/fanout/bot_exec.py", line 228, in execute_bot_code
result = bot_func(
sender_name,
...<7 lines>...
**keyword_args,
)
File "<string>", line 33, in bot
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
got it partially fixed with this header:
```
def bot(
sender_name: str | None,
sender_key: str | None,
message_text: str,
is_dm: bool,
channel_key: str | None,
channel_name: str | None,
sender_timestamp: int | None,
path: str | None,
is_outgoing: bool = False,
**kwargs) -> str | list[str] | None:
```
...and it kinda works (ping reply being performed properly), but raises runtime errors:
```
2026-03-12 18:00:59 - app.fanout.bot_exec - ERROR - Bot function execution failed
Traceback (most recent call last):
File "/home/ak/Remote-Terminal-for-MeshCore/app/fanout/bot_exec.py", line 228, in execute_bot_code
result = bot_func(
sender_name,
...<7 lines>...
**keyword_args,
)
File "<string>", line 33, in bot
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
```
<!-- github-comment-id:4048846025 -->
Hm, guessing there is some multiplication happening on a None-able value in your bot function. If you paste the full function here I can probably help you spot the bug.
Hm, guessing there is some multiplication happening on a None-able value in your bot function. If you paste the full function here I can probably help you spot the bug.
<!-- github-comment-id:4049105849 -->
yeah, that was 100% correct and also explains why the ping works. it only raises the error on outgoing messages 🙈
thanks for remote-guess-debugging, I got it fixed 👍
yeah, that was 100% correct and also explains why the ping works. it only raises the error on outgoing messages 🙈
thanks for remote-guess-debugging, I got it fixed 👍
<!-- github-comment-id:4049469747 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hi! I have a simple little ping bot and which tries to pretty-print the path by seperating its components with commas:
But of course, this only works for 1-byte-paths.
But I'm already receiving messages with multi-byte-paths - at least according to the frontend.
=> need a way to detect this within the bot callback.
A simple int argument indicating the number of bytes (1, 2, or 4) would suffice...
Okay I've added that in
30f6f95, which addspath_bytes_per_hopand also nudges people towards using kwargs for less thrashing in the future on new fields (which will hopefully be minimal).Let me know if that works for your purposes.
just a minor but breaking issue so far: I cannot save with function header from example:
frontend will complain about missing positional arguments.
Dangit, yes, I have a stash sitting right here I failed to readd 🙃 Sorry about that!!
got it partially fixed with this header:
...and it kinda works (ping reply being performed properly), but raises runtime errors:
Hm, guessing there is some multiplication happening on a None-able value in your bot function. If you paste the full function here I can probably help you spot the bug.
yeah, that was 100% correct and also explains why the ping works. it only raises the error on outgoing messages 🙈
thanks for remote-guess-debugging, I got it fixed 👍