Skip to content

Instantly share code, notes, and snippets.

@gyosit
Last active March 28, 2018 10:40
Show Gist options
  • Save gyosit/55330ccd2deb3698e42c80b9c6f4ad7d to your computer and use it in GitHub Desktop.
Save gyosit/55330ccd2deb3698e42c80b9c6f4ad7d to your computer and use it in GitHub Desktop.
require "twitter"
client_streaming = Twitter::Streaming::Client.new do |config|
config.consumer_key = "<your consumer key>"
config.consumer_secret = "<your consumer secret>"
config.access_token = "<your access token>"
config.access_token_secret = "<your access token asecret>"
end
target = client.user("<@Screen Name>") #@で始まる方の名前
client_streaming.user do |object|
case object
when Twitter::Tweet
if(object.user.name == target.name) then
text = object.text
puts text
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment