* Merged v4

* Completed some todos
* Fixed PermChecker
* Updated packages
* Upped version to alpha2
* Cleanup
This commit is contained in:
Kwoth
2024-03-25 13:41:44 +00:00
44 changed files with 519 additions and 370 deletions

View File

@@ -1,13 +1,39 @@
using OneOf;
using Nadeko.Bot.Db.Models;
using OneOf;
using OneOf.Types;
namespace Nadeko.Bot.Common;
public interface IPermissionChecker
{
Task<OneOf<Success, Error<LocStr>>> CheckAsync(IGuild guild,
Task<PermCheckResult> CheckPermsAsync(IGuild guild,
IMessageChannel channel,
IUser author,
string module,
string? cmd);
}
}
[GenerateOneOf]
public partial class PermCheckResult
: OneOfBase<PermAllowed, PermCooldown, PermGlobalBlock, PermDisallowed>
{
public bool IsAllowed
=> IsT0;
public bool IsCooldown
=> IsT1;
public bool IsGlobalBlock
=> IsT2;
public bool IsDisallowed
=> IsT3;
}
public readonly record struct PermAllowed;
public readonly record struct PermCooldown;
public readonly record struct PermGlobalBlock;
public readonly record struct PermDisallowed(int PermIndex, string PermText, bool IsVerbose);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
@@ -13,10 +13,11 @@
<ItemGroup>
<ProjectReference Include="..\Nadeko.Bot.Db\Nadeko.Bot.Db.csproj" />
<ProjectReference Include="..\Nadeko.Common\Nadeko.Common.csproj" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="OneOf.SourceGenerator" Version="3.0.263" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta17" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.7" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
@@ -25,7 +26,7 @@
<Publish>True</Publish>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<ProjectReference Include="..\Nadeko.Medusa\Nadeko.Medusa.csproj" />

View File

@@ -60,7 +60,6 @@ public class CommandHandler : INService, IReadyExecutor, ICommandHandler
public async Task OnReadyAsync()
{
Log.Information("Command handler runnning on ready");
// clear users on short cooldown every GLOBAL_COMMANDS_COOLDOWN miliseconds
using var timer = new PeriodicTimer(TimeSpan.FromMilliseconds(GLOBAL_COMMANDS_COOLDOWN));
while (await timer.WaitForNextTickAsync())

View File

@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, INService
{
public const string BOT_VERSION = "5.0.0-alpha1";
public const string BOT_VERSION = "5.0.0-alpha2";
public string Author
=> "Kwoth#2452";

View File

@@ -23,7 +23,7 @@ public static class Rgba32Extensions
{
using var frame = imgArray[i].Frames.CloneFrame(frameNumber % imgArray[i].Frames.Count);
var offset = xOffset;
imgFrame.Mutate(x => x.DrawImage(frame, new(offset, 0), new GraphicsOptions()));
imgFrame.Mutate(x => x.DrawImage(frame, new Point(offset, 0), new GraphicsOptions()));
xOffset += imgArray[i].Bounds().Width;
}
}