Module: ChatgptAssistant::Bots::Telegram::Permissions
- Included in:
- TelegramBot
- Defined in:
- lib/chatgpt_assistant/bots/telegram/permissions.rb
Instance Method Summary collapse
- #audio_allowed? ⇒ Boolean
- #common_allowed? ⇒ Boolean
- #hist_allowed? ⇒ Boolean
- #list_allowed? ⇒ Boolean
- #register_allowed?(user_info) ⇒ Boolean
- #select_allowed?(chat) ⇒ Boolean
Instance Method Details
#audio_allowed? ⇒ Boolean
40 41 42 43 44 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 40 def audio_allowed? raise UserNotLoggedInError if user.nil? raise AccountNotVerifiedError unless user.active? raise NoChatSelectedError if user.current_chat.nil? end |
#common_allowed? ⇒ Boolean
30 31 32 33 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 30 def common_allowed? raise UserNotLoggedInError if user.nil? raise AccountNotVerifiedError unless user.active? end |
#hist_allowed? ⇒ Boolean
7 8 9 10 11 12 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 7 def hist_allowed? raise UserNotLoggedInError if user.nil? raise AccountNotVerifiedError unless user.active? raise NoChatSelectedError if user.current_chat.nil? raise NoMessagesFoundedError if user.current_chat..count.zero? end |
#list_allowed? ⇒ Boolean
14 15 16 17 18 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 14 def list_allowed? raise UserNotLoggedInError if user.nil? raise AccountNotVerifiedError unless user.active? raise NoChatsFoundedError if user.chats.count.zero? end |
#register_allowed?(user_info) ⇒ Boolean
20 21 22 23 24 25 26 27 28 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 20 def register_allowed?(user_info) raise NoRegisterInfoError if user_info.nil? raise UserLoggedInError if user email, password = user_info.split(":") raise NoRegisterEmailError if email.nil? || password.nil? [email, password] end |
#select_allowed?(chat) ⇒ Boolean
35 36 37 38 |
# File 'lib/chatgpt_assistant/bots/telegram/permissions.rb', line 35 def select_allowed?(chat) raise ChatNotFoundError if chat.nil? raise ChatNotFoundError unless user.update(current_chat_id: chat.id) end |