Client Commands: telegram-panel slash commands with Discord-style parameters

Lists the panel account's client commands as Telegram slash commands (hourly
refresh, cached on the device), shows their parameters while typing, runs
complete commands on the panel instead of sending them and shows the answer
as an "Only visible to you" message (latest 20 kept in memory). Holding send
offers Run / Send as message / Send response in chat (red ! badge); an
answer's menu starts with Send in chat. Other plugins register their own
commands through the client_commands library module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lyuksovannyyandClaude Opus 5.5 committed 2026-10-09 16:19:20 +02:00
1 parent 84bdc44a76
commit 46a1f6ee1f
29 files changed
+3293 -220

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
"""Diagnostics mirrored to a file, since this device's logcat surfaces neither
Chaquopy stdout nor android_utils.log output.
The file lives under `get_files_dir()` (app external storage), so it is
readable over adb:
adb shell cat "/sdcard/Android/data/com.exteragram.messenger/files/exteraGram/exteraGram Files/client_commands/diag.log"
"""
import os
import time
import traceback
_MAX_BYTES = 256 * 1024
_path = None
def _file():
global _path
if _path is None:
try:
from file_utils import get_files_dir
directory = os.path.join(get_files_dir(), "client_commands")
os.makedirs(directory, exist_ok=True)
_path = os.path.join(directory, "diag.log")
except Exception:
_path = ""
return _path
def log(message):
line = time.strftime("%H:%M:%S ") + str(message)
try:
from android_utils import log as android_log
android_log("[client_commands] " + line)
except Exception:
pass
path = _file()
if not path:
return
try:
mode = "a"
if os.path.exists(path) and os.path.getsize(path) > _MAX_BYTES:
mode = "w"
with open(path, mode, encoding="utf-8") as handle:
handle.write(line + "\n")
except Exception:
pass
def error(where, exc=None):
detail = traceback.format_exc() if exc is not None else ""
log(f"ERROR {where}: {exc!r}\n{detail}")