diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-13 09:03:23 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-13 09:03:23 -0500 |
| commit | 5ba051535138630b333657a6540728a9148c766a (patch) | |
| tree | e36cf812e538714e66fd9cc107b7078b4143210d | |
| parent | 399fcfd8b9536c54e4bf77d2d791ffb88b3a0257 (diff) | |
feat: allow all users in group chats, whitelist only for DMs
| -rw-r--r-- | Omni/Agent/Telegram.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Omni/Agent/Telegram.hs b/Omni/Agent/Telegram.hs index 68527b7..5dcf914 100644 --- a/Omni/Agent/Telegram.hs +++ b/Omni/Agent/Telegram.hs @@ -349,11 +349,14 @@ handleMessage tgConfig provider engineCfg _botUsername msg = do chatId = Types.tmChatId msg usrId = Types.tmUserId msg - unless (Types.isUserAllowed tgConfig usrId) <| do + let isGroup = Types.isGroupChat msg + isAllowed = isGroup || Types.isUserAllowed tgConfig usrId + + unless isAllowed <| do putText <| "Unauthorized user: " <> tshow usrId <> " (" <> userName <> ")" sendMessage tgConfig chatId "sorry, you're not authorized to use this bot." - when (Types.isUserAllowed tgConfig usrId) <| do + when isAllowed <| do sendTypingAction tgConfig chatId user <- Memory.getOrCreateUserByTelegramId usrId userName |
