Class: VkCozy::Text
- Inherits:
-
BaseFilter
- Object
- BaseFilter
- VkCozy::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, **kwargs) ⇒ Text
constructor
A new instance of Text.
Constructor Details
#initialize(regex, **kwargs) ⇒ Text
Returns a new instance of Text.
51 52 53 54 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 51 def initialize(regex, **kwargs) @regex = regex @raw = kwargs end |
Instance Method Details
#check_bot(event) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 72 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
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vk_cozy/framework/labeler/filters/filters.rb', line 56 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 |