diff --git a/src/NadekoBot/Db/Models/GuildColors.cs b/src/NadekoBot/Db/Models/GuildColors.cs new file mode 100644 index 000000000..3c0cc48b3 --- /dev/null +++ b/src/NadekoBot/Db/Models/GuildColors.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; + +namespace NadekoBot.Db.Models; + +public class GuildColors +{ + [Key] + public ulong GuildId { get; set; } + + [Length(0, 9)] + public string? OkColor { get; set; } + + [Length(0, 9)] + public string? ErrorColor { get; set; } + + [Length(0, 9)] + public string? PendingColor { get; set; } +} \ No newline at end of file diff --git a/src/NadekoBot/Db/NadekoContext.cs b/src/NadekoBot/Db/NadekoContext.cs index e4a379ed1..8fbfee28e 100644 --- a/src/NadekoBot/Db/NadekoContext.cs +++ b/src/NadekoBot/Db/NadekoContext.cs @@ -62,6 +62,9 @@ public abstract class NadekoContext : DbContext public DbSet Todos { get; set; } public DbSet TodosArchive { get; set; } + + // todo add guild colors + // public DbSet GuildColors { get; set; } #region Mandatory Provider-Specific Values diff --git a/src/NadekoBot/Modules/Utility/GuildColors.cs b/src/NadekoBot/Modules/Utility/GuildColors.cs new file mode 100644 index 000000000..ce323cb0c --- /dev/null +++ b/src/NadekoBot/Modules/Utility/GuildColors.cs @@ -0,0 +1,39 @@ +using NadekoBot.Db.Models; + +namespace NadekoBot.Modules.Utility; + +public interface IGuildColorsService +{ + +} + +public sealed class GuildColorsService : IGuildColorsService, INService +{ + private readonly DbService _db; + + public GuildColorsService(DbService db) + { + _db = db; + } + + public async Task GetGuildColors(ulong guildId) + { + // get from database and cache it with linq2db + + await using var ctx = _db.GetDbContext(); + + return null; + // return await ctx + // .GuildColors + // .FirstOrDefaultAsync(x => x.GuildId == guildId); + + } +} + +public partial class Utility +{ + public class GuildColorsCommands : NadekoModule + { + + } +} \ No newline at end of file diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index 9c5fb2f55..3ceab771a 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -133,6 +133,10 @@ + + + + false