mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Added Bot propety for easy access to the ISelfUser to all medusa *Context types
This commit is contained in:
		@@ -5,9 +5,11 @@ public sealed class DmContextAdapter : DmContext
 | 
			
		||||
    public override IMedusaStrings Strings { get; }
 | 
			
		||||
    public override IDMChannel Channel { get; }
 | 
			
		||||
    public override IUserMessage Message { get; }
 | 
			
		||||
    public override ISelfUser Bot { get; }
 | 
			
		||||
    public override IUser User
 | 
			
		||||
        => Message.Author;
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    private readonly IServiceProvider _services;
 | 
			
		||||
    private readonly Lazy<IEmbedBuilderService> _ebs;
 | 
			
		||||
    private readonly Lazy<IBotStrings> _botStrings;
 | 
			
		||||
@@ -26,6 +28,7 @@ public sealed class DmContextAdapter : DmContext
 | 
			
		||||
 | 
			
		||||
        Channel = ch;
 | 
			
		||||
        Message = ctx.Message;
 | 
			
		||||
        Bot = ctx.Client.CurrentUser;
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        _ebs = new(_services.GetRequiredService<IEmbedBuilderService>());
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ public sealed class GuildContextAdapter : GuildContext
 | 
			
		||||
    public override IMedusaStrings Strings { get; }
 | 
			
		||||
    public override IGuild Guild { get; }
 | 
			
		||||
    public override ITextChannel Channel { get; }
 | 
			
		||||
    public override ISelfUser Bot { get; }
 | 
			
		||||
    public override IUserMessage Message
 | 
			
		||||
        => _ctx.Message;
 | 
			
		||||
 | 
			
		||||
@@ -28,6 +29,7 @@ public sealed class GuildContextAdapter : GuildContext
 | 
			
		||||
 | 
			
		||||
        Strings = strings;
 | 
			
		||||
        User = (IGuildUser)ctx.User;
 | 
			
		||||
        Bot = ctx.Client.CurrentUser;
 | 
			
		||||
 | 
			
		||||
        _services = services;
 | 
			
		||||
        _ebs = new(_services.GetRequiredService<IEmbedBuilderService>());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user