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

@@ -10,16 +10,16 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
private readonly IBotCredsProvider _bcp;
private readonly IHttpClientFactory _httpFactory;
private readonly DiscordSocketClient _client;
private readonly IEmbedBuilderService _ebs;
private readonly IMessageSenderService _sender;
public CheckForUpdatesService(BotConfigService bcs, IBotCredsProvider bcp, IHttpClientFactory httpFactory,
DiscordSocketClient client, IEmbedBuilderService ebs)
DiscordSocketClient client, IMessageSenderService sender)
{
_bcs = bcs;
_bcp = bcp;
_httpFactory = httpFactory;
_client = client;
_ebs = ebs;
_sender = sender;
}
public async Task OnReadyAsync()
@@ -86,7 +86,7 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
.WithDescription(thisVersionChangelog.TrimTo(4096))
.WithFooter("You may disable these messages by typing '.conf bot checkforupdates false'");
await user.EmbedAsync(eb);
await _sender.Response(user).Embed(eb).SendAsync();
}).WhenAll();
}
}

View File

@@ -25,7 +25,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
private readonly IHttpClientFactory _httpFactory;
private readonly BotConfigService _bss;
private readonly IPubSub _pubSub;
private readonly IEmbedBuilderService _eb;
private readonly IMessageSenderService _sender;
//keys
private readonly TypedKey<ActivityPubData> _activitySetKey;
@@ -40,7 +40,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
IHttpClientFactory factory,
BotConfigService bss,
IPubSub pubSub,
IEmbedBuilderService eb)
IMessageSenderService sender)
{
_cmdHandler = cmdHandler;
_db = db;
@@ -50,7 +50,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
_httpFactory = factory;
_bss = bss;
_pubSub = pubSub;
_eb = eb;
_sender = sender;
_activitySetKey = new("activity.set");
_guildLeaveKey = new("guild.leave");
@@ -225,7 +225,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
{
try
{
await ownerCh.Response(_strings, _eb).Confirm(title, toSend).SendAsync();
await _sender.Response(ownerCh).Confirm(title, toSend).SendAsync();
}
catch
{
@@ -238,7 +238,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
try
{
if (_client.GetChannel(cid) is ITextChannel ch)
await ch.Response(_strings, _eb).Confirm(title, toSend).SendAsync();
await _sender.Response(ch).Confirm(title, toSend).SendAsync();
}
catch
{
@@ -252,7 +252,7 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
{
try
{
await firstOwnerChannel.Response(_strings, _eb).Confirm(title, toSend).SendAsync();
await _sender.Response(firstOwnerChannel).Confirm(title, toSend).SendAsync();
}
catch
{