From b423b8358dab1604a798f3587df6fc35492c098e Mon Sep 17 00:00:00 2001 From: Basique Evangelist Date: Thu, 22 Apr 2021 21:45:02 +0300 Subject: [PATCH] Display heart in heartbeat messages --- JetHerald/Controllers/HeartbeatController.cs | 4 ++-- JetHerald/JetHeraldBot.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/JetHerald/Controllers/HeartbeatController.cs b/JetHerald/Controllers/HeartbeatController.cs index 40aa556..8b43cc2 100644 --- a/JetHerald/Controllers/HeartbeatController.cs +++ b/JetHerald/Controllers/HeartbeatController.cs @@ -70,11 +70,11 @@ namespace JetHerald.Controllers else if (!t.WriteToken.Equals(args.WriteToken, StringComparison.Ordinal)) return StatusCode(403); - + var affected = await Db.ReportHeartbeat(t.TopicId, heart, args.ExpiryTimeout); if (affected == 1) - await Herald.HeartbeatSent(t); + await Herald.HeartbeatSent(t, heart); return new OkResult(); } diff --git a/JetHerald/JetHeraldBot.cs b/JetHerald/JetHeraldBot.cs index 3c86e60..d7d35bc 100644 --- a/JetHerald/JetHeraldBot.cs +++ b/JetHerald/JetHeraldBot.cs @@ -95,7 +95,7 @@ namespace JetHerald { var chats = await Db.GetChatsForTopic(attack.TopicId); foreach (var chat in chats) - await SendMessageImpl(chat, $"!{attack.Description}!:\nTimeout expired at {attack.ExpiryTime}"); + await SendMessageImpl(chat, $"!{attack.Description}!:\nHeart \"{attack.Heart}\" stopped beating at {attack.ExpiryTime}"); await Db.MarkHeartAttackReported(attack.HeartattackId); if (token.IsCancellationRequested) return; @@ -108,8 +108,8 @@ namespace JetHerald } } - public Task HeartbeatSent(Db.Topic topic) - => BroadcastMessageImpl(topic, $"!{topic.Description}!:\nA heartbeat has been sent."); + public Task HeartbeatSent(Db.Topic topic, string heart) + => BroadcastMessageImpl(topic, $"!{topic.Description}!:\nHeart \"{heart}\" has started beating."); public Task PublishMessage(Db.Topic topic, string message) => BroadcastMessageImpl(topic, $"|{topic.Description}|:\n{message}");