mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 01:08:26 -04:00
Namespace changes to make them make sense
This commit is contained in:
@@ -19,7 +19,7 @@ EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NadekoBot", "src\NadekoBot\NadekoBot.csproj", "{45EC1473-C678-4857-A544-07DFE0D0B478}"
|
||||
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
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Tests", "src\NadekoBot.Tests\NadekoBot.Tests.csproj", "{DB448DD4-C97F-40E9-8BD3-F605FF1FF833}"
|
||||
EndProject
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Overridden to implement custom checks which commands have to pass in order to be executed.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Used as a marker class for bot_perm and user_perm Attributes
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class bot_owner_onlyAttribute : MedusaPermAttribute
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class bot_permAttribute : MedusaPermAttribute
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Marks a method as a snek command
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Marks services in command arguments for injection.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Marks the parameter to take
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the priority of a command in case there are multiple commands with the same name but different parameters.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Marks the class as a service which can be used within the same Medusa
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class user_permAttribute : MedusaPermAttribute
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Discord;
|
||||
using NadekoBot;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Commands which take this class as a first parameter can be executed in both DMs and Servers
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Commands which take this type as the first parameter can only be executed in DMs
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Commands which take this type as a first parameter can only be executed in a server
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public static class EmbedBuilderExtensions
|
||||
{
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Discord;
|
||||
using Nadeko.Snake;
|
||||
|
||||
namespace NadekoBot;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public static class MedusaExtensions
|
||||
{
|
||||
|
@@ -15,6 +15,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Version)' == '' ">
|
||||
<Version>6.0.0</Version>
|
||||
<Version>9.0.0</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Overridden to implement parsers for custom types
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public readonly struct ParseResult<T>
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// The base class which will be loaded as a module into NadekoBot
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public readonly struct CommandStrings
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Defines methods to retrieve and reload medusa strings
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Implemented by classes which provide localized strings in their own ways
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public class LocalMedusaStringsProvider : IMedusaStringsProvider
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using Serilog;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public class MedusaStrings : IMedusaStrings
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using Serilog;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Loads strings from the shortcut or localizable path
|
||||
|
@@ -12,7 +12,6 @@ global using Nadeko.Common; // new project
|
||||
global using NadekoBot.Common; // old + nadekobot specific things
|
||||
global using NadekoBot.Common.Attributes;
|
||||
global using NadekoBot.Extensions;
|
||||
// global using Nadeko.Snake;
|
||||
|
||||
// discord
|
||||
global using Discord;
|
||||
|
@@ -118,7 +118,7 @@ public class CryptoService : INService
|
||||
|
||||
var nearest = cryptos
|
||||
.Select(elem => (Elem: elem,
|
||||
Distance: StringExtensions.LevenshteinDistance(elem.Name.ToUpperInvariant(), name)))
|
||||
Distance: elem.Name.ToUpperInvariant().LevenshteinDistance(name)))
|
||||
.OrderBy(x => x.Distance)
|
||||
.FirstOrDefault(x => x.Distance <= 2);
|
||||
|
||||
|
@@ -94,8 +94,7 @@ public sealed class ImagesharpStockChartDrawingService : IStockChartDrawingServi
|
||||
=> image.Mutate(ctx =>
|
||||
{
|
||||
foreach (var data in drawData)
|
||||
DrawLineExtensions.DrawLines(ctx,
|
||||
data.IsGreen
|
||||
ctx.DrawLines(data.IsGreen
|
||||
? _greenBrush
|
||||
: _redBrush,
|
||||
1,
|
||||
@@ -104,8 +103,7 @@ public sealed class ImagesharpStockChartDrawingService : IStockChartDrawingServi
|
||||
|
||||
|
||||
foreach (var data in drawData)
|
||||
FillRectangleExtensions.Fill(ctx,
|
||||
data.IsGreen
|
||||
ctx.Fill(data.IsGreen
|
||||
? _greenBrush
|
||||
: _redBrush,
|
||||
data.BodyRect);
|
||||
|
@@ -3,6 +3,7 @@ using Humanizer.Localisation;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
using NadekoBot.Db.Models;
|
||||
using System.Resources;
|
||||
|
||||
namespace NadekoBot.Modules.Utility;
|
||||
|
||||
@@ -43,7 +44,7 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.remind_invalid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ulong target;
|
||||
target = meorhere == MeOrHere.Me ? ctx.User.Id : ctx.Channel.Id;
|
||||
if (!await RemindInternal(target,
|
||||
|
@@ -5,7 +5,6 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<Version>5.0.0</Version>
|
||||
<VersionSuffix>beta1</VersionSuffix>
|
||||
|
||||
<!-- Output/build -->
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
@@ -76,7 +75,7 @@
|
||||
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||
<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">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -110,9 +109,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ayu\NadekoBot.Voice\NadekoBot.Voice.csproj" />
|
||||
<ProjectReference Include="..\Nadeko.Medusa\Nadeko.Medusa.csproj" />
|
||||
|
||||
<ProjectReference Include="..\NadekoBot.Voice\NadekoBot.Voice.csproj" />
|
||||
<ProjectReference Include="..\NadekoBot.Generators\NadekoBot.Generators.csproj" OutputItemType="Analyzer" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -133,16 +131,6 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</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' ">
|
||||
<!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->
|
||||
|
@@ -1,3 +1,6 @@
|
||||
using Humanizer.Localisation;
|
||||
using System.Resources;
|
||||
|
||||
var pid = Environment.ProcessId;
|
||||
|
||||
var shardId = 0;
|
||||
|
@@ -28,7 +28,7 @@ public class YamlSeria : IConfigSeria
|
||||
me =>
|
||||
{
|
||||
var str = me.Groups["code"].Value;
|
||||
var newString = YamlHelper.UnescapeUnicodeCodePoint(str);
|
||||
var newString = str.UnescapeUnicodeCodePoint();
|
||||
return newString;
|
||||
});
|
||||
return output;
|
||||
|
@@ -131,7 +131,7 @@ public static class StringExtensions
|
||||
me =>
|
||||
{
|
||||
var str = me.Groups["code"].Value;
|
||||
var newString = YamlHelper.UnescapeUnicodeCodePoint(str);
|
||||
var newString = str.UnescapeUnicodeCodePoint();
|
||||
return newString;
|
||||
});
|
||||
}
|
@@ -1,6 +1,4 @@
|
||||
#nullable enable
|
||||
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
[DIIgnore]
|
||||
public sealed class BehaviorAdapter : ICustomBehavior
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
internal class ContextAdapterFactory
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
public sealed class DmContextAdapter : DmContext
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
namespace Nadeko.Medusa.Adapters;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
public sealed class GuildContextAdapter : GuildContext
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
|
||||
public sealed class ParamParserAdapter<T> : TypeReader
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
/// <summary>
|
||||
/// Enum specifying in which context the command can be executed
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public interface IMedusaConfigService
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using Cloneable;
|
||||
using NadekoBot.Common.Yml;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
[Cloneable]
|
||||
public sealed partial class MedusaConfig : ICloneable<MedusaConfig>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using NadekoBot.Common.Configs;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedusaConfigService
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public class MedusaAssemblyLoadContext : AssemblyLoadContext
|
||||
{
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using Nadeko.Snake;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using Ninject;
|
||||
using Ninject.Activation;
|
||||
using Ninject.Activation.Caching;
|
||||
@@ -7,7 +6,7 @@ using Ninject.Modules;
|
||||
using Ninject.Planning;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed class MedusaNinjectModule : NinjectModule
|
||||
{
|
||||
|
@@ -10,9 +10,8 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Nadeko.Snake;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
// ReSharper disable RedundantAssignment
|
||||
public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor, INService
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed record ParamData(
|
||||
Type Type,
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
using Ninject.Modules;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed record ResolvedMedusa(
|
||||
WeakReference<MedusaAssemblyLoadContext> LoadContext,
|
||||
|
@@ -1,8 +1,7 @@
|
||||
using Nadeko.Snake;
|
||||
using NadekoBot.Medusa;
|
||||
using System.Reflection;
|
||||
using CommandStrings = Nadeko.Snake.CommandStrings;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed class SnekCommandData
|
||||
{
|
||||
|
@@ -1,6 +1,4 @@
|
||||
using Nadeko.Snake;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
namespace NadekoBot.Medusa;
|
||||
|
||||
public sealed record SnekInfo(
|
||||
string Name,
|
||||
|
@@ -86,7 +86,7 @@ public abstract class NadekoModule : ModuleBase
|
||||
embed.WithPendingColor()
|
||||
.WithFooter("yes/no");
|
||||
|
||||
var msg = await MessageChannelExtensions.EmbedAsync(ctx.Channel, embed);
|
||||
var msg = await ctx.Channel.EmbedAsync(embed);
|
||||
try
|
||||
{
|
||||
var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id);
|
||||
|
Reference in New Issue
Block a user