- .say now uses new SmartText instead of CREmbed

- Added IMessageChannel extensions for sending smarttext
- Added implicit operator from string to smarttext (which just creates smartplaintext instance)
This commit is contained in:
Kwoth
2021-07-11 23:37:19 +02:00
parent 236c286278
commit 0064df8ae4
5 changed files with 87 additions and 21 deletions

View File

@@ -2,15 +2,17 @@
namespace NadekoBot
{
// todo 3.3 check if saving embeds in db has IsEmbed field, to prevent rechecking and generating exceptions on every use
public abstract class SmartText
{
public bool IsEmbed => this is SmartEmbedText;
public bool IsPlainText => this is SmartPlainText;
public static implicit operator SmartText(string input)
=> new SmartPlainText(input);
public static SmartText CreateFrom(string input)
{
if (string.IsNullOrWhiteSpace(input) || !input.Trim().StartsWith("{"))
if (string.IsNullOrWhiteSpace(input) || !input.TrimStart().StartsWith("{"))
{
return new SmartPlainText(input);
}