Class: Plugins::Libsecure
- Inherits:
-
Object
- Object
- Plugins::Libsecure
- Includes:
- ActionView::Helpers::DateHelper, Cinch::Helpers, Cinch::Plugin
- Defined in:
- lib/Zeta/plugins/libsecure.rb
Instance Method Summary collapse
Methods included from Cinch::Plugin
Instance Method Details
#fetch_latest(m) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/Zeta/plugins/libsecure.rb', line 20 def fetch_latest(m) return unless m.channel == '#libsecure' || m.channel == '#bots' client = DiscourseApi::Client.new('https://libsecure.so', Config.secrets[:libsecure], Config.secrets[:libsecure_user] ) parser = client.latest_topics.sort_by { |hash| hash['last_posted_at'] } data = parser.last m.reply "Latest → #{data['title']} -- https://libsecure.so/t/#{data['id']}" end |