Namespace changes to make them make sense

This commit is contained in:
Kwoth
2024-04-27 22:45:14 +00:00
parent e963ffeaab
commit 4bab94b329
69 changed files with 59 additions and 78 deletions

View File

@@ -19,7 +19,7 @@ EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NadekoBot", "src\NadekoBot\NadekoBot.csproj", "{45EC1473-C678-4857-A544-07DFE0D0B478}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NadekoBot", "src\NadekoBot\NadekoBot.csproj", "{45EC1473-C678-4857-A544-07DFE0D0B478}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Voice", "src\ayu\NadekoBot.Voice\NadekoBot.Voice.csproj", "{2F4CF6D6-0C2F-4944-B204-9508CDA53195}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Voice", "src\NadekoBot.Voice\NadekoBot.Voice.csproj", "{2F4CF6D6-0C2F-4944-B204-9508CDA53195}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Tests", "src\NadekoBot.Tests\NadekoBot.Tests.csproj", "{DB448DD4-C97F-40E9-8BD3-F605FF1FF833}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Tests", "src\NadekoBot.Tests\NadekoBot.Tests.csproj", "{DB448DD4-C97F-40E9-8BD3-F605FF1FF833}"
EndProject EndProject

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Overridden to implement custom checks which commands have to pass in order to be executed. /// Overridden to implement custom checks which commands have to pass in order to be executed.

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Used as a marker class for bot_perm and user_perm Attributes /// Used as a marker class for bot_perm and user_perm Attributes

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
[AttributeUsage(AttributeTargets.Method)] [AttributeUsage(AttributeTargets.Method)]
public sealed class bot_owner_onlyAttribute : MedusaPermAttribute public sealed class bot_owner_onlyAttribute : MedusaPermAttribute

View File

@@ -1,6 +1,6 @@
using Discord; using Discord;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class bot_permAttribute : MedusaPermAttribute public sealed class bot_permAttribute : MedusaPermAttribute

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Marks a method as a snek command /// Marks a method as a snek command

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Marks services in command arguments for injection. /// Marks services in command arguments for injection.

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Marks the parameter to take /// Marks the parameter to take

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Sets the priority of a command in case there are multiple commands with the same name but different parameters. /// Sets the priority of a command in case there are multiple commands with the same name but different parameters.

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Marks the class as a service which can be used within the same Medusa /// Marks the class as a service which can be used within the same Medusa

View File

@@ -1,6 +1,6 @@
using Discord; using Discord;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class user_permAttribute : MedusaPermAttribute public sealed class user_permAttribute : MedusaPermAttribute

View File

@@ -1,7 +1,7 @@
using Discord; using Discord;
using NadekoBot; using NadekoBot;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Commands which take this class as a first parameter can be executed in both DMs and Servers /// Commands which take this class as a first parameter can be executed in both DMs and Servers

View File

@@ -1,6 +1,6 @@
using Discord; using Discord;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Commands which take this type as the first parameter can only be executed in DMs /// Commands which take this type as the first parameter can only be executed in DMs

View File

@@ -1,6 +1,6 @@
using Discord; using Discord;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Commands which take this type as a first parameter can only be executed in a server /// Commands which take this type as a first parameter can only be executed in a server

View File

@@ -1,4 +1,4 @@
namespace NadekoBot; namespace NadekoBot.Medusa;
public static class EmbedBuilderExtensions public static class EmbedBuilderExtensions
{ {

View File

@@ -1,7 +1,6 @@
using Discord; using Discord;
using Nadeko.Snake;
namespace NadekoBot; namespace NadekoBot.Medusa;
public static class MedusaExtensions public static class MedusaExtensions
{ {

View File

@@ -15,6 +15,6 @@
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Version)' == '' "> <PropertyGroup Condition=" '$(Version)' == '' ">
<Version>6.0.0</Version> <Version>9.0.0</Version>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Overridden to implement parsers for custom types /// Overridden to implement parsers for custom types

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
public readonly struct ParseResult<T> public readonly struct ParseResult<T>
{ {

View File

@@ -1,6 +1,6 @@
using Discord; using Discord;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// The base class which will be loaded as a module into NadekoBot /// The base class which will be loaded as a module into NadekoBot

View File

@@ -1,6 +1,6 @@
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
public readonly struct CommandStrings public readonly struct CommandStrings
{ {

View File

@@ -1,6 +1,6 @@
using System.Globalization; using System.Globalization;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Defines methods to retrieve and reload medusa strings /// Defines methods to retrieve and reload medusa strings

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Implemented by classes which provide localized strings in their own ways /// Implemented by classes which provide localized strings in their own ways

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
public class LocalMedusaStringsProvider : IMedusaStringsProvider public class LocalMedusaStringsProvider : IMedusaStringsProvider
{ {

View File

@@ -1,7 +1,7 @@
using System.Globalization; using System.Globalization;
using Serilog; using Serilog;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
public class MedusaStrings : IMedusaStrings public class MedusaStrings : IMedusaStrings
{ {

View File

@@ -2,7 +2,7 @@
using Serilog; using Serilog;
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
namespace Nadeko.Snake; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Loads strings from the shortcut or localizable path /// Loads strings from the shortcut or localizable path

View File

@@ -12,7 +12,6 @@ global using Nadeko.Common; // new project
global using NadekoBot.Common; // old + nadekobot specific things global using NadekoBot.Common; // old + nadekobot specific things
global using NadekoBot.Common.Attributes; global using NadekoBot.Common.Attributes;
global using NadekoBot.Extensions; global using NadekoBot.Extensions;
// global using Nadeko.Snake;
// discord // discord
global using Discord; global using Discord;

View File

@@ -118,7 +118,7 @@ public class CryptoService : INService
var nearest = cryptos var nearest = cryptos
.Select(elem => (Elem: elem, .Select(elem => (Elem: elem,
Distance: StringExtensions.LevenshteinDistance(elem.Name.ToUpperInvariant(), name))) Distance: elem.Name.ToUpperInvariant().LevenshteinDistance(name)))
.OrderBy(x => x.Distance) .OrderBy(x => x.Distance)
.FirstOrDefault(x => x.Distance <= 2); .FirstOrDefault(x => x.Distance <= 2);

View File

@@ -94,8 +94,7 @@ public sealed class ImagesharpStockChartDrawingService : IStockChartDrawingServi
=> image.Mutate(ctx => => image.Mutate(ctx =>
{ {
foreach (var data in drawData) foreach (var data in drawData)
DrawLineExtensions.DrawLines(ctx, ctx.DrawLines(data.IsGreen
data.IsGreen
? _greenBrush ? _greenBrush
: _redBrush, : _redBrush,
1, 1,
@@ -104,8 +103,7 @@ public sealed class ImagesharpStockChartDrawingService : IStockChartDrawingServi
foreach (var data in drawData) foreach (var data in drawData)
FillRectangleExtensions.Fill(ctx, ctx.Fill(data.IsGreen
data.IsGreen
? _greenBrush ? _greenBrush
: _redBrush, : _redBrush,
data.BodyRect); data.BodyRect);

View File

@@ -3,6 +3,7 @@ using Humanizer.Localisation;
using NadekoBot.Db; using NadekoBot.Db;
using NadekoBot.Modules.Utility.Services; using NadekoBot.Modules.Utility.Services;
using NadekoBot.Db.Models; using NadekoBot.Db.Models;
using System.Resources;
namespace NadekoBot.Modules.Utility; namespace NadekoBot.Modules.Utility;
@@ -43,7 +44,7 @@ public partial class Utility
await ReplyErrorLocalizedAsync(strs.remind_invalid); await ReplyErrorLocalizedAsync(strs.remind_invalid);
return; return;
} }
ulong target; ulong target;
target = meorhere == MeOrHere.Me ? ctx.User.Id : ctx.Channel.Id; target = meorhere == MeOrHere.Me ? ctx.User.Id : ctx.Channel.Id;
if (!await RemindInternal(target, if (!await RemindInternal(target,

View File

@@ -5,7 +5,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<Version>5.0.0</Version> <Version>5.0.0</Version>
<VersionSuffix>beta1</VersionSuffix>
<!-- Output/build --> <!-- Output/build -->
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory> <RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
@@ -76,7 +75,7 @@
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" /> <PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" /> <PackageReference Include="StackExchange.Redis" Version="2.7.33" />
<PackageReference Include="YamlDotNet" Version="15.1.2" /> <PackageReference Include="YamlDotNet" Version="15.1.2" />
<PackageReference Include="SharpToken" Version="1.2.14" /> <PackageReference Include="SharpToken" Version="2.0.2" />
<PackageReference Include="Humanizer" Version="2.14.1"> <PackageReference Include="Humanizer" Version="2.14.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
@@ -110,9 +109,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ayu\NadekoBot.Voice\NadekoBot.Voice.csproj" />
<ProjectReference Include="..\Nadeko.Medusa\Nadeko.Medusa.csproj" /> <ProjectReference Include="..\Nadeko.Medusa\Nadeko.Medusa.csproj" />
<ProjectReference Include="..\NadekoBot.Voice\NadekoBot.Voice.csproj" />
<ProjectReference Include="..\NadekoBot.Generators\NadekoBot.Generators.csproj" OutputItemType="Analyzer" /> <ProjectReference Include="..\NadekoBot.Generators\NadekoBot.Generators.csproj" OutputItemType="Analyzer" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -133,16 +131,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="data\medusae\" />
<Folder Include="_common\Extensions\" />
</ItemGroup>
<!-- <PropertyGroup Condition=" '$(Version)' == '' ">-->
<!-- <VersionPrefix Condition=" '$(VersionPrefix)' == '' ">5.0.0</VersionPrefix>-->
<!-- <Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix).$(VersionSuffix)</Version>-->
<!-- <Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>-->
<!-- </PropertyGroup>-->
<PropertyGroup Condition=" '$(Configuration)' == 'GlobalNadeko' "> <PropertyGroup Condition=" '$(Configuration)' == 'GlobalNadeko' ">
<!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)--> <!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->

View File

@@ -1,3 +1,6 @@
using Humanizer.Localisation;
using System.Resources;
var pid = Environment.ProcessId; var pid = Environment.ProcessId;
var shardId = 0; var shardId = 0;

View File

@@ -28,7 +28,7 @@ public class YamlSeria : IConfigSeria
me => me =>
{ {
var str = me.Groups["code"].Value; var str = me.Groups["code"].Value;
var newString = YamlHelper.UnescapeUnicodeCodePoint(str); var newString = str.UnescapeUnicodeCodePoint();
return newString; return newString;
}); });
return output; return output;

View File

@@ -131,7 +131,7 @@ public static class StringExtensions
me => me =>
{ {
var str = me.Groups["code"].Value; var str = me.Groups["code"].Value;
var newString = YamlHelper.UnescapeUnicodeCodePoint(str); var newString = str.UnescapeUnicodeCodePoint();
return newString; return newString;
}); });
} }

View File

@@ -1,6 +1,4 @@
#nullable enable using NadekoBot.Medusa;
using Nadeko.Snake;
[DIIgnore] [DIIgnore]
public sealed class BehaviorAdapter : ICustomBehavior public sealed class BehaviorAdapter : ICustomBehavior

View File

@@ -1,4 +1,4 @@
using Nadeko.Snake; using NadekoBot.Medusa;
internal class ContextAdapterFactory internal class ContextAdapterFactory
{ {

View File

@@ -1,5 +1,5 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Nadeko.Snake; using NadekoBot.Medusa;
public sealed class DmContextAdapter : DmContext public sealed class DmContextAdapter : DmContext
{ {

View File

@@ -1,4 +1,4 @@
using Nadeko.Snake; using NadekoBot.Medusa;
namespace Nadeko.Medusa.Adapters; namespace Nadeko.Medusa.Adapters;

View File

@@ -1,5 +1,5 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Nadeko.Snake; using NadekoBot.Medusa;
public sealed class GuildContextAdapter : GuildContext public sealed class GuildContextAdapter : GuildContext
{ {

View File

@@ -1,4 +1,4 @@
using Nadeko.Snake; using NadekoBot.Medusa;
public sealed class ParamParserAdapter<T> : TypeReader public sealed class ParamParserAdapter<T> : TypeReader
{ {

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
/// <summary> /// <summary>
/// Enum specifying in which context the command can be executed /// Enum specifying in which context the command can be executed

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public interface IMedusaConfigService public interface IMedusaConfigService
{ {

View File

@@ -2,7 +2,7 @@
using Cloneable; using Cloneable;
using NadekoBot.Common.Yml; using NadekoBot.Common.Yml;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
[Cloneable] [Cloneable]
public sealed partial class MedusaConfig : ICloneable<MedusaConfig> public sealed partial class MedusaConfig : ICloneable<MedusaConfig>

View File

@@ -1,6 +1,6 @@
using NadekoBot.Common.Configs; using NadekoBot.Common.Configs;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedusaConfigService public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedusaConfigService
{ {

View File

@@ -1,7 +1,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.Loader; using System.Runtime.Loader;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public class MedusaAssemblyLoadContext : AssemblyLoadContext public class MedusaAssemblyLoadContext : AssemblyLoadContext
{ {

View File

@@ -1,5 +1,4 @@
using Nadeko.Snake; using System.Reflection;
using System.Reflection;
using Ninject; using Ninject;
using Ninject.Activation; using Ninject.Activation;
using Ninject.Activation.Caching; using Ninject.Activation.Caching;
@@ -7,7 +6,7 @@ using Ninject.Modules;
using Ninject.Planning; using Ninject.Planning;
using System.Text.Json; using System.Text.Json;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public sealed class MedusaNinjectModule : NinjectModule public sealed class MedusaNinjectModule : NinjectModule
{ {

View File

@@ -10,9 +10,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Nadeko.Snake;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
// ReSharper disable RedundantAssignment // ReSharper disable RedundantAssignment
public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor, INService public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor, INService

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public sealed record ParamData( public sealed record ParamData(
Type Type, Type Type,

View File

@@ -1,8 +1,8 @@
using Nadeko.Snake; using NadekoBot.Medusa;
using Ninject.Modules; using Ninject.Modules;
using System.Collections.Immutable; using System.Collections.Immutable;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public sealed record ResolvedMedusa( public sealed record ResolvedMedusa(
WeakReference<MedusaAssemblyLoadContext> LoadContext, WeakReference<MedusaAssemblyLoadContext> LoadContext,

View File

@@ -1,8 +1,7 @@
using Nadeko.Snake; using NadekoBot.Medusa;
using System.Reflection; using System.Reflection;
using CommandStrings = Nadeko.Snake.CommandStrings;
namespace Nadeko.Medusa; namespace NadekoBot.Medusa;
public sealed class SnekCommandData public sealed class SnekCommandData
{ {

View File

@@ -1,6 +1,4 @@
using Nadeko.Snake; namespace NadekoBot.Medusa;
namespace Nadeko.Medusa;
public sealed record SnekInfo( public sealed record SnekInfo(
string Name, string Name,

View File

@@ -86,7 +86,7 @@ public abstract class NadekoModule : ModuleBase
embed.WithPendingColor() embed.WithPendingColor()
.WithFooter("yes/no"); .WithFooter("yes/no");
var msg = await MessageChannelExtensions.EmbedAsync(ctx.Channel, embed); var msg = await ctx.Channel.EmbedAsync(embed);
try try
{ {
var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id); var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id);