Module: Elephrame::AllInteractions
- Includes:
- Reply
- Included in:
- Bots::Interact, Bots::PeriodInteract
- Defined in:
- lib/elephrame/streaming/interaction.rb
Instance Attribute Summary collapse
-
#on_boost(&block) ⇒ Object
readonly
Sets on_boost to
block
. -
#on_fave(&block) ⇒ Object
readonly
Sets on_fave equal to
block
. -
#on_follow(&block) ⇒ Object
readonly
Sets on_follow to
block
.
Attributes included from Reply
Instance Method Summary collapse
-
#run_interact ⇒ Object
(also: #run)
Starts a loop that checks for any notifications for the authenticated user, running the appropriate stored proc when needed.
Methods included from Reply
#reply, #reply_with_mentions, #run_reply
Instance Attribute Details
#on_boost(&block) ⇒ Object (readonly)
Sets on_boost to block
16 17 18 |
# File 'lib/elephrame/streaming/interaction.rb', line 16 def on_boost @on_boost end |
#on_fave(&block) ⇒ Object (readonly)
Sets on_fave equal to block
9 10 11 |
# File 'lib/elephrame/streaming/interaction.rb', line 9 def on_fave @on_fave end |
#on_follow(&block) ⇒ Object (readonly)
Sets on_follow to block
23 24 25 |
# File 'lib/elephrame/streaming/interaction.rb', line 23 def on_follow @on_follow end |
Instance Method Details
#run_interact ⇒ Object Also known as: run
Starts a loop that checks for any notifications for the authenticated user, running the appropriate stored proc when needed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/elephrame/streaming/interaction.rb', line 31 def run_interact @streamer.user do |update| if update.kind_of? Mastodon::Notification case update.type when 'mention' # this makes it so .content calls strip instead update.status.class.module_eval { alias_method :content, :strip } if @strip_html store_mention_data update.status @on_reply.call(self, update.status) unless @on_reply.nil? when 'reblog' @on_boost.call(self, update) unless @on_boost.nil? when 'favourite' @on_fave.call(self, update) unless @on_fave.nil? when 'follow' @on_follow.call(self, update) unless @on_follow.nil? end end end end |