forked from TeamInklings/Octobot
Use Result.Success property instead of Result.FromSuccess() (#283)
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
309d900067
commit
a80debf1b1
18 changed files with 59 additions and 54 deletions
|
@ -20,8 +20,8 @@ namespace Octobot.Commands.Events;
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
|
public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
|
||||||
{
|
{
|
||||||
private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger;
|
|
||||||
private readonly IFeedbackService _feedback;
|
private readonly IFeedbackService _feedback;
|
||||||
|
private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger;
|
||||||
private readonly IDiscordRestUserAPI _userApi;
|
private readonly IDiscordRestUserAPI _userApi;
|
||||||
|
|
||||||
public ErrorLoggingPostExecutionEvent(ILogger<ErrorLoggingPostExecutionEvent> logger, IFeedbackService feedback,
|
public ErrorLoggingPostExecutionEvent(ILogger<ErrorLoggingPostExecutionEvent> logger, IFeedbackService feedback,
|
||||||
|
@ -53,7 +53,7 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
|
||||||
|
|
||||||
if (result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var botResult = await _userApi.GetCurrentUserAsync(ct);
|
var botResult = await _userApi.GetCurrentUserAsync(ct);
|
||||||
|
|
|
@ -33,6 +33,6 @@ public class LoggingPreparationErrorEvent : IPreparationErrorEvent
|
||||||
{
|
{
|
||||||
_logger.LogResult(preparationResult, "Error in slash command preparation.");
|
_logger.LogResult(preparationResult, "Error in slash command preparation.");
|
||||||
|
|
||||||
return Task.FromResult(Result.FromSuccess());
|
return Task.FromResult(Result.Success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,8 @@ public class MuteCommandGroup : CommandGroup
|
||||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken);
|
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await MuteUserAsync(executor, target, reason, duration, guildId, data, channelId, bot, CancellationToken);
|
return await MuteUserAsync(executor, target, reason, duration, guildId, data, channelId, bot,
|
||||||
|
CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> MuteUserAsync(
|
private async Task<Result> MuteUserAsync(
|
||||||
|
@ -143,14 +144,16 @@ public class MuteCommandGroup : CommandGroup
|
||||||
|
|
||||||
var until = DateTimeOffset.UtcNow.Add(duration); // >:)
|
var until = DateTimeOffset.UtcNow.Add(duration); // >:)
|
||||||
|
|
||||||
var muteMethodResult = await SelectMuteMethodAsync(executor, target, reason, duration, guildId, data, bot, until, ct);
|
var muteMethodResult =
|
||||||
|
await SelectMuteMethodAsync(executor, target, reason, duration, guildId, data, bot, until, ct);
|
||||||
if (!muteMethodResult.IsSuccess)
|
if (!muteMethodResult.IsSuccess)
|
||||||
{
|
{
|
||||||
return ResultExtensions.FromError(muteMethodResult);
|
return ResultExtensions.FromError(muteMethodResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = string.Format(Messages.UserMuted, target.GetTag());
|
var title = string.Format(Messages.UserMuted, target.GetTag());
|
||||||
var description = new StringBuilder().AppendBulletPointLine(string.Format(Messages.DescriptionActionReason, reason))
|
var description = new StringBuilder()
|
||||||
|
.AppendBulletPointLine(string.Format(Messages.DescriptionActionReason, reason))
|
||||||
.AppendBulletPoint(string.Format(
|
.AppendBulletPoint(string.Format(
|
||||||
Messages.DescriptionActionExpiresAt, Markdown.Timestamp(until))).ToString();
|
Messages.DescriptionActionExpiresAt, Markdown.Timestamp(until))).ToString();
|
||||||
|
|
||||||
|
@ -348,11 +351,12 @@ public class MuteCommandGroup : CommandGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> RemoveMuteRoleAsync(
|
private async Task<Result> RemoveMuteRoleAsync(
|
||||||
IUser executor, IUser target, string reason, Snowflake guildId, MemberData memberData, CancellationToken ct = default)
|
IUser executor, IUser target, string reason, Snowflake guildId, MemberData memberData,
|
||||||
|
CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
if (memberData.MutedUntil is null)
|
if (memberData.MutedUntil is null)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
||||||
|
@ -372,7 +376,7 @@ public class MuteCommandGroup : CommandGroup
|
||||||
{
|
{
|
||||||
if (communicationDisabledUntil is null)
|
if (communicationDisabledUntil is null)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
||||||
|
|
|
@ -20,7 +20,7 @@ public sealed class BoolOption : Option<bool>
|
||||||
}
|
}
|
||||||
|
|
||||||
settings[Name] = value;
|
settings[Name] = value;
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryParseBool(string from, out bool value)
|
private static bool TryParseBool(string from, out bool value)
|
||||||
|
|
|
@ -35,7 +35,13 @@ public class Option<T> : IOption
|
||||||
public virtual Result Set(JsonNode settings, string from)
|
public virtual Result Set(JsonNode settings, string from)
|
||||||
{
|
{
|
||||||
settings[Name] = from;
|
settings[Name] = from;
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result Reset(JsonNode settings)
|
||||||
|
{
|
||||||
|
settings[Name] = null;
|
||||||
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,10 +54,4 @@ public class Option<T> : IOption
|
||||||
var property = settings[Name];
|
var property = settings[Name];
|
||||||
return property != null ? property.GetValue<T>() : DefaultValue;
|
return property != null ? property.GetValue<T>() : DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Reset(JsonNode settings)
|
|
||||||
{
|
|
||||||
settings[Name] = null;
|
|
||||||
return Result.FromSuccess();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public sealed partial class SnowflakeOption : Option<Snowflake>
|
||||||
}
|
}
|
||||||
|
|
||||||
settings[Name] = parsed;
|
settings[Name] = parsed;
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratedRegex("[^0-9]")]
|
[GeneratedRegex("[^0-9]")]
|
||||||
|
|
|
@ -22,6 +22,6 @@ public sealed class TimeSpanOption : Option<TimeSpan>
|
||||||
}
|
}
|
||||||
|
|
||||||
settings[Name] = span.ToString();
|
settings[Name] = span.ToString();
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public static class CollectionExtensions
|
||||||
{
|
{
|
||||||
return list.Count switch
|
return list.Count switch
|
||||||
{
|
{
|
||||||
0 => Result.FromSuccess(),
|
0 => Result.Success,
|
||||||
1 => list[0],
|
1 => list[0],
|
||||||
_ => new AggregateError(list.Cast<IResult>().ToArray())
|
_ => new AggregateError(list.Cast<IResult>().ToArray())
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ public static class GuildScheduledEventExtensions
|
||||||
}
|
}
|
||||||
|
|
||||||
return scheduledEvent.ScheduledEndTime.AsOptional().IsDefined(out endTime)
|
return scheduledEvent.ScheduledEndTime.AsOptional().IsDefined(out endTime)
|
||||||
? Result.FromSuccess()
|
? Result.Success
|
||||||
: new ArgumentNullError(nameof(scheduledEvent.ScheduledEndTime));
|
: new ArgumentNullError(nameof(scheduledEvent.ScheduledEndTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
|
||||||
{
|
{
|
||||||
if (!gatewayEvent.Guild.IsT0) // Guild is not IAvailableGuild
|
if (!gatewayEvent.Guild.IsT0) // Guild is not IAvailableGuild
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var guild = gatewayEvent.Guild.AsT0;
|
var guild = gatewayEvent.Guild.AsT0;
|
||||||
|
@ -76,12 +76,12 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
|
||||||
|
|
||||||
if (!GuildSettings.ReceiveStartupMessages.Get(cfg))
|
if (!GuildSettings.ReceiveStartupMessages.Get(cfg))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
|
||||||
if (GuildSettings.WelcomeMessagesChannel.Get(cfg).Empty()
|
if (GuildSettings.WelcomeMessagesChannel.Get(cfg).Empty()
|
||||||
|| GuildSettings.WelcomeMessage.Get(cfg) is "off" or "disable" or "disabled")
|
|| GuildSettings.WelcomeMessage.Get(cfg) is "off" or "disable" or "disabled")
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||||
|
@ -85,7 +85,7 @@ public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
|
||||||
{
|
{
|
||||||
if (!GuildSettings.ReturnRolesOnRejoin.Get(cfg))
|
if (!GuildSettings.ReturnRolesOnRejoin.Get(cfg))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var assignRoles = new List<Snowflake>();
|
var assignRoles = new List<Snowflake>();
|
||||||
|
|
|
@ -38,13 +38,13 @@ public class GuildMemberLeftResponder : IResponder<IGuildMemberRemove>
|
||||||
var memberData = data.GetOrCreateMemberData(user.ID);
|
var memberData = data.GetOrCreateMemberData(user.ID);
|
||||||
if (memberData.BannedUntil is not null || memberData.Kicked)
|
if (memberData.BannedUntil is not null || memberData.Kicked)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GuildSettings.WelcomeMessagesChannel.Get(cfg).Empty()
|
if (GuildSettings.WelcomeMessagesChannel.Get(cfg).Empty()
|
||||||
|| GuildSettings.LeaveMessage.Get(cfg) is "off" or "disable" or "disabled")
|
|| GuildSettings.LeaveMessage.Get(cfg) is "off" or "disable" or "disabled")
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||||
|
|
|
@ -33,6 +33,6 @@ public class GuildUnloadedResponder : IResponder<IGuildDelete>
|
||||||
_logger.LogInformation("Unloaded guild {GuildId}", guildId);
|
_logger.LogInformation("Unloaded guild {GuildId}", guildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(Result.FromSuccess());
|
return Task.FromResult(Result.Success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class MessageDeletedResponder : IResponder<IMessageDelete>
|
||||||
{
|
{
|
||||||
if (!gatewayEvent.GuildID.IsDefined(out var guildId))
|
if (!gatewayEvent.GuildID.IsDefined(out var guildId))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg = await _guildData.GetSettings(guildId, ct);
|
var cfg = await _guildData.GetSettings(guildId, ct);
|
||||||
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageResult = await _channelApi.GetChannelMessageAsync(gatewayEvent.ChannelID, gatewayEvent.ID, ct);
|
var messageResult = await _channelApi.GetChannelMessageAsync(gatewayEvent.ChannelID, gatewayEvent.ID, ct);
|
||||||
|
@ -56,7 +56,7 @@ public class MessageDeletedResponder : IResponder<IMessageDelete>
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(message.Content))
|
if (string.IsNullOrWhiteSpace(message.Content))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditLogResult = await _auditLogApi.GetGuildAuditLogAsync(
|
var auditLogResult = await _auditLogApi.GetGuildAuditLogAsync(
|
||||||
|
|
|
@ -48,28 +48,28 @@ public class MessageEditedResponder : IResponder<IMessageUpdate>
|
||||||
|
|
||||||
if (!gatewayEvent.GuildID.IsDefined(out var guildId))
|
if (!gatewayEvent.GuildID.IsDefined(out var guildId))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gatewayEvent.Author.IsDefined(out var author) && author.IsBot.OrDefault(false))
|
if (gatewayEvent.Author.IsDefined(out var author) && author.IsBot.OrDefault(false))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gatewayEvent.EditedTimestamp.IsDefined(out var timestamp))
|
if (!gatewayEvent.EditedTimestamp.IsDefined(out var timestamp))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess(); // The message wasn't actually edited
|
return Result.Success; // The message wasn't actually edited
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gatewayEvent.Content.IsDefined(out var newContent))
|
if (!gatewayEvent.Content.IsDefined(out var newContent))
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg = await _guildData.GetSettings(guildId, ct);
|
var cfg = await _guildData.GetSettings(guildId, ct);
|
||||||
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cacheKey = new KeyHelpers.MessageCacheKey(channelId, messageId);
|
var cacheKey = new KeyHelpers.MessageCacheKey(channelId, messageId);
|
||||||
|
@ -78,12 +78,12 @@ public class MessageEditedResponder : IResponder<IMessageUpdate>
|
||||||
if (!messageResult.IsDefined(out var message))
|
if (!messageResult.IsDefined(out var message))
|
||||||
{
|
{
|
||||||
_ = _channelApi.GetChannelMessageAsync(channelId, messageId, ct);
|
_ = _channelApi.GetChannelMessageAsync(channelId, messageId, ct);
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.Content == newContent)
|
if (message.Content == newContent)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom event responders are called earlier than responders responsible for message caching
|
// Custom event responders are called earlier than responders responsible for message caching
|
||||||
|
|
|
@ -34,6 +34,6 @@ public class MessageCreateResponder : IResponder<IMessageCreate>
|
||||||
"лан" => "https://i.ibb.co/VYH2QLc/lan.jpg",
|
"лан" => "https://i.ibb.co/VYH2QLc/lan.jpg",
|
||||||
_ => default(Optional<string>)
|
_ => default(Optional<string>)
|
||||||
});
|
});
|
||||||
return Task.FromResult(Result.FromSuccess());
|
return Task.FromResult(Result.Success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
|
|
||||||
if (!canInteract)
|
if (!canInteract)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var autoUnmuteResult = await TryAutoUnmuteAsync(guildId, id, data, ct);
|
var autoUnmuteResult = await TryAutoUnmuteAsync(guildId, id, data, ct);
|
||||||
|
@ -148,14 +148,14 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (data.BannedUntil is null || DateTimeOffset.UtcNow <= data.BannedUntil)
|
if (data.BannedUntil is null || DateTimeOffset.UtcNow <= data.BannedUntil)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var existingBanResult = await _guildApi.GetGuildBanAsync(guildId, id, ct);
|
var existingBanResult = await _guildApi.GetGuildBanAsync(guildId, id, ct);
|
||||||
if (!existingBanResult.IsDefined())
|
if (!existingBanResult.IsDefined())
|
||||||
{
|
{
|
||||||
data.BannedUntil = null;
|
data.BannedUntil = null;
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var unbanResult = await _guildApi.RemoveGuildBanAsync(
|
var unbanResult = await _guildApi.RemoveGuildBanAsync(
|
||||||
|
@ -173,7 +173,7 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (data.MutedUntil is null || DateTimeOffset.UtcNow <= data.MutedUntil)
|
if (data.MutedUntil is null || DateTimeOffset.UtcNow <= data.MutedUntil)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
||||||
|
@ -209,7 +209,7 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
|
|
||||||
if (!usernameChanged)
|
if (!usernameChanged)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newNickname = string.Concat(characterList.ToArray());
|
var newNickname = string.Concat(characterList.ToArray());
|
||||||
|
@ -230,12 +230,13 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (DateTimeOffset.UtcNow < reminder.At)
|
if (DateTimeOffset.UtcNow < reminder.At)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var builder = new StringBuilder()
|
var builder = new StringBuilder()
|
||||||
.AppendBulletPointLine(string.Format(Messages.DescriptionReminder, Markdown.InlineCode(reminder.Text)))
|
.AppendBulletPointLine(string.Format(Messages.DescriptionReminder, Markdown.InlineCode(reminder.Text)))
|
||||||
.AppendBulletPointLine(string.Format(Messages.DescriptionActionJumpToMessage, $"https://discord.com/channels/{guildId.Value}/{reminder.ChannelId}/{reminder.MessageId}"));
|
.AppendBulletPointLine(string.Format(Messages.DescriptionActionJumpToMessage,
|
||||||
|
$"https://discord.com/channels/{guildId.Value}/{reminder.ChannelId}/{reminder.MessageId}"));
|
||||||
|
|
||||||
var embed = new EmbedBuilder().WithSmallTitle(
|
var embed = new EmbedBuilder().WithSmallTitle(
|
||||||
string.Format(Messages.Reminder, user.GetTag()), user)
|
string.Format(Messages.Reminder, user.GetTag()), user)
|
||||||
|
@ -251,6 +252,6 @@ public sealed partial class MemberUpdateService : BackgroundService
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Reminders.Remove(reminder);
|
data.Reminders.Remove(reminder);
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
|| eventData.EarlyNotificationSent
|
|| eventData.EarlyNotificationSent
|
||||||
|| DateTimeOffset.UtcNow < scheduledEvent.ScheduledStartTime - offset)
|
|| DateTimeOffset.UtcNow < scheduledEvent.ScheduledStartTime - offset)
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sendResult = await SendEarlyEventNotificationAsync(scheduledEvent, data, ct);
|
var sendResult = await SendEarlyEventNotificationAsync(scheduledEvent, data, ct);
|
||||||
|
@ -182,7 +182,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (GuildSettings.EventNotificationChannel.Get(settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(settings).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scheduledEvent.Creator.IsDefined(out var creator))
|
if (!scheduledEvent.Creator.IsDefined(out var creator))
|
||||||
|
@ -283,7 +283,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
|
|
||||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var embedDescriptionResult = scheduledEvent.EntityType switch
|
var embedDescriptionResult = scheduledEvent.EntityType switch
|
||||||
|
@ -324,7 +324,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||||
{
|
{
|
||||||
data.ScheduledEvents.Remove(eventData.Id);
|
data.ScheduledEvents.Remove(eventData.Id);
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var completedEmbed = new EmbedBuilder()
|
var completedEmbed = new EmbedBuilder()
|
||||||
|
@ -356,7 +356,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||||
{
|
{
|
||||||
data.ScheduledEvents.Remove(eventData.Id);
|
data.ScheduledEvents.Remove(eventData.Id);
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var embed = new EmbedBuilder()
|
var embed = new EmbedBuilder()
|
||||||
|
@ -409,7 +409,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||||
{
|
{
|
||||||
return Result.FromSuccess();
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var contentResult = await _utility.GetEventNotificationMentions(
|
var contentResult = await _utility.GetEventNotificationMentions(
|
||||||
|
|
Reference in a new issue