From 34791716ed3737ec9087248c62f740dd7b264759 Mon Sep 17 00:00:00 2001 From: FPSensor Date: Fri, 7 Aug 2026 09:45:31 -0300 Subject: [PATCH 1/2] fix(chatbot): prevent AttributeError when sender is a channel in chatBot_replies Resolved an issue in the chatBot_replies event handler where messages sent by channels caused an AttributeError: 'Channel' object has no attribute 'bot'. Replaced the direct attribute access with getattr() to safely verify the sender's bot status without crashing the event loop. --- chatbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatbot.py b/chatbot.py index ccbe4716..c6f3b8de 100644 --- a/chatbot.py +++ b/chatbot.py @@ -94,7 +94,7 @@ async def chat_bot_fn(event, type_): @ultroid_bot.on(events.NewMessage(incoming=True)) async def chatBot_replies(e): sender = await e.get_sender() - if sender.bot: + if not sender or getattr(sender, 'bot', False): return key = udB.get_key("CHATBOT_USERS") or {} if e.text and key.get(e.chat_id) and sender.id in key[e.chat_id]: From 25066dc84db60cc981f823e82aa56c1e8acec140 Mon Sep 17 00:00:00 2001 From: FPSensor Date: Fri, 7 Aug 2026 09:46:24 -0300 Subject: [PATCH 2/2] fix(chatbot): handle missing args and prevent edit message error in repai Fixed a crash in the repai command when executed without arguments. The previous implementation raised an IndexError and subsequently caused a MessageIdInvalidError by attempting to edit the original message using eod in contexts lacking edit permissions. Replaced the error notification mechanism with a standard reply() to ensure safe execution. --- chatbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatbot.py b/chatbot.py index c6f3b8de..eb373bef 100644 --- a/chatbot.py +++ b/chatbot.py @@ -24,7 +24,7 @@ async def im_lonely_chat_with_me(event): try: message = event.text.split(" ", 1)[1] except IndexError: - return await eod(event, get_string("tban_1"), time=10) + return await event.reply(get_string("tban_1")) reply_ = await get_chatbot_reply(message=message) await event.eor(reply_)