mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Removed some unused classes, minor cleanup. Added rider anotations to stop some annoying code suggestions
This commit is contained in:
		@@ -1,10 +0,0 @@
 | 
				
			|||||||
namespace NadekoBot.Common.Attributes;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[AttributeUsage(AttributeTargets.Method)]
 | 
					 | 
				
			||||||
public sealed class DescriptionAttribute : SummaryAttribute
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    // Localization.LoadCommand(memberName.ToLowerInvariant()).Desc
 | 
					 | 
				
			||||||
    public DescriptionAttribute(string text = "") : base(text)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
namespace Discord.Commands;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class LeftoverAttribute : RemainderAttribute
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public LeftoverAttribute()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
namespace NadekoBot.Common.Attributes;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[AttributeUsage(AttributeTargets.Method)]
 | 
					 | 
				
			||||||
public sealed class UsageAttribute : RemarksAttribute
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    // public static string GetUsage(string memberName)
 | 
					 | 
				
			||||||
    // {
 | 
					 | 
				
			||||||
    //     var usage = Localization.LoadCommand(memberName.ToLowerInvariant()).Usage;
 | 
					 | 
				
			||||||
    //     return JsonConvert.SerializeObject(usage);
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    public UsageAttribute(string text = "") : base(text)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,74 +0,0 @@
 | 
				
			|||||||
using System.Collections;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace NadekoBot.Common.Collections;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public static class DisposableReadOnlyListExtensions
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public static IDisposableReadOnlyList<T> AsDisposable<T>(this IReadOnlyList<T> arr) where T : IDisposable
 | 
					 | 
				
			||||||
        => new DisposableReadOnlyList<T>(arr);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static IDisposableReadOnlyList<KeyValuePair<TKey, TValue>> AsDisposable<TKey, TValue>(this IReadOnlyList<KeyValuePair<TKey, TValue>> arr) where TValue : IDisposable
 | 
					 | 
				
			||||||
        => new DisposableReadOnlyList<TKey, TValue>(arr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IDisposableReadOnlyList<T> : IReadOnlyList<T>, IDisposable
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public sealed class DisposableReadOnlyList<T> : IDisposableReadOnlyList<T>
 | 
					 | 
				
			||||||
    where T : IDisposable
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    private readonly IReadOnlyList<T> _arr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int Count => _arr.Count;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public T this[int index] => _arr[index];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public DisposableReadOnlyList(IReadOnlyList<T> arr)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        this._arr = arr;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public IEnumerator<T> GetEnumerator()
 | 
					 | 
				
			||||||
        => _arr.GetEnumerator();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IEnumerator IEnumerable.GetEnumerator()
 | 
					 | 
				
			||||||
        => _arr.GetEnumerator();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void Dispose()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        foreach (var item in _arr)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            item.Dispose();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public sealed class DisposableReadOnlyList<T, U> : IDisposableReadOnlyList<KeyValuePair<T, U>>
 | 
					 | 
				
			||||||
    where U : IDisposable
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    private readonly IReadOnlyList<KeyValuePair<T, U>> _arr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int Count => _arr.Count;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    KeyValuePair<T, U> IReadOnlyList<KeyValuePair<T, U>>.this[int index] => _arr[index];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public DisposableReadOnlyList(IReadOnlyList<KeyValuePair<T, U>> arr)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        this._arr = arr;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public IEnumerator<KeyValuePair<T, U>> GetEnumerator() =>
 | 
					 | 
				
			||||||
        _arr.GetEnumerator();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IEnumerator IEnumerable.GetEnumerator() =>
 | 
					 | 
				
			||||||
        _arr.GetEnumerator();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void Dispose()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        foreach (var item in _arr)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            item.Value.Dispose();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -2,6 +2,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace NadekoBot.Modules;
 | 
					namespace NadekoBot.Modules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[UsedImplicitly(ImplicitUseTargetFlags.Default
 | 
				
			||||||
 | 
					                | ImplicitUseTargetFlags.WithInheritors
 | 
				
			||||||
 | 
					                | ImplicitUseTargetFlags.WithMembers)]
 | 
				
			||||||
public abstract class NadekoModule : ModuleBase
 | 
					public abstract class NadekoModule : ModuleBase
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected CultureInfo _cultureInfo { get; set; }
 | 
					    protected CultureInfo _cultureInfo { get; set; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,6 @@ public class NadekoContext : DbContext
 | 
				
			|||||||
    public DbSet<RotatingPlayingStatus> RotatingStatus { get; set; }
 | 
					    public DbSet<RotatingPlayingStatus> RotatingStatus { get; set; }
 | 
				
			||||||
    public DbSet<BlacklistEntry> Blacklist { get; set; }
 | 
					    public DbSet<BlacklistEntry> Blacklist { get; set; }
 | 
				
			||||||
    public DbSet<AutoCommand> AutoCommands { get; set; } 
 | 
					    public DbSet<AutoCommand> AutoCommands { get; set; } 
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    public DbSet<RewardedUser> RewardedUsers { get; set; }
 | 
					    public DbSet<RewardedUser> RewardedUsers { get; set; }
 | 
				
			||||||
    public DbSet<PlantedCurrency> PlantedCurrency { get; set; }
 | 
					    public DbSet<PlantedCurrency> PlantedCurrency { get; set; }
 | 
				
			||||||
    public DbSet<BanTemplate> BanTemplates { get; set; }
 | 
					    public DbSet<BanTemplate> BanTemplates { get; set; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,5 +16,8 @@ global using Discord.WebSocket;
 | 
				
			|||||||
global using GuildPerm = Discord.GuildPermission;
 | 
					global using GuildPerm = Discord.GuildPermission;
 | 
				
			||||||
global using ChannelPerm = Discord.ChannelPermission;
 | 
					global using ChannelPerm = Discord.ChannelPermission;
 | 
				
			||||||
global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute;
 | 
					global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute;
 | 
				
			||||||
 | 
					global using LeftoverAttribute = Discord.Commands.RemainderAttribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
global using System.Collections.Concurrent;
 | 
					global using System.Collections.Concurrent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					global using JetBrains.Annotations;
 | 
				
			||||||
@@ -28,7 +28,6 @@ public partial class Administration
 | 
				
			|||||||
            if (input.Length % 2 != 0)
 | 
					            if (input.Length % 2 != 0)
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var grp = 0;
 | 
					 | 
				
			||||||
            var results = input
 | 
					            var results = input
 | 
				
			||||||
                .Chunk(input.Length / 2)
 | 
					                .Chunk(input.Length / 2)
 | 
				
			||||||
                .Select(async x =>
 | 
					                .Select(async x =>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ public partial class Searches
 | 
				
			|||||||
                    fs.Type));
 | 
					                    fs.Type));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
					        [NadekoCommand, Aliases]
 | 
				
			||||||
        [RequireContext(ContextType.Guild)]
 | 
					        [RequireContext(ContextType.Guild)]
 | 
				
			||||||
        [UserPerm(GuildPerm.Administrator)]
 | 
					        [UserPerm(GuildPerm.Administrator)]
 | 
				
			||||||
        public async Task StreamsClear()
 | 
					        public async Task StreamsClear()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,6 +54,7 @@
 | 
				
			|||||||
    <PackageReference Include="YamlDotNet" Version="11.2.1" />
 | 
					    <PackageReference Include="YamlDotNet" Version="11.2.1" />
 | 
				
			||||||
    <PackageReference Include="linq2db.EntityFrameworkCore" Version="6.6.1" />
 | 
					    <PackageReference Include="linq2db.EntityFrameworkCore" Version="6.6.1" />
 | 
				
			||||||
    <PackageReference Include="Humanizer" Version="2.13.14" />
 | 
					    <PackageReference Include="Humanizer" Version="2.13.14" />
 | 
				
			||||||
 | 
					    <PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user