Module: ChatgptAssistant::SearchHelper
- Included in:
- ApplicationBot
- Defined in:
- lib/chatgpt_assistant/bots/helpers/search_helper.rb
Overview
Helper for search
Instance Method Summary collapse
- #find_user(telegram_id: nil, discord_id: nil, email: nil) ⇒ Object
- #find_visitor(telegram_id: nil, discord_id: nil) ⇒ Object
- #where_user(telegram_id: nil, discord_id: nil, email: nil) ⇒ Object
Instance Method Details
#find_user(telegram_id: nil, discord_id: nil, email: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/chatgpt_assistant/bots/helpers/search_helper.rb', line 14 def find_user(telegram_id: nil, discord_id: nil, email: nil) if telegram_id User.find_by(telegram_id: telegram_id) elsif discord_id User.find_by(discord_id: discord_id) elsif email User.find_by(email: email) end end |
#find_visitor(telegram_id: nil, discord_id: nil) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/chatgpt_assistant/bots/helpers/search_helper.rb', line 6 def find_visitor(telegram_id: nil, discord_id: nil) if telegram_id Visitor.find_by(telegram_id: telegram_id) elsif discord_id Visitor.find_by(discord_id: discord_id) end end |
#where_user(telegram_id: nil, discord_id: nil, email: nil) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/chatgpt_assistant/bots/helpers/search_helper.rb', line 24 def where_user(telegram_id: nil, discord_id: nil, email: nil) if telegram_id User.where(telegram_id: telegram_id).to_a elsif discord_id User.where(discord_id: discord_id).to_a elsif email User.where(email: email).to_a end end |