part 3 of the response rework

This commit is contained in:
Kwoth
2024-04-29 21:03:40 +00:00
parent d28c7b500d
commit daa2177559
65 changed files with 508 additions and 625 deletions

View File

@@ -40,13 +40,4 @@ public abstract class AnyContext
/// <param name="args">Arguments (if any) to format in</param>
/// <returns>A formatted localized string</returns>
public abstract string GetText(string key, object[]? args = null);
/// <summary>
/// Creates a context-aware <see cref="IEmbedBuilder"/> instance
/// (future feature for guild-based embed colors)
/// Any code dealing with embeds should use it for future-proofness
/// instead of manually creating embedbuilder instances
/// </summary>
/// <returns>A context-aware <see cref="IEmbedBuilder"/> instance </returns>
public abstract EmbedBuilder Embed();
}

View File

@@ -14,13 +14,13 @@
//
// // unlocalized
// public static Task<IUserMessage> SendConfirmAsync(this IMessageChannel ch, AnyContext ctx, string msg)
// => ch.EmbedAsync(ctx.Embed().WithOkColor().WithDescription(msg));
// => _sender.Response(ch).Embed(ctx.Embed().WithOkColor().WithDescription(msg)).SendAsync();
//
// public static Task<IUserMessage> SendPendingAsync(this IMessageChannel ch, AnyContext ctx, string msg)
// => ch.EmbedAsync(ctx.Embed().WithPendingColor().WithDescription(msg));
// => _sender.Response(ch).Embed(ctx.Embed().WithPendingColor().WithDescription(msg)).SendAsync();
//
// public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, AnyContext ctx, string msg)
// => ch.EmbedAsync(ctx.Embed().WithErrorColor().WithDescription(msg));
// => _sender.Response(ch).Embed(ctx.Embed().WithErrorColor().WithDescription(msg)).SendAsync();
//
// // unlocalized
// public static Task<IUserMessage> SendConfirmAsync(this AnyContext ctx, string msg)

View File

@@ -1,18 +0,0 @@
using Discord;
namespace NadekoBot;
public interface IEmbedBuilder
{
EmbedBuilder WithDescription(string? desc);
EmbedBuilder WithTitle(string? title);
EmbedBuilder AddField(string title, object value, bool isInline = false);
EmbedBuilder WithFooter(string text, string? iconUrl = null);
EmbedBuilder WithAuthor(string name, string? iconUrl = null, string? url = null);
EmbedBuilder WithColor(EmbedColor color);
EmbedBuilder WithDiscordColor(Color color);
Embed Build();
EmbedBuilder WithUrl(string url);
EmbedBuilder WithImageUrl(string url);
EmbedBuilder WithThumbnailUrl(string url);
}