Skip to content

Updates and fixes#504

Merged
xditya merged 4 commits into
mainfrom
feature/fixes
Jul 19, 2026
Merged

Updates and fixes#504
xditya merged 4 commits into
mainfrom
feature/fixes

Conversation

@xditya

@xditya xditya commented Jul 19, 2026

Copy link
Copy Markdown
Member

No description provided.

xditya and others added 3 commits July 19, 2026 10:32
…ests

Bug fixes:
- pyUltroid/__main__.py: replace undefined cleanup_cache() with udB.re_cache()
- pyUltroid/configs.py: add missing TGDB_URL config var
- pyUltroid/startup/funcs.py: fix update_envs() RepositoryEnv crash on missing .env; fix config.config.get() AttributeError; fix _version_changes() raw bytes/type check
- pyUltroid/startup/loader.py: handle detached HEAD (Docker/Heroku) for git branch detection
- pyUltroid/startup/_database.py: fix LocalDB.keys() returning empty after re_cache()
- pyUltroid/_misc/_decorators.py: guard LOG_CHANNEL None in FloodWait/error handlers; fix unquoted HTML href
- pyUltroid/_misc/_assistant.py: fix mutable default argument from_users=[] in callback()
- pyUltroid/fns/helper.py: add missing KEEP_SAFE class; fix aiohttp ClientTimeout API; fix async_searcher strict content-type; fix inline_mention HTML
- pyUltroid/fns/tools.py: fix get_stored_file logic error (wrong None check, missing int cast)
- plugins/pdftools.py: fix PyPDF2 3.0+ API (PdfFileReader/Writer/Merger removed)
- plugins/snips.py: fix duplicate NewMessage handler added on every addsnip call

New features (from UltroidRequests):
- plugins/admintools.py: add .kickall confirm command (kicks all non-admin members)
- plugins/delayspam.py: new plugin — .delayspam <count> <delay> [text|reply] + .stopspam
- plugins/broadcast.py: add broadcast blacklist (.addblacklist / .remblacklist / .listblacklist); forward and broadcast skip blacklisted chats
- plugins/utilities.py: extend .stats to show username and t.me profile link

Dependency updates:
- requirements.txt: pin minimum versions for telethon, gitpython, aiohttp, requests, python-decouple, and other core packages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDU2uneCc3LjtkxiVU3vgo
- asst.me.username at module load time crashes if asst.me is None (before
  event loop connects); guard with conditional
- PMSETTING gate registered handlers only at startup, so enabling pmpermit
  after boot had no effect; restructure to always register handlers and
  check udB.get_key("PMSETTING") at runtime inside each handler
- approvepm, disapprovepm, startarchive and the core permitpm handler were
  nested inside the old if-block at wrong indentation; they were either
  dead code (inside permitpm after an early return) or local function
  definitions that were never registered as event handlers — fixed by
  dedenting to module level
- Lambda filter accessed e.sender.bot/is_self/verified without None guard;
  deleted accounts / anonymous senders cause AttributeError that silently
  drops the handler — add e.sender is not None check
- event.text is None for media-only messages; "PMSecurity" in None crashes
  with TypeError — normalize to (event.text or "") throughout
- autoappr lambda also accessed e.text.startswith without None guard on
  outgoing media messages — add bool(e.text) guard
- LOG_CHANNEL was a module-level snapshot (None if not set at startup);
  switched to udB.get_key("LOG_CHANNEL") at call time with None guards
- user.username can be None; username line now falls back to str(user.id)
- COUNT_PM / LASTMSG cleanup used bare dict.pop that could KeyError on
  race; replaced with .pop(key, None)
- Add .pmpermit on/off command so users can toggle without needing the
  assistant bot UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDU2uneCc3LjtkxiVU3vgo
fix(assistant): make pytz import optional so /start command still loads

pdftools.py referenced LOGS in a fallback log message before the local
`from . import (...)` block that defines it, crashing plugin load with
NameError whenever PIL was missing.

assistant/start.py imported pytz unconditionally at module level purely
for the TimeZone button callback. When pytz wasn't installed, the whole
module failed to import, silently deregistering the /start handler and
all other callbacks in the file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@xditya xditya self-assigned this Jul 19, 2026
On Windows, importing twikit replaces the global asyncio event loop
policy (see twikit/__init__.py), which orphans the loop the Telethon
clients are already connected to. Every later call that resolves "the
current loop" outside a running context then gets a different loop
object, tripping Telethon's "event loop must not change after
connection" guard on every request after plugin loading (ready(),
JoinChannelRequest, even asst.run_until_disconnected()).

Re-register the original loop right after the twikit import so
existing connections keep working.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@xditya
xditya merged commit edd18d3 into main Jul 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant