Allow for "titleurl" parameter

{ "title":"Something", "titleurl":"https://google.com" }

“titleurl” is optional and if included will make the title field act
like Markdown as it should:

[title][http://google.com) to render this clickable on iOS Devices
This commit is contained in:
Shikhir Arora 2017-11-16 09:56:39 -05:00
parent b844579d3b
commit 8db0abf318

View File

@ -1,4 +1,4 @@
using System;
using System;
using Discord;
using NadekoBot.Extensions;
using Newtonsoft.Json;
@ -12,6 +12,7 @@ namespace NadekoBot.Common
public string PlainText { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string TitleURL { get; set; }
public CREmbedFooter Footer { get; set; }
public string Thumbnail { get; set; }
public string Image { get; set; }
@ -26,6 +27,7 @@ namespace NadekoBot.Common
public bool IsValid =>
!string.IsNullOrWhiteSpace(Title) ||
!string.IsNullOrWhiteSpace(Description) ||
!string.IsNullOrWhiteSpace(TitleURL) ||
!string.IsNullOrWhiteSpace(Thumbnail) ||
!string.IsNullOrWhiteSpace(Image) ||
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
@ -39,6 +41,8 @@ namespace NadekoBot.Common
embed.WithTitle(Title);
if (!string.IsNullOrWhiteSpace(Description))
embed.WithDescription(Description);
if (!string.IsNullOrWhiteSpace(TitleURL))
embed.WithUrl(TitleURL);
embed.WithColor(new Discord.Color(Color));
if (Footer != null)
embed.WithFooter(efb =>