diff options
| -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 |
