mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 13:25:13 +02:00
New: Many UI Updates and Performance Tweaks
This commit is contained in:
@@ -6,6 +6,7 @@ using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Rest;
|
||||
using System.Web;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Telegram
|
||||
{
|
||||
@@ -28,13 +29,13 @@ namespace NzbDrone.Core.Notifications.Telegram
|
||||
public void SendNotification(string title, string message, TelegramSettings settings)
|
||||
{
|
||||
//Format text to add the title before and bold using markdown
|
||||
var text = $"*{title}*\n{message}";
|
||||
var text = $"<b>{HttpUtility.HtmlEncode(title)}</b>\n{HttpUtility.HtmlEncode(message)}";
|
||||
var client = RestClientFactory.BuildClient(URL);
|
||||
var request = new RestRequest("bot{token}/sendmessage", Method.POST);
|
||||
|
||||
request.AddUrlSegment("token", settings.BotToken);
|
||||
request.AddParameter("chat_id", settings.ChatId);
|
||||
request.AddParameter("parse_mode", "Markdown");
|
||||
request.AddParameter("parse_mode", "HTML");
|
||||
request.AddParameter("text", text);
|
||||
|
||||
client.ExecuteAndValidate(request);
|
||||
@@ -51,7 +52,7 @@ namespace NzbDrone.Core.Notifications.Telegram
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to send test message: " + ex.Message);
|
||||
_logger.Error(ex, "Unable to send test message");
|
||||
|
||||
var restException = ex as RestException;
|
||||
|
||||
|
Reference in New Issue
Block a user