mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
"All checks have failed" :(
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
bbddb3790a
commit
92a8d1da4b
5 changed files with 7 additions and 11 deletions
|
@ -4,7 +4,7 @@ using Remora.Results;
|
||||||
namespace Boyfriend.Data.Options;
|
namespace Boyfriend.Data.Options;
|
||||||
|
|
||||||
public interface IOption {
|
public interface IOption {
|
||||||
string Name { get; init; }
|
string Name { get; }
|
||||||
object GetAsObject(JsonNode settings);
|
object GetAsObject(JsonNode settings);
|
||||||
Result Set(JsonNode settings, string from);
|
Result Set(JsonNode settings, string from);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class Option<T> : IOption {
|
||||||
DefaultValue = defaultValue;
|
DefaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type Type { get; set; } = typeof(T);
|
|
||||||
public string Name { get; init; }
|
public string Name { get; init; }
|
||||||
|
|
||||||
public object GetAsObject(JsonNode settings) {
|
public object GetAsObject(JsonNode settings) {
|
||||||
|
|
|
@ -11,7 +11,9 @@ public class TimeSpanOption : Option<TimeSpan> {
|
||||||
public TimeSpanOption(string name, TimeSpan defaultValue) : base(name, defaultValue) { }
|
public TimeSpanOption(string name, TimeSpan defaultValue) : base(name, defaultValue) { }
|
||||||
|
|
||||||
public override Result Set(JsonNode settings, string from) {
|
public override Result Set(JsonNode settings, string from) {
|
||||||
if (!Parser.TryParseAsync(from).Result.IsDefined(out var span))
|
var task = Parser.TryParseAsync(from).AsTask().GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
if (task.IsDefined(out var span))
|
||||||
return Result.FromError(new ArgumentInvalidError(nameof(from), Messages.InvalidSettingValue));
|
return Result.FromError(new ArgumentInvalidError(nameof(from), Messages.InvalidSettingValue));
|
||||||
|
|
||||||
settings[Name] = span.ToString();
|
settings[Name] = span.ToString();
|
||||||
|
|
|
@ -302,7 +302,7 @@ public class GuildUpdateService : BackgroundService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sending a notification, mentioning the <see cref="GuildSettings.EventStartedReceivers" />s,
|
/// Handles sending a notification, mentioning the <see cref="GuildSettings.EventNotificationRole"/> and event subscribers,
|
||||||
/// when a scheduled event is about to start, has started or completed
|
/// when a scheduled event is about to start, has started or completed
|
||||||
/// in a guild's <see cref="GuildSettings.EventNotificationChannel" /> if one is set.
|
/// in a guild's <see cref="GuildSettings.EventNotificationChannel" /> if one is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -104,16 +104,11 @@ public class UtilityService : IHostedService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the string mentioning all <see cref="GuildSettings.NotificationReceiver" />s related to a scheduled
|
/// Gets the string mentioning the <see cref="GuildSettings.EventNotificationRole"/> and event subscribers related to a scheduled
|
||||||
/// event.
|
/// event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
|
||||||
/// If the guild settings enables <see cref="GuildSettings.NotificationReceiver.Role" />, then the
|
|
||||||
/// <see cref="GuildSettings.EventNotificationRole" /> will also be mentioned.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="scheduledEvent">
|
/// <param name="scheduledEvent">
|
||||||
/// The scheduled event whose subscribers will be mentioned if the guild settings enables
|
/// The scheduled event whose subscribers will be mentioned.
|
||||||
/// <see cref="GuildSettings.NotificationReceiver.Interested" />.
|
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="settings">The settings of the guild containing the scheduled event</param>
|
/// <param name="settings">The settings of the guild containing the scheduled event</param>
|
||||||
/// <param name="ct">The cancellation token for this operation.</param>
|
/// <param name="ct">The cancellation token for this operation.</param>
|
||||||
|
|
Loading…
Add table
Reference in a new issue