1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

resolving issues attempt №2

This commit is contained in:
Macintxsh 2023-08-12 23:16:17 +03:00
parent f056ecebc1
commit 81d353a16a
Signed by: mctaylors
GPG key ID: 2E1BF7AD0D4BB0B4

View file

@ -19,18 +19,15 @@ public sealed class ScheduledEventUpdateService : BackgroundService
private readonly IDiscordRestGuildScheduledEventAPI _eventApi; private readonly IDiscordRestGuildScheduledEventAPI _eventApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly ILogger<ScheduledEventUpdateService> _logger; private readonly ILogger<ScheduledEventUpdateService> _logger;
private readonly IDiscordRestUserAPI _userApi;
private readonly UtilityService _utility; private readonly UtilityService _utility;
public ScheduledEventUpdateService(IDiscordRestChannelAPI channelApi, IDiscordRestGuildScheduledEventAPI eventApi, public ScheduledEventUpdateService(IDiscordRestChannelAPI channelApi, IDiscordRestGuildScheduledEventAPI eventApi,
GuildDataService guildData, ILogger<ScheduledEventUpdateService> logger, IDiscordRestUserAPI userApi, GuildDataService guildData, ILogger<ScheduledEventUpdateService> logger, UtilityService utility)
UtilityService utility)
{ {
_channelApi = channelApi; _channelApi = channelApi;
_eventApi = eventApi; _eventApi = eventApi;
_guildData = guildData; _guildData = guildData;
_logger = logger; _logger = logger;
_userApi = userApi;
_utility = utility; _utility = utility;
} }
@ -345,12 +342,6 @@ public sealed class ScheduledEventUpdateService : BackgroundService
private async Task<Result> SendEarlyEventNotificationAsync( private async Task<Result> SendEarlyEventNotificationAsync(
IGuildScheduledEvent scheduledEvent, GuildData data, CancellationToken ct) IGuildScheduledEvent scheduledEvent, GuildData data, CancellationToken ct)
{ {
var currentUserResult = await _userApi.GetCurrentUserAsync(ct);
if (!currentUserResult.IsDefined(out _))
{
return Result.FromError(currentUserResult);
}
var contentResult = await _utility.GetEventNotificationMentions( var contentResult = await _utility.GetEventNotificationMentions(
scheduledEvent, data.Settings, ct); scheduledEvent, data.Settings, ct);
if (!contentResult.IsDefined(out var content)) if (!contentResult.IsDefined(out var content))