mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
parent
169ad7da8b
commit
3ffe76b2d2
5 changed files with 381 additions and 20 deletions
|
@ -59,10 +59,18 @@ namespace Ombi.Notifications.Agents
|
|||
Message = parsed.Message,
|
||||
};
|
||||
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
//notification.Other.Add("overview", model.RequestType == RequestType.Movie ? base.MovieRequest.Overview : TvRequest.);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
private void AddOtherInformation(NotificationOptions model, NotificationMessage notification,
|
||||
NotificationMessageContent parsed)
|
||||
{
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
notification.Other.Add("title", model.RequestType == RequestType.Movie ? MovieRequest.Title : TvRequest.Title);
|
||||
}
|
||||
|
||||
protected override async Task NewIssue(NotificationOptions model, MattermostNotificationSettings settings)
|
||||
{
|
||||
var parsed = await LoadTemplate(NotificationAgent.Mattermost, NotificationType.Issue, model);
|
||||
|
@ -75,7 +83,7 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Message = parsed.Message,
|
||||
};
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -91,7 +99,7 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Message = parsed.Message,
|
||||
};
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -107,7 +115,7 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Message = parsed.Message,
|
||||
};
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -149,7 +157,7 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Message = parsed.Message,
|
||||
};
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -166,7 +174,7 @@ namespace Ombi.Notifications.Agents
|
|||
Message = parsed.Message,
|
||||
};
|
||||
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -182,7 +190,7 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Message = parsed.Message,
|
||||
};
|
||||
notification.Other.Add("image", parsed.Image);
|
||||
AddOtherInformation(model, notification, parsed);
|
||||
await Send(notification, settings);
|
||||
}
|
||||
|
||||
|
@ -190,12 +198,20 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
try
|
||||
{
|
||||
var body = new MattermostBody
|
||||
var body = new MattermostMessage
|
||||
{
|
||||
username = string.IsNullOrEmpty(settings.Username) ? "Ombi" : settings.Username,
|
||||
channel = settings.Channel,
|
||||
text = model.Message,
|
||||
icon_url = settings.IconUrl
|
||||
Username = string.IsNullOrEmpty(settings.Username) ? "Ombi" : settings.Username,
|
||||
Channel = settings.Channel,
|
||||
Text = model.Message,
|
||||
IconUrl = new Uri(settings.IconUrl),
|
||||
Attachments = new List<MattermostAttachment>
|
||||
{
|
||||
new MattermostAttachment
|
||||
{
|
||||
Title = model.Other.ContainsKey("title") ? model.Other["title"] : string.Empty,
|
||||
ImageUrl = model.Other.ContainsKey("image") ? new Uri(model.Other["image"]) : null,
|
||||
}
|
||||
}
|
||||
};
|
||||
await Api.PushAsync(settings.WebhookUrl, body);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue