NadekoBot.Extensions should now be fully annotated with nullable reference types as well as many classes from NadekoBot.Common

This commit is contained in:
Kwoth
2021-12-28 10:44:00 +01:00
parent 0634470a8a
commit 59f5056035
543 changed files with 1895 additions and 1448 deletions

View File

@@ -1,4 +1,5 @@
using System.Reflection;
#nullable disable
using System.Reflection;
namespace NadekoBot.Modules.Utility;
@@ -51,4 +52,4 @@ public partial class Utility
await SendConfirmAsync(GetText(strs.calcops(Prefix)), string.Join(", ", selection));
}
}
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db;
using NadekoBot.Modules.Utility.Services;
@@ -133,4 +134,4 @@ public partial class Utility
}, arr.Length, 10).ConfigureAwait(false);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
#nullable disable
using System.Diagnostics;
namespace NadekoBot.Modules.Utility.Common;
@@ -8,4 +9,4 @@ public class ConvertUnit
public string[] Triggers { get; set; }
public string UnitType { get; set; }
public decimal Modifier { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Utility.Common.Exceptions;
#nullable disable
namespace NadekoBot.Modules.Utility.Common.Exceptions;
public class StreamRoleNotFoundException : Exception
{
@@ -13,4 +14,4 @@ public class StreamRoleNotFoundException : Exception
public StreamRoleNotFoundException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Utility.Common.Exceptions;
#nullable disable
namespace NadekoBot.Modules.Utility.Common.Exceptions;
public class StreamRolePermissionException : Exception
{
@@ -13,4 +14,4 @@ public class StreamRolePermissionException : Exception
public StreamRolePermissionException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
#nullable disable
using System.Text.Json.Serialization;
namespace NadekoBot.Modules.Utility.Common.Patreon;
@@ -128,4 +129,4 @@ public sealed class PatreonUserData
{
[JsonPropertyName("id")]
public string Id { get; set; }
}
}

View File

@@ -1,7 +1,8 @@
namespace NadekoBot.Modules.Utility.Common;
#nullable disable
namespace NadekoBot.Modules.Utility.Common;
public enum StreamRoleListType
{
Whitelist,
Blacklist,
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Utility;
#nullable disable
namespace NadekoBot.Modules.Utility;
public partial class Utility
{
@@ -154,4 +155,4 @@ public partial class Utility
return Format.Code(string.Concat(strings), "hs");
}
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
using System.Text;
namespace NadekoBot.Modules.Utility;
@@ -144,4 +145,4 @@ public partial class Utility
.WithDescription(str.ToString())).ConfigureAwait(false);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Utility.Services;
#nullable disable
using NadekoBot.Modules.Utility.Services;
namespace NadekoBot.Modules.Utility;
@@ -94,4 +95,4 @@ public partial class Utility
await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code))));
}
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
using NadekoBot.Common.Yml;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db;
@@ -374,4 +375,4 @@ public partial class Utility
return true;
}
}
}
}

View File

@@ -1,4 +1,5 @@
using Humanizer.Localisation;
#nullable disable
using Humanizer.Localisation;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db;
using NadekoBot.Modules.Administration.Services;
@@ -240,4 +241,4 @@ public partial class Utility
return true;
}
}
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using NadekoBot.Common.TypeReaders;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Utility.Services;
using NadekoBot.Common.TypeReaders.Models;
@@ -196,4 +195,4 @@ public partial class Utility
return description;
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.ModuleBehaviors;
#nullable disable
using NadekoBot.Common.ModuleBehaviors;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db;
@@ -92,4 +93,4 @@ public class CommandMapService : IInputTransformer, INService
return input;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Utility.Common;
#nullable disable
using NadekoBot.Modules.Utility.Common;
using Newtonsoft.Json;
namespace NadekoBot.Modules.Utility.Services;
@@ -83,4 +84,4 @@ public class Rates
public DateTime Date { get; set; }
[JsonProperty("rates")]
public Dictionary<string, decimal> ConversionRates { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using CommandLine;
#nullable disable
using CommandLine;
namespace NadekoBot.Modules.Utility.Services;
@@ -27,4 +28,4 @@ public class InviteService : INService
Expire = 0;
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using NadekoBot.Modules.Utility.Common.Patreon;
using System.Net.Http.Json;
using System.Text.Json.Serialization;
@@ -302,4 +303,4 @@ public class PatreonRewardsService : INService
// ignored
}
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
#nullable disable
using System.Text.RegularExpressions;
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -165,4 +166,4 @@ public class RemindService : INService
}
catch (Exception ex) { Log.Information(ex.Message + $"({r.Id})"); }
}
}
}

View File

@@ -1,4 +1,4 @@
#nullable enable

using Microsoft.EntityFrameworkCore;
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
@@ -418,4 +418,4 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};")
public bool IsNoRedundant(int repeaterId)
=> _noRedundant.Contains(repeaterId);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Modules.Utility.Services;
@@ -95,4 +96,4 @@ public sealed class RunningRepeater
public override int GetHashCode()
=> this.Repeater.Id;
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Utility.Common;
using NadekoBot.Modules.Utility.Common.Exceptions;
@@ -266,7 +267,7 @@ public class StreamRoleService : INService
{
try
{
addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
addRole ??= user.Guild.GetRole(setting.AddRoleId);
if (addRole is null)
throw new StreamRoleNotFoundException();
@@ -305,4 +306,4 @@ public class StreamRoleService : INService
private void UpdateCache(ulong guildId, StreamRoleSettings setting)
=> guildSettings.AddOrUpdate(guildId, key => setting, (key, old) => setting);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Help.Services;
#nullable disable
using NadekoBot.Modules.Help.Services;
using NadekoBot.Db;
namespace NadekoBot.Modules.Utility.Services;
@@ -63,4 +64,4 @@ public class VerboseErrorsService : INService
return (bool)enabled;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Utility.Services;
#nullable disable
using NadekoBot.Modules.Utility.Services;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Utility.Common;
@@ -85,4 +86,4 @@ public partial class Utility
await ReplyErrorLocalizedAsync(strs.stream_role_wl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Utility.Services;
#nullable disable
using NadekoBot.Modules.Utility.Services;
namespace NadekoBot.Modules.Utility;
@@ -63,7 +64,7 @@ public partial class Utility
switch (targetUnit.Triggers.First().ToUpperInvariant())
{
case "C":
res = res - 273.15m; //celcius!
res -= 273.15m; //celcius!
break;
case "F":
res = (res * (9m / 5m)) - 459.67m;
@@ -84,4 +85,4 @@ public partial class Utility
await SendConfirmAsync(GetText(strs.convert(value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last())));
}
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
using Newtonsoft.Json;
using System.Diagnostics;
using System.Text;
@@ -498,4 +499,4 @@ public partial class Utility : NadekoModule
// return embed;
// }, inviteUsers.Count, 9);
// }
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Utility.Services;
#nullable disable
using NadekoBot.Modules.Utility.Services;
namespace NadekoBot.Modules.Utility;
@@ -20,4 +21,4 @@ public partial class Utility
await ReplyConfirmLocalizedAsync(strs.verbose_errors_disabled).ConfigureAwait(false);
}
}
}
}