mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-10-22 22:11:15 +00:00
fix: BUG-025/026/027/028/029 implementations and ruff/mypy refinements
BUG-025: send_channel_message retry logic on no_event_received BUG-026: split_text_into_chunks and chunked dispatch in message_handler BUG-027: test_weekly_on_wrong_day_does_not_run patch uses fake_now BUG-028: byte_data = b"" initialised before try in decode_meshcore_packet BUG-029: app.py db_path via self._config_base; realtime.html socket race fixed; base.html forceNew removed; ping_timeout 5 to 20s Additional: ruff and mypy refinements across all modules; discord bridge, telegram bridge, rate limiter, and service plugin updates
This commit is contained in:
1 parent
ba83acb064
commit
c9cfcdfe00
66 files changed
+1086
-241
No files matched your search
@@ -37,10 +37,10 @@ class BaseCommand(ABC):
|
||||
examples: list[str] = [] # Example commands, e.g., ["wx 98101", "wx seattle tomorrow"]
|
||||
parameters: list[dict[str, str]] = [] # Parameter definitions, e.g., [{"name": "location", "description": "US zip code or city name"}]
|
||||
|
||||
def __init__(self, bot):
|
||||
def __init__(self, bot: Any) -> None:
|
||||
self.bot = bot
|
||||
self.logger = bot.logger
|
||||
self._last_execution_time = 0
|
||||
self._last_execution_time: float = 0.0
|
||||
|
||||
# Per-user cooldown tracking (for commands that need per-user rate limiting)
|
||||
self._user_cooldowns: dict[str, float] = {}
|
||||
@@ -54,7 +54,7 @@ class BaseCommand(ABC):
|
||||
# Cache command prefix from config
|
||||
self._command_prefix = self._load_command_prefix()
|
||||
|
||||
def translate(self, key: str, **kwargs) -> str:
|
||||
def translate(self, key: str, **kwargs: Any) -> str:
|
||||
"""Translate a key using the bot's translator.
|
||||
|
||||
Args:
|
||||
@@ -585,7 +585,7 @@ class BaseCommand(ABC):
|
||||
# Global cooldown (backward compatibility)
|
||||
self._last_execution_time = current_time
|
||||
|
||||
def _record_execution(self, user_id: Optional[str] = None):
|
||||
def _record_execution(self, user_id: Optional[str] = None) -> None:
|
||||
"""Record the execution time for cooldown tracking (backward compatibility).
|
||||
|
||||
Args:
|
||||
@@ -605,7 +605,7 @@ class BaseCommand(ABC):
|
||||
_, remaining = self.check_cooldown(user_id)
|
||||
return max(0, int(remaining))
|
||||
|
||||
def _load_translated_keywords(self):
|
||||
def _load_translated_keywords(self) -> None:
|
||||
"""Load translated keywords from translation files"""
|
||||
if not hasattr(self.bot, 'translator'):
|
||||
self.logger.debug(f"Translator not available for {self.name}, skipping keyword loading")
|
||||
|
||||
Reference in new issue
Block a user