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 NadekoBot.Modules.Xp.Services;
#nullable disable
using NadekoBot.Modules.Xp.Services;
namespace NadekoBot.Modules.Xp;
@@ -80,7 +81,7 @@ public partial class Xp
[Priority(1)]
public async Task ClubInformation(IUser user = null)
{
user = user ?? ctx.User;
user ??= ctx.User;
var club = _service.GetClubByMember(user);
if (club is null)
{
@@ -368,4 +369,4 @@ public partial class Xp
return ctx.Channel.EmbedAsync(embed);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using NadekoBot.Db.Models;
namespace NadekoBot.Modules.Xp;
@@ -22,4 +23,4 @@ public class FullUserStats
GuildRanking = guildRanking;
FullGuildStats = fullGuildStats;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Xp.Services;
#nullable disable
using NadekoBot.Modules.Xp.Services;
namespace NadekoBot.Modules.Xp;
@@ -36,4 +37,4 @@ public class LevelStats
LevelXp = xp - totalXp;
RequiredXp = required;
}
}
}

View File

@@ -1,4 +1,5 @@
using Cloneable;
#nullable disable
using Cloneable;
using NadekoBot.Common.Yml;
namespace NadekoBot.Modules.Xp;
@@ -23,4 +24,4 @@ public sealed partial class XpConfig : ICloneable<XpConfig>
[Comment(@"The maximum amount of minutes the bot will keep track of a user in a voice channel")]
public int VoiceMaxMinutes { get; set; } = 720;
}
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
#nullable disable
using Newtonsoft.Json;
using SixLabors.ImageSharp.PixelFormats;
namespace NadekoBot.Modules.Xp;
@@ -287,4 +288,4 @@ public class XpRgba32Converter : JsonConverter<Rgba32>
public override void WriteJson(JsonWriter writer, Rgba32 value, JsonSerializer serializer)
=> writer.WriteValue(value.ToHex().ToLowerInvariant());
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Xp.Services;
#nullable disable
using NadekoBot.Modules.Xp.Services;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Modules.Xp.Extensions;
@@ -25,4 +26,4 @@ public static class Extensions
return (lvl - 1, stats.Xp - totalXp, required);
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Xp.Services;
#nullable disable
using NadekoBot.Modules.Xp.Services;
namespace NadekoBot.Modules.Xp;
@@ -47,4 +48,4 @@ public partial class Xp
await ReplyConfirmLocalizedAsync(strs.reset_server).ConfigureAwait(false);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Db.Models;
#nullable disable
using NadekoBot.Db.Models;
using NadekoBot.Db;
namespace NadekoBot.Modules.Xp.Services;
@@ -331,4 +332,4 @@ public class ClubService : INService
using var uow = _db.GetDbContext();
return uow.Clubs.GetClubLeaderboardPage(page);
}
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Xp.Services;
#nullable disable
namespace NadekoBot.Modules.Xp.Services;
public class UserCacheItem
{
@@ -12,4 +13,4 @@ public class UserCacheItem
public override bool Equals(object obj)
=> obj is UserCacheItem uci && uci.User == User;
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.Configs;
#nullable disable
using NadekoBot.Common.Configs;
namespace NadekoBot.Modules.Xp.Services;
@@ -37,4 +38,4 @@ public sealed class XpConfigService : ConfigServiceBase<XpConfig>
});
}
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
using NadekoBot.Db.Models;
using Newtonsoft.Json;
using SixLabors.Fonts;
@@ -1158,4 +1159,4 @@ public class XpService : INService
uow.RemoveRange(guildConfig.XpSettings.CurrencyRewards);
await uow.SaveChangesAsync();
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using NadekoBot.Modules.Xp.Services;
using NadekoBot.Modules.Gambling.Services;
@@ -19,7 +20,7 @@ public partial class Xp : NadekoModule<XpService>
[RequireContext(ContextType.Guild)]
public async Task Experience([Leftover] IUser user = null)
{
user = user ?? ctx.User;
user ??= ctx.User;
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
var (img, fmt) = await _service.GenerateXpImageAsync((IGuildUser)user).ConfigureAwait(false);
await using (img)
@@ -434,4 +435,4 @@ public partial class Xp : NadekoModule<XpService>
await Task.Delay(1000).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.template_reloaded).ConfigureAwait(false);
}
}
}