This repository has been archived on 2024-12-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elliebot/src/EllieBot/_common/Sender/MessageSenderService.cs

56 lines
No EOL
1.5 KiB
C#

using EllieBot.Common.Configs;
namespace EllieBot.Extensions;
public sealed class MessageSenderService : IMessageSenderService, IEService
{
private readonly IBotStrings _bs;
private readonly BotConfigService _bcs;
private readonly DiscordSocketClient _client;
public MessageSenderService(IBotStrings bs, BotConfigService bcs, DiscordSocketClient client)
{
_bs = bs;
_bcs = bcs;
_client = client;
}
public ResponseBuilder Response(IMessageChannel channel)
=> new ResponseBuilder(_bs, _bcs, _client)
.Channel(channel);
public ResponseBuilder Response(ICommandContext ctx)
=> new ResponseBuilder(_bs, _bcs, _client)
.Context(ctx);
public ResponseBuilder Response(IUser user)
=> new ResponseBuilder(_bs, _bcs, _client)
.User(user);
public ResponseBuilder Response(SocketMessageComponent smc)
=> new ResponseBuilder(_bs, _bcs, _client)
.Channel(smc.Channel);
public EllieEmbedBuilder CreateEmbed()
=> new EllieEmbedBuilder(_bcs);
}
public class EllieEmbedBuilder : EmbedBuilder
{
private readonly BotConfig _bc;
public EllieEmbedBuilder(BotConfigService bcs)
{
_bc = bcs.Data;
}
public EmbedBuilder WithOkColor()
=> WithColor(_bc.Color.Ok.ToDiscordColor());
public EmbedBuilder WithErrorColor()
=> WithColor(_bc.Color.Error.ToDiscordColor());
public EmbedBuilder WithPendingColor()
=> WithColor(_bc.Color.Pending.ToDiscordColor());
}