Merge pull request #1838 from shikhir-arora/1.9
Allow for optional "url" field for embed title [clickable]
This commit is contained in:
commit
1e606c246e
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Discord;
|
using Discord;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -12,6 +12,7 @@ namespace NadekoBot.Common
|
|||||||
public string PlainText { get; set; }
|
public string PlainText { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
public string url { get; set; }
|
||||||
public CREmbedFooter Footer { get; set; }
|
public CREmbedFooter Footer { get; set; }
|
||||||
public string Thumbnail { get; set; }
|
public string Thumbnail { get; set; }
|
||||||
public string Image { get; set; }
|
public string Image { get; set; }
|
||||||
@ -26,6 +27,7 @@ namespace NadekoBot.Common
|
|||||||
public bool IsValid =>
|
public bool IsValid =>
|
||||||
!string.IsNullOrWhiteSpace(Title) ||
|
!string.IsNullOrWhiteSpace(Title) ||
|
||||||
!string.IsNullOrWhiteSpace(Description) ||
|
!string.IsNullOrWhiteSpace(Description) ||
|
||||||
|
!string.IsNullOrWhiteSpace(url) ||
|
||||||
!string.IsNullOrWhiteSpace(Thumbnail) ||
|
!string.IsNullOrWhiteSpace(Thumbnail) ||
|
||||||
!string.IsNullOrWhiteSpace(Image) ||
|
!string.IsNullOrWhiteSpace(Image) ||
|
||||||
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
|
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
|
||||||
@ -39,6 +41,8 @@ namespace NadekoBot.Common
|
|||||||
embed.WithTitle(Title);
|
embed.WithTitle(Title);
|
||||||
if (!string.IsNullOrWhiteSpace(Description))
|
if (!string.IsNullOrWhiteSpace(Description))
|
||||||
embed.WithDescription(Description);
|
embed.WithDescription(Description);
|
||||||
|
if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||||
|
embed.WithUrl(url);
|
||||||
embed.WithColor(new Discord.Color(Color));
|
embed.WithColor(new Discord.Color(Color));
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
embed.WithFooter(efb =>
|
embed.WithFooter(efb =>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
Loading…
Reference in New Issue
Block a user