Fix tweet event handling
This commit is contained in:
parent
e646e24744
commit
746d218896
1 changed files with 32 additions and 35 deletions
|
@ -112,16 +112,11 @@ module Ebooks
|
|||
next if ev.sender.screen_name == @username # Don't reply to self
|
||||
log "DM from @#{ev.sender.screen_name}: #{ev.text}"
|
||||
@on_message.call(ev) if @on_message
|
||||
end
|
||||
|
||||
next unless ev.respond_to? :name
|
||||
|
||||
if ev.name == :follow
|
||||
elsif ev.respond_to?(:name) && ev.name == :follow
|
||||
next if ev.source.screen_name == @username
|
||||
log "Followed by #{ev.source.screen_name}"
|
||||
@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 if ev.user.screen_name == @username # Ignore our own tweets
|
||||
|
||||
|
@ -157,6 +152,9 @@ module Ebooks
|
|||
else
|
||||
@on_timeline.call(ev, meta) if @on_timeline
|
||||
end
|
||||
else
|
||||
log "Unsure how to handle event: ", ev
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,7 +189,6 @@ module Ebooks
|
|||
# Reply to a tweet or a DM.
|
||||
# Applies configurable @reply_delay range
|
||||
def reply(ev, text, opts={})
|
||||
p "reply???"
|
||||
opts = opts.clone
|
||||
|
||||
if ev.is_a? Twitter::DirectMessage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue