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 Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Db.Models;
namespace NadekoBot.Db;
@@ -33,4 +34,4 @@ public static class ClubExtensions
public static List<ClubInfo> GetClubLeaderboardPage(this DbSet<ClubInfo> clubs, int page)
=> clubs.AsNoTracking().OrderByDescending(x => x.Xp).Skip(page * 9).Take(9).ToList();
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db;
@@ -13,4 +14,4 @@ public static class CurrencyTransactionExtensions
.Skip(15 * page)
.Take(15)
.ToList();
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using LinqToDB;
using NadekoBot.Services.Database.Models;
@@ -14,4 +15,4 @@ public static class CustomReactionsExtensions
public static CustomReaction GetByGuildIdAndInput(this DbSet<CustomReaction> crs, ulong? guildId, string input)
=> crs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db;
@@ -8,4 +9,4 @@ public static class DbExtensions
public static T GetById<T>(this DbSet<T> set, int id)
where T : DbEntity
=> set.FirstOrDefault(x => x.Id == id);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Db.Models;
#nullable disable
using NadekoBot.Db.Models;
using Microsoft.EntityFrameworkCore;
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
@@ -185,4 +186,4 @@ VALUES ({userId}, {name}, {discrim}, {avatarId}, {amount}, 0);
.OrderByDescending(x => x.CurrencyAmount)
.Take(users.Count() / 100 == 0 ? 1 : users.Count() / 100)
.Sum(x => x.CurrencyAmount);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database;
using NadekoBot.Db.Models;
@@ -201,4 +202,4 @@ public static class GuildConfigExtensions
.SelectMany(x => x.GenerateCurrencyChannelIds)
.Select(x => new GeneratingChannel() { ChannelId = x.ChannelId, GuildId = x.GuildConfig.GuildId })
.ToArray();
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db;
@@ -20,4 +21,4 @@ public static class MusicPlayerSettingsExtensions
return toReturn;
}
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db;
@@ -20,4 +21,4 @@ public static class MusicPlaylistExtensions
public static MusicPlaylist GetWithSongs(this DbSet<MusicPlaylist> playlists, int id)
=> playlists.Include(mpl => mpl.Songs)
.FirstOrDefault(mpl => mpl.Id == id);
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database;
using NadekoBot.Services.Database.Models;
@@ -34,4 +35,4 @@ public static class PollExtensions
ctx.Poll.Remove(p);
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -60,4 +61,4 @@ public static class QuoteExtensions
=> quotes.RemoveRange(quotes.AsQueryable()
.Where(x => x.GuildId == guildId && x.Keyword.ToUpper() == keyword)
);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Db;
@@ -25,4 +26,4 @@ public static class ReminderExtensions
.OrderBy(x => x.DateAdded)
.Skip(page * 10)
.Take(10);
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Db;
@@ -20,4 +21,4 @@ public static class SelfAssignableRolesExtensions
=> roles.AsQueryable()
.Where(s => s.GuildId == guildId)
.ToArray();
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using LinqToDB;
using NadekoBot.Services.Database;
using NadekoBot.Services.Database.Models;
@@ -64,4 +65,4 @@ public static class UserXpExtensions
public static void ResetGuildXp(this DbSet<UserXpStats> xps, ulong guildId)
=> xps.Delete(x => x.GuildId == guildId);
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db.Models;
@@ -143,4 +144,4 @@ VALUES ({null}, {null}, {1}, (SELECT Id FROM DiscordUser WHERE UserId={userId}))
return toReturn;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Db;
@@ -60,4 +61,4 @@ public static class WarningExtensions
=> warnings.AsQueryable()
.Where(x => x.GuildId == id)
.ToArray();
}
}