mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	Started work on guild embed colors
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/NadekoBot/Db/Models/GuildColors.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/NadekoBot/Db/Models/GuildColors.cs
									
									
									
									
									
										Normal file
									
								
							@@ -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; }
 | 
			
		||||
}
 | 
			
		||||
@@ -62,6 +62,9 @@ public abstract class NadekoContext : DbContext
 | 
			
		||||
    
 | 
			
		||||
    public DbSet<TodoModel> Todos { get; set; }
 | 
			
		||||
    public DbSet<ArchivedTodoListModel> TodosArchive { get; set; }
 | 
			
		||||
    
 | 
			
		||||
    // todo add guild colors
 | 
			
		||||
    // public DbSet<GuildColors> GuildColors { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    #region Mandatory Provider-Specific Values
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								src/NadekoBot/Modules/Utility/GuildColors.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/NadekoBot/Modules/Utility/GuildColors.cs
									
									
									
									
									
										Normal file
									
								
							@@ -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<GuildColors?> 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<IGuildColorsService>
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -133,6 +133,10 @@
 | 
			
		||||
        </None>
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
      <Folder Include="Modules\Utility\GuildColors\" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <PropertyGroup Condition=" '$(Configuration)' == 'GlobalNadeko' ">
 | 
			
		||||
        <!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->
 | 
			
		||||
        <DefineTrace>false</DefineTrace>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user