Class: Filter::Text
- Inherits:
-
BaseFilter
- Object
- BaseFilter
- Filter::Text
- Defined in:
- lib/vk_cozy/framework/labeler/filters/filters.rb
Instance Method Summary collapse
- #check_bot(event) ⇒ Object
- #check_user(event) ⇒ Object
-
#initialize(regex) ⇒ Text
constructor
A new instance of Text.
Constructor Details
#initialize(regex) ⇒ Text
Returns a new instance of Text.
57 58 59 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 57 def initialize(regex) @regex = regex end |
Instance Method Details
#check_bot(event) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 77 def check_bot(event) if event.type == VkCozy::BotEventType::MESSAGE_NEW if event..text == @regex return true else return false end else return false end end |
#check_user(event) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 61 def check_user(event) if event.type == VkCozy::UserEventType::MESSAGE_NEW if event.from_me return false end if event.text == @regex return true else return false end else return false end end |