EventEarlyNotification timestamp bugfix and other changes (#84)

This PR fixes EventEarlyNotification timestamp not displaying correctly
and also has some other changes:
- Add xmldocs for `/settingslist`'s `page` option in
SettingsCommandGroup.cs
- Add option description for `index` for `/delreminder`
- Some corrections of grammatical errors in Messages.tt-ru.resx
- Fix `ArgumentOutOfRangeException` in `/settingslist` that appears if
the user uses a negative integer in `page`

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Macintxsh 2023-08-12 23:19:07 +03:00 committed by GitHub
parent d0d663d2bb
commit 87dbb07dec
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 20 deletions

View file

@ -19,18 +19,15 @@ public sealed class ScheduledEventUpdateService : BackgroundService
private readonly IDiscordRestGuildScheduledEventAPI _eventApi;
private readonly GuildDataService _guildData;
private readonly ILogger<ScheduledEventUpdateService> _logger;
private readonly IDiscordRestUserAPI _userApi;
private readonly UtilityService _utility;
public ScheduledEventUpdateService(IDiscordRestChannelAPI channelApi, IDiscordRestGuildScheduledEventAPI eventApi,
GuildDataService guildData, ILogger<ScheduledEventUpdateService> logger, IDiscordRestUserAPI userApi,
UtilityService utility)
GuildDataService guildData, ILogger<ScheduledEventUpdateService> logger, UtilityService utility)
{
_channelApi = channelApi;
_eventApi = eventApi;
_guildData = guildData;
_logger = logger;
_userApi = userApi;
_utility = utility;
}
@ -345,12 +342,6 @@ public sealed class ScheduledEventUpdateService : BackgroundService
private async Task<Result> SendEarlyEventNotificationAsync(
IGuildScheduledEvent scheduledEvent, GuildData data, CancellationToken ct)
{
var currentUserResult = await _userApi.GetCurrentUserAsync(ct);
if (!currentUserResult.IsDefined(out var currentUser))
{
return Result.FromError(currentUserResult);
}
var contentResult = await _utility.GetEventNotificationMentions(
scheduledEvent, data.Settings, ct);
if (!contentResult.IsDefined(out var content))
@ -359,11 +350,10 @@ public sealed class ScheduledEventUpdateService : BackgroundService
}
var earlyResult = new EmbedBuilder()
.WithSmallTitle(
.WithDescription(
string.Format(Messages.EventEarlyNotification, scheduledEvent.Name,
Markdown.Timestamp(scheduledEvent.ScheduledStartTime, TimestampStyle.RelativeTime)), currentUser)
Markdown.Timestamp(scheduledEvent.ScheduledStartTime, TimestampStyle.RelativeTime)))
.WithColour(ColorsList.Default)
.WithCurrentTimestamp()
.Build();
if (!earlyResult.IsDefined(out var earlyBuilt))