From 464e8afad5d3c72378b680f4579773adbd089f8f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 7 Jun 2021 17:31:21 +0200 Subject: [PATCH] webhook: define number for watch/star actions too When a star is added/removed, we get notified with a message that has no number, title or link. The pseudo-sentence is also very bare (X started/created/deleted, without an object). Show the number of watchers and/or stars (as appropriate) to produce a more meaningful phrase. --- data/rbot/plugins/webhook.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/data/rbot/plugins/webhook.rb b/data/rbot/plugins/webhook.rb index cf93d9a7..502b5e93 100644 --- a/data/rbot/plugins/webhook.rb +++ b/data/rbot/plugins/webhook.rb @@ -227,6 +227,13 @@ class WebHookPlugin < Plugin num = json[:size] || json[:commits].size rescue nil stream_hash[:number] = _("%{num} commits") % { :num => num } if num + case event + when :watch + stream_hash[:number] ||= 'watching 👀%{watchers_count}' % json[:repository] + when :star + stream_hash[:number] ||= 'star ☆ %{watchers_count}' % json[:repository] + end + debug stream_hash return input_stream.merge stream_hash -- 2.39.2