mirror of
https://github.com/thewesker/twitter_ebooks.git
synced 2025-12-22 13:21:06 -05:00
Fix tweet event handling
This commit is contained in:
@@ -112,16 +112,11 @@ module Ebooks
|
|||||||
next if ev.sender.screen_name == @username # Don't reply to self
|
next if ev.sender.screen_name == @username # Don't reply to self
|
||||||
log "DM from @#{ev.sender.screen_name}: #{ev.text}"
|
log "DM from @#{ev.sender.screen_name}: #{ev.text}"
|
||||||
@on_message.call(ev) if @on_message
|
@on_message.call(ev) if @on_message
|
||||||
end
|
elsif ev.respond_to?(:name) && ev.name == :follow
|
||||||
|
|
||||||
next unless ev.respond_to? :name
|
|
||||||
|
|
||||||
if ev.name == :follow
|
|
||||||
next if ev.source.screen_name == @username
|
next if ev.source.screen_name == @username
|
||||||
log "Followed by #{ev.source.screen_name}"
|
log "Followed by #{ev.source.screen_name}"
|
||||||
@on_follow.call(ev.source) if @on_follow
|
@on_follow.call(ev.source) if @on_follow
|
||||||
end
|
elsif ev.is_a? Twitter::Tweet
|
||||||
|
|
||||||
next unless ev.text # If it's not a text-containing tweet, ignore it
|
next unless ev.text # If it's not a text-containing tweet, ignore it
|
||||||
next if ev.user.screen_name == @username # Ignore our own tweets
|
next if ev.user.screen_name == @username # Ignore our own tweets
|
||||||
|
|
||||||
@@ -157,6 +152,9 @@ module Ebooks
|
|||||||
else
|
else
|
||||||
@on_timeline.call(ev, meta) if @on_timeline
|
@on_timeline.call(ev, meta) if @on_timeline
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
log "Unsure how to handle event: ", ev
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -191,7 +189,6 @@ module Ebooks
|
|||||||
# Reply to a tweet or a DM.
|
# Reply to a tweet or a DM.
|
||||||
# Applies configurable @reply_delay range
|
# Applies configurable @reply_delay range
|
||||||
def reply(ev, text, opts={})
|
def reply(ev, text, opts={})
|
||||||
p "reply???"
|
|
||||||
opts = opts.clone
|
opts = opts.clone
|
||||||
|
|
||||||
if ev.is_a? Twitter::DirectMessage
|
if ev.is_a? Twitter::DirectMessage
|
||||||
|
|||||||
Reference in New Issue
Block a user