class VideoTitle
Public Instance Methods
get_url(message)
click to toggle source
# File lib/rateless_bot/plugins/video_title.rb, line 18 def get_url(message) index = message.index("youtube.com\/watch\?") message[index..message.length].split(' ')[0] end
get_video_title(video_url)
click to toggle source
# File lib/rateless_bot/plugins/video_title.rb, line 23 def get_video_title(video_url) video = VideoInfo.new(video_url) video.title end
listen(m)
click to toggle source
# File lib/rateless_bot/plugins/video_title.rb, line 10 def listen(m) if m.message.match(/youtube.com\/watch\?/) video_url = get_url(m.message) m.reply get_video_title(video_url) end end