Added SmartText and inheritors SmartPlainText and SmartEmbedText which will replace CREmbed in the future

This commit is contained in:
Kwoth
2021-07-10 23:31:12 +02:00
parent 5e4754fa40
commit 236c286278
7 changed files with 224 additions and 0 deletions

View File

@@ -185,5 +185,39 @@ namespace NadekoBot.Extensions
public static Task WarningAsync(this ICommandContext ctx)
=> ctx.Message.AddReactionAsync(new Emoji("⚠️"));
// todo fix extensions
// public static Task<IUserMessage> EditAsync(this IUserMessage message, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return message.ModifyAsync(set.PlainText ?? "", set.GetEmbed());
// case SmartPlainText spt: return message.EditAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
//
// public static Task<IUserMessage> SendAsync(this IUser user, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return user.SendAsync(set.PlainText ?? "", set.GetEmbed());
// case SmartPlainText spt: return user.SendAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
//
// public static Task<IUserMessage> SendAsync(this ITextChannel channel, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return channel.SendAsync(set.PlainText ?? "", embed: set.GetEmbed());
// case SmartPlainText spt: return channel.SendAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
}
}