mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Resolve build errors
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
4c31ebf826
commit
26d7777577
5 changed files with 21 additions and 12 deletions
2
.github/workflows/resharper.yml
vendored
2
.github/workflows/resharper.yml
vendored
|
@ -29,5 +29,5 @@ jobs:
|
||||||
uses: muno92/resharper_inspectcode@1.6.13
|
uses: muno92/resharper_inspectcode@1.6.13
|
||||||
with:
|
with:
|
||||||
solutionPath: ./Boyfriend.sln
|
solutionPath: ./Boyfriend.sln
|
||||||
ignoreIssueType: InvertIf
|
ignoreIssueType: InvertIf,ConvertIfStatementToReturnStatement
|
||||||
solutionWideAnalysis: true
|
solutionWideAnalysis: true
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
// TODO: remove this when all colors are used
|
||||||
|
|
||||||
namespace Boyfriend;
|
namespace Boyfriend;
|
||||||
|
|
||||||
public static class ColorsList {
|
public static class ColorsList {
|
||||||
|
@ -8,7 +11,7 @@ public static class ColorsList {
|
||||||
public static readonly Color Green = Color.PaleGreen;
|
public static readonly Color Green = Color.PaleGreen;
|
||||||
public static readonly Color Yellow = Color.Gold;
|
public static readonly Color Yellow = Color.Gold;
|
||||||
public static readonly Color Blue = Color.RoyalBlue;
|
public static readonly Color Blue = Color.RoyalBlue;
|
||||||
public static readonly Color Magneta = Color.Orchid;
|
public static readonly Color Magenta = Color.Orchid;
|
||||||
public static readonly Color Cyan = Color.LightSkyBlue;
|
public static readonly Color Cyan = Color.LightSkyBlue;
|
||||||
public static readonly Color Black = Color.Black;
|
public static readonly Color Black = Color.Black;
|
||||||
public static readonly Color White = Color.WhiteSmoke;
|
public static readonly Color White = Color.WhiteSmoke;
|
||||||
|
|
|
@ -13,6 +13,9 @@ using Remora.Discord.Commands.Feedback.Services;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
namespace Boyfriend.Commands;
|
namespace Boyfriend.Commands;
|
||||||
|
|
||||||
public class BanCommand : CommandGroup {
|
public class BanCommand : CommandGroup {
|
||||||
|
|
|
@ -89,6 +89,7 @@ public static class Extensions {
|
||||||
|
|
||||||
public static TResult? MaxOrDefault<TSource, TResult>(
|
public static TResult? MaxOrDefault<TSource, TResult>(
|
||||||
this IEnumerable<TSource> source, Func<TSource, TResult> selector) {
|
this IEnumerable<TSource> source, Func<TSource, TResult> selector) {
|
||||||
return source.Any() ? source.Max(selector) : default;
|
var list = source.ToList();
|
||||||
|
return list.Any() ? list.Max(selector) : default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,10 @@ public class UtilityService : IHostedService {
|
||||||
var interacterRoles = roles.Where(r => interacter.Roles.Contains(r.ID));
|
var interacterRoles = roles.Where(r => interacter.Roles.Contains(r.ID));
|
||||||
var botRoles = roles.Where(r => currentMember.Roles.Contains(r.ID));
|
var botRoles = roles.Where(r => currentMember.Roles.Contains(r.ID));
|
||||||
|
|
||||||
var targetBotRoleDiff = targetRoles.MaxOrDefault(r => r.Position) - botRoles.Max(r => r.Position);
|
var targetRolesList = targetRoles.ToList();
|
||||||
var targetInteracterRoleDiff = targetRoles.MaxOrDefault(r => r.Position) - interacterRoles.Max(r => r.Position);
|
var targetBotRoleDiff = targetRolesList.MaxOrDefault(r => r.Position) - botRoles.Max(r => r.Position);
|
||||||
|
var targetInteracterRoleDiff
|
||||||
|
= targetRolesList.MaxOrDefault(r => r.Position) - interacterRoles.Max(r => r.Position);
|
||||||
|
|
||||||
if (targetInteracterRoleDiff >= 0)
|
if (targetInteracterRoleDiff >= 0)
|
||||||
return Result<string?>.FromSuccess($"UserCannot{action}Target".Localized());
|
return Result<string?>.FromSuccess($"UserCannot{action}Target".Localized());
|
||||||
|
|
Loading…
Add table
Reference in a new issue