mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-04-26 10:58:04 +00:00
- Updated `config.ini.example` to clarify flood scope configuration, introducing the auto-hashtag format for region names and adding support for multi-scope replies. - Refactored `ChannelManager` to improve handling of empty channels, adjusting timeout logic and increasing request delay to prevent overwhelming devices. - Enhanced `CommandManager` to load flood scope keys for HMAC matching and normalize scope names for consistency. - Implemented scope matching in `MessageHandler` to ensure replies respect configured flood scopes, improving message routing accuracy. - Updated `MeshMessage` model to include a `reply_scope` attribute for tracking matched flood scopes.
29 lines
880 B
Python
29 lines
880 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Data models for the MeshCore Bot
|
|
Contains shared data structures used across modules
|
|
"""
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any, Optional
|
|
|
|
|
|
@dataclass
|
|
class MeshMessage:
|
|
"""Simplified message structure for our bot"""
|
|
content: str
|
|
sender_id: Optional[str] = None
|
|
sender_pubkey: Optional[str] = None
|
|
channel: Optional[str] = None
|
|
hops: Optional[int] = None
|
|
path: Optional[str] = None
|
|
is_dm: bool = False
|
|
timestamp: Optional[int] = None
|
|
snr: Optional[float] = None
|
|
rssi: Optional[int] = None
|
|
elapsed: Optional[str] = None
|
|
# When set from RF routing: path_nodes, path_hex, bytes_per_hop, path_length, route_type, etc.
|
|
routing_info: Optional[dict[str, Any]] = None
|
|
# Matched flood scope for the reply (e.g. "#west"), None means global flood
|
|
reply_scope: Optional[str] = None
|