Last active
August 29, 2015 13:55
-
-
Save pnlybubbles/8688769 to your computer and use it in GitHub Desktop.
TwitterBotを簡単につくるためのやつ。TwitterGem必要。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
$VERBOSE = nil # instead of -W0 | |
require_relative "./bot-2.rb" | |
# CONSUMER_KEY = "" | |
# CONSUMER_SECRET = "" | |
# ACCESS_TOKEN = "" | |
# ACCESS_TOKEN_SECRET = "" | |
# app = Bot::Client.new do |config| | |
# config.consumer_key = CONSUMER_KEY | |
# config.consumer_secret = CONSUMER_SECRET | |
# config.access_token = ACCESS_TOKEN | |
# config.access_token_secret = ACCESS_TOKEN_SECRET | |
# end | |
# YAMLファイルからコンシュマーキー、アクセストークンを読み込み | |
@app = Bot::Client.new("./oauth_keys.yaml") | |
@api = @app.api | |
@mydata = @app.mydata | |
@app.new_event(:text) { |res| | |
puts "#{res.user.screen_name}: #{res.text}" | |
} | |
@app.new_event(:text, {:match => /艦これ/}) { |res| | |
@app.say("Match: #{res.user.screen_name}: #{res.text}") | |
} | |
@app.new_event(:reply) { |res| | |
@app.say("Reply: #{res.user.screen_name}: #{res.text}") | |
} | |
@app.new_event(:favorite, {:exclude_user => :me}) { |res| | |
@app.say("Favorite: #{res.source.screen_name}: #{res.target_object.text}") | |
} | |
@app.new_event(:unfavorite, {:exclude_user => :me}) { |res| | |
@app.say("Unfavorite: #{res.source.screen_name}: #{res.target_object.text}") | |
cnt = 0 | |
begin | |
@api.update("@#{res.source.screen_name} あんふぁぼをみた^^" + (" " * rand(3))) | |
rescue Exception => e | |
@app.say("Update Error: #{e}", "e") | |
cnt += 1 | |
retry if cnt <= 2 | |
end | |
} | |
# Update Name "@screen_name update_name oppai" | |
@app.new_event(:reply, {:match => /update_name\s+(?<new_name>[^\s]+)/, :exclude_retweet => true}) { |res, match| | |
new_name = match["new_name"] | |
@app.say("UpdateName: #{res.user.screen_name}: #{new_name}") | |
if new_name.length <= 20 | |
begin | |
@api.update_profile({:name => new_name}) | |
@api.update("@#{res.user.screen_name} さんによって\"#{new_name}\"になりました。", {:in_reply_to_status_id => res.id}) | |
rescue Exception => e | |
@app.say("UpdateName Error: #{e}", "e") | |
end | |
end | |
} | |
@app.run(true, false) | |
=begin | |
#################################### | |
#### 簡易ドキュメント | |
#################################### | |
==== 使い方 ==== | |
gem install twitter | |
# TwitterGemが必要なのでインストールする | |
require_relative "./bot-2.rb" | |
# bot-2.rbを読み込む | |
==== 基本のメソッド ==== | |
.new { |config| | |
# コンシュマーキーとかアクセストークンとかを設定するお馴染みのやつ | |
} | |
.load_keys(ファイルパス) | |
# YAMLファイルで指定されたコンシュマーキーとかアクセストークンとかを設定する | |
.new(ファイルパス) | |
# これでも同様 | |
.run | |
# ボットが動き出す(^Cで止まる) | |
.new_event(:イベントタイプ, オプション) { |res, *argu| | |
# いろいろしたいことする | |
} | |
.api | |
#Twitter REST APIを得る | |
.mydata | |
#自分自身のデータを得る。Twitter::Userオブジェクトが戻り値。 | |
==== イベントタイプ ==== | |
:text | |
# 通常のツイートがきたとき | |
:reply | |
# 自分へのリプライがきたとき | |
:favorite | |
# 自分ツイートがお気に入り登録されたとき | |
:unfavorite | |
# 自分ツイートがお気に入り解除されたとき | |
:follow | |
# 自分がフォローされたとき、または自分がフォローしたとき | |
:unfollow | |
# 自分がアンフォローしたとき | |
:delete | |
# 自分のまたはだれかのツイートが削除されたとき | |
:friendlist | |
# ユーザーストリームが接続されたときに毎回最初にくる自分がフォローしている人のリストがきたとき | |
:directmessage | |
# ダイレクトメッセージがきたとき(あまり調べていないので非推奨) | |
==== オプション ==== | |
:exclude_user => ["aaa", "bbb", ...] | |
# 指定したユーザーの時は反応しなくなる(ブラックリスト) | |
# :meを指定すると自分になります | |
# リツイートの場合オリジナルのツイートのuserを参照します | |
:include_user => ["aaa", "bbb", ...] | |
# 指定したユーザーの時だけ反応するようになる(ホワイトリスト) | |
# :meを指定すると自分になります | |
# リツイートの場合オリジナルのツイートのuserを参照します | |
:exclude_retweet => true | |
# ツイートがリツイートの時は反応しなくなる | |
:match => /正規表現/ | |
# ツイートに指定した正規表現がマッチしたときだけに反応する | |
:exclude_match => /正規表現/ | |
# ツイートに指定した正規表現がマッチしたときに反応しなくなる | |
:only_friends => true | |
# 自分がフォローしているユーザーにのみ反応する | |
# 自分は常に含まれる | |
:only_followers => true | |
# 自分がフォローされているユーザーにのみ反応する | |
# 自分は常に含まれる | |
# (注意) 60分毎にフォロワーリストを更新しているため、誤反応する可能性もある | |
:only_ff => true | |
# 自分が相互フォローであるユーザーにのみ反応する | |
# 自分は常に含まれる | |
# (注意) 60分毎にフォロワーリストを更新しているため、誤反応する可能性もある | |
:lambda => lambda { |res| ... } | |
# lambdaをresによって評価する。戻り値がtrue以外の場合はnew_eventの引数に追加される。非推奨。 | |
==== その他 ==== | |
.run(true, true) # デバッグ出力を行う。1つ目の引数がbacktraceの出力で、2つ目の引数がデバッグ用のprint出力。 | |
$VERBOSE = nil # これしないとワーニングが出まくる | |
オプションは複数指定した場合、すべての条件が"かつ(&&)"で処理されます | |
ツイートオブジェクトの中身とかは`bot-2.rb`の下のほうにまとめてあります | |
なにか他に追加したら便利そうなイベントやオプションを教えてくれたら追加します | |
あんまり動作確認してないのでバグは教えてください | |
#################################### | |
=end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require "twitter" | |
require 'yaml' | |
# require "pp" | |
# require "pry" | |
module Bot | |
class Event | |
def initialize(event_type, option, client, &b) | |
@event_type = event_type | |
@event_obj = nil | |
@option = [] | |
@block = b | |
@client = client | |
case event_type | |
when :text | |
@event_obj = Twitter::Tweet | |
when :reply | |
@event_obj = Twitter::Tweet | |
@option << lambda { |res| | |
!!(arr_send(:user_mentions?, res) && arr_send(:user_mentions, res).map { |um| um.screen_name }.index(@client.mydata.screen_name)) | |
} | |
when :favorite | |
@event_obj = Twitter::Streaming::Event | |
@option << lambda { |res| | |
arr_send(:name, res) == :favorite | |
} | |
when :unfavorite | |
@event_obj = Twitter::Streaming::Event | |
@option << lambda { |res| | |
arr_send(:name, res) == :unfavorite | |
} | |
when :follow | |
@event_obj = Twitter::Streaming::Event | |
@option << lambda { |res| | |
arr_send(:name, res) == :follow | |
} | |
when :unfollow | |
@event_obj = Twitter::Streaming::Event | |
@option << lambda { |res| | |
arr_send(:name, res) == :unfollow | |
} | |
when :delete | |
@event_obj = Twitter::Streaming::DeletedTweet | |
when :friendlist | |
@event_obj = Twitter::Streaming::FriendList | |
when :directmessage # not recommend | |
@event_obj = Twitter::DirectMessage | |
else | |
raise "Error: event type not found" | |
end | |
option.each { |k, v| | |
case k | |
when :exclude_user | |
v = [v] if v.class != Array | |
v = v.map { |sc| sc == :me ? @client.mydata.screen_name : sc } | |
@option << lambda { |res| | |
res = res.retweeted_status if arr_send(:retweeted_status?, res) | |
r = arr_send([:user, :screen_name], res) || arr_send([:source, :screen_name], res) | |
!!(r && !v.index(r)) | |
} | |
when :include_user | |
v = [v] if v.class != Array | |
v = v.map { |sc| sc == :me ? @client.mydata.screen_name : sc } | |
@option << lambda { |res| | |
res = res.retweeted_status if arr_send(:retweeted_status?, res) | |
r = arr_send([:user, :screen_name], res) || arr_send([:source, :screen_name], res) | |
!!(r && v.index(r)) | |
} | |
when :exclude_retweet | |
if v | |
@option << lambda { |res| | |
arr_send(:retweeted_status?, res) == false | |
} | |
end | |
when :match | |
v = Regexp.new(v) if v.class != Regexp | |
@option << lambda { |res| | |
t = arr_send(:text, res) || arr_send([:target_object, :text], res) | |
t && t.match(v) | |
} | |
when :exclude_match | |
v = Regexp.new(v) if v.class != Regexp | |
@option << lambda { |res| | |
!!((arr_send(:text, res) || arr_send([:target_object, :text], res)) !~ v) | |
} | |
when :only_friends | |
if v | |
@option << lambda { |res| | |
[email protected]_ids.index(arr_send([:user, :id], res)) | |
} | |
end | |
when :only_followers # not recommend | |
if v | |
@option << lambda { |res| | |
[email protected]_ids.index(arr_send([:user, :id], res)) | |
} | |
end | |
when :only_ff | |
if v | |
@option << lambda { |res| | |
!!(@client.follower_ids.index(arr_send([:user, :id], res)) && @client.friend_ids.index(arr_send([:user, :id], res))) | |
} | |
end | |
when :lambda | |
@option << v | |
end | |
} | |
end | |
def delete # not recommend | |
client.delete_event(self) | |
end | |
def run(res) | |
printf "%s : %s : %s : %s\n", res.class, @event_obj, @event_type, @option.map { |opt| opt.call(res) }.to_s if @client.debug | |
if res.class == @event_obj | |
opt_result = @option.map { |opt| opt.call(res) } | |
@block.call(res, *opt_result.delete_if { |v| v.nil? || v == true || v == false }) if opt_result.all? | |
end | |
end | |
private | |
def arr_send(a, res) | |
a = [a] if a.class != Array | |
if res.respond_to?(a[0]) | |
r = res.send(a[0]) | |
if a[1] | |
return arr_send(a[1..-1], r) | |
else | |
return r | |
end | |
end | |
end | |
end | |
class Client | |
attr_reader :debug, :backtr, :api, :mydata, :friend_ids, :follower_ids | |
def initialize(dir = nil) | |
@api = nil | |
@stream_api = nil | |
@mydata = nil | |
@follower_ids = [] | |
@friend_ids = [] | |
@events = [] | |
@debug = false | |
@backtr = false | |
@run_every = lambda { |res| | |
if res.class == Twitter::Streaming::Event && res.respond_to?(:name) | |
if res.name == :follow | |
if res.source == @mydata | |
@friend_ids << res.target.id | |
elsif res.target == @mydata | |
@follower_ids << res.source.id | |
end | |
elsif res.name == :unfollow && res.source == @mydata | |
@friend_ids.delete(res.target.id) | |
end | |
end | |
} | |
load_keys(dir) if dir | |
setup { |config| yield(config) } if block_given? | |
end | |
def load_keys(dir) | |
dir = File.expand_path(dir) | |
key_data = YAML.load_file(dir) | |
setup do |config| | |
config.consumer_key = key_data["consumer_key"] | |
config.consumer_secret = key_data["consumer_secret"] | |
config.access_token = key_data["access_token"] | |
config.access_token_secret = key_data["access_token_secret"] | |
end | |
end | |
def setup | |
@api = Twitter::REST::Client.new do |config| | |
yield(config) | |
end | |
@stream_api = Twitter::Streaming::Client.new do |config| | |
yield(config) | |
end | |
init_mydata() | |
end | |
def init_mydata | |
@mydata = @api.verify_credentials | |
@friend_ids = [@mydata.id] + @api.friend_ids.to_a | |
@follower_ids = [@mydata.id] + @api.follower_ids.to_a | |
Thread.new { | |
sleep 60 * 60 * 60 | |
init_mydata() | |
} | |
end | |
def run(backtr = false, debug = false) | |
@backtr = backtr | |
@debug = debug | |
raise "keys are not loaded yet." if !@api | |
loop do | |
begin | |
say("Connecting...") | |
@stream_api.user do |res| | |
@run_every.call(res) | |
@events.each { |e| | |
e.run(res) | |
} | |
end | |
rescue Exception => e | |
if e.to_s == "" | |
puts | |
say("Terminate") | |
exit 1 | |
end | |
say("Error: #{e}", "e") | |
puts e.backtrace if @backtr | |
sleep 5 | |
end | |
end | |
end | |
def new_event(event_type, *option, &b) | |
option[0] = {} if option.empty? | |
@events << Bot::Event.new(event_type, option[0], self, &b) | |
end | |
def delete_event(obj) | |
@events.delete(obj) | |
end | |
def update_long(msg, template, *id) | |
msg_max = 140 - template.gsub(/%msg/,"").length | |
msg_arr = [] | |
(msg.length / msg_max + 1).times do |i| | |
msg_arr[i] = msg[msg_max * i, msg_max] | |
end | |
msg_arr.each do |split_msg| | |
if(id.empty?) | |
@api.update(template.gsub(/%msg/,split_msg)) | |
else | |
@api.update(template.gsub(/%msg/,split_msg), {:in_reply_to_status_id => id[0].to_s}) | |
end | |
end | |
end | |
def say(text, *level) | |
level_num = "36" | |
unless level.empty? | |
case level[0] | |
when "n" | |
level_num = "36" | |
when "e" | |
level_num = "33" | |
when "w" | |
level_num = "31" | |
end | |
end | |
system("echo \"\033[1;#{level_num}m===>\033[0;39m \033[1m#{text}\033[0;39m\"") | |
end | |
end | |
end | |
=begin | |
######## Streaming Object ######## | |
### Normal Tweet ### | |
#<Twitter::Tweet id=428120316225662977> | |
[:favorite_count, :favorite_count?, :favorited, :favorited?, :filter_level, :filter_level?, :in_reply_to_screen_name, :in_reply_to_screen_name?, :in_reply_to_attrs_id, :in_reply_to_attrs_id?, :in_reply_to_status_id, :in_reply_to_status_id?, :in_reply_to_user_id, :in_reply_to_user_id?, :lang, :lang?, :retweet_count, :retweet_count?, :retweeted, :retweeted?, :source, :source?, :text, :text?, :truncated, :truncated?, :favorites_count, :favoriters_count, :in_reply_to_tweet_id, :reply?, :retweeters_count, :geo, :geo?, :metadata, :metadata?, :place, :place?, :retweeted_status, :retweeted_status?, :retweet, :retweeted_tweet, :retweet?, :retweeted_tweet?, :user, :user?, :full_text, :uri, :url, :entities?, :hashtags, :hashtags?, :media, :media?, :symbols, :symbols?, :uris, :urls, :uris?, :urls?, :user_mentions, :user_mentions?, :created_at, :created?, :id, :id?, :eql?, :==, :hash, :inspect, :attrs, :to_h, :to_hash, :to_hsh, :[], :freeze, :memoize, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :to_s, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
### Event Follow ### | |
#<Twitter::Streaming::Event:0x007fb51caeacd0 | |
@name=:follow, | |
@source=#<Twitter::User id=322116499>, | |
@target=#<Twitter::User id=630274642>, | |
@target_object=nil> | |
[:name, :source, :target, :target_object, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
### Event Unfollow ### | |
#<Twitter::Streaming::Event:0x007fb51cc1eae8 | |
@name=:unfollow, | |
@source=#<Twitter::User id=322116499>, | |
@target=#<Twitter::User id=630274642>, | |
@target_object=nil> | |
[:name, :source, :target, :target_object, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
### Event Favorite ### | |
#<Twitter::Streaming::Event:0x007fb51cc91a48 | |
@name=:favorite, | |
@source=#<Twitter::User id=322116499>, | |
@target=#<Twitter::User id=2307867914>, | |
@target_object=#<Twitter::Tweet id=428079940739665920>> | |
[:name, :source, :target, :target_object, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
### Event Unfavorite ### | |
#<Twitter::Streaming::Event:0x007fb51cc97ad8 | |
@name=:unfavorite, | |
@source=#<Twitter::User id=322116499>, | |
@target=#<Twitter::User id=2307867914>, | |
@target_object=#<Twitter::Tweet id=428079940739665920>> | |
[:name, :source, :target, :target_object, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
### Delete Tweet ### | |
#<Twitter::Streaming::DeletedTweet id=428122534689509376> | |
[:user_id, :user_id?, :id, :id?, :eql?, :==, :hash, :inspect, :attrs, :to_h, :to_hash, :to_hsh, :[], :freeze, :memoize, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :to_s, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
######## User Object ######## | |
#<Twitter::User id=961844316> | |
[:connections, :connections?, :contributors_enabled, :contributors_enabled?, :default_profile, :default_profile?, :default_profile_image, :default_profile_image?, :description, :description?, :favourites_count?, :follow_request_sent, :follow_request_sent?, :followers_count, :followers_count?, :friends_count, :friends_count?, :geo_enabled, :geo_enabled?, :is_translator, :is_translator?, :lang, :lang?, :listed_count, :listed_count?, :location, :location?, :name, :name?, :notifications, :notifications?, :profile_background_color, :profile_background_color?, :profile_background_image_url, :profile_background_image_url?, :profile_background_image_url_https, :profile_background_image_url_https?, :profile_background_tile, :profile_background_tile?, :profile_link_color, :profile_link_color?, :profile_sidebar_border_color, :profile_sidebar_border_color?, :profile_sidebar_fill_color, :profile_sidebar_fill_color?, :profile_text_color, :profile_text_color?, :profile_use_background_image, :profile_use_background_image?, :protected, :protected?, :statuses_count, :statuses_count?, :time_zone, :time_zone?, :utc_offset, :utc_offset?, :verified, :verified?, :favorites_count, :profile_background_image_uri, :profile_background_image_uri_https, :translator?, :tweets_count, :status, :status?, :tweet, :tweet?, :tweeted?, :description_uris, :description_urls, :uri, :url, :website, :website?, :profile_banner_uri, :profile_banner_url, :profile_banner_uri_https, :profile_banner_url_https, :profile_banner_uri?, :profile_banner_url?, :profile_banner_uri_https?, :profile_banner_url_https?, :profile_image_uri, :profile_image_url, :profile_image_uri_https, :profile_image_url_https, :profile_image_uri?, :profile_image_url?, :profile_image_uri_https?, :profile_image_url_https?, :created_at, :created?, :following, :following?, :screen_name, :screen_name?, :handle, :username, :user_name, :id, :id?, :eql?, :==, :hash, :inspect, :attrs, :to_h, :to_hash, :to_hsh, :[], :freeze, :memoize, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :to_s, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
######## Entities UserMention Object ######## | |
#<Twitter::Entity::UserMention:0x007f88bc2df928 | |
@attrs= | |
{:screen_name=>"pn1y", | |
:name=>"あわあわ", | |
:id=>322116499, | |
:id_str=>"322116499", | |
:indices=>[0, 5]}> | |
[:id, :id?, :name, :name?, :screen_name, :screen_name?, :indices, :indices?, :attrs, :to_h, :to_hash, :to_hsh, :[], :freeze, :memoize, :psych_to_yaml, :to_yaml_properties, :to_yaml, :pry, :__binding__, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :pretty_inspect, :debugger, :breakpoint, :binding_n, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment