jugyo / earthquake

Twitter terminal client with streaming API support.
MIT License
661 stars 94 forks source link

Support for muting user or hashtag #147

Open ooduor opened 11 years ago

ooduor commented 11 years ago

Could you please add support for muting. I presume the extra command could be something ike:

:mute Username or :mute #HashTag

Then all tweets/retweets from the user or with the hashtag won't be shown in the stream. Then :unmute would reverse the action.

Thank you!

no6v commented 11 years ago

Here is my draft of mute plugin :).

Earthquake.once do
  @muting_screen_names ||= []
end

Earthquake.init do
  output_filter do |item|
    next unless item["_stream"]
    item["user"] && !@muting_screen_names.include?(item["user"]["screen_name"])
  end

  command :mute do |m|
    (@muting_screen_names << m[1].delete(?@)).uniq!
  end

  command :unmute do
    @muting_screen_names.clear
  end
end
jugyo commented 11 years ago

:+1: