mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using RadicadeServer.API.Notifications;
|
||||
using RadicadeServer.RecNet.Enums.Messages;
|
||||
using RadicadeServer.RecNet.Notifications;
|
||||
|
||||
namespace RadicadeServer.RecNet.Board
|
||||
{
|
||||
public static class CommunityBoardBroadcast
|
||||
{
|
||||
public const string UpdateNotificationId = "CommunityBoardUpdate";
|
||||
|
||||
public static IReadOnlyList<Notification> BuildFrames(CommunityBoard? board)
|
||||
{
|
||||
if (board == null)
|
||||
return Array.Empty<Notification>();
|
||||
|
||||
return new List<Notification>
|
||||
{
|
||||
new Notification
|
||||
{
|
||||
Id = UpdateNotificationId,
|
||||
Msg = board
|
||||
},
|
||||
new Notification
|
||||
{
|
||||
Id = NotificationType.CommunityBoardAnnouncementUpdate,
|
||||
Msg = board.CurrentAnnouncement ?? new BoardAnnouncement
|
||||
{
|
||||
Message = string.Empty,
|
||||
MoreInfoUrl = string.Empty
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static async Task PushAsync(CommunityBoard? board)
|
||||
{
|
||||
foreach (var frame in BuildFrames(board))
|
||||
await Notify.SendGlobalNotify(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user