fixed build warnings

This commit is contained in:
Toastie (DCS Team) 2024-10-03 18:51:55 +13:00
parent 391d2e43e8
commit a321cdbe55
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
4 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,6 @@ using System.CodeDom.Compiler;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text;
@ -50,7 +49,7 @@ namespace EllieBot.Generators
predicate: static (s, _) => s is MethodDeclarationSyntax, predicate: static (s, _) => s is MethodDeclarationSyntax,
transform: static (ctx, _) => GetMethodSemanticTargets(ctx.SemanticModel, ctx.TargetNode)) transform: static (ctx, _) => GetMethodSemanticTargets(ctx.SemanticModel, ctx.TargetNode))
.Where(static m => m is not null) .Where(static m => m is not null)
.Select(static (x, _) => x.Value) .Select(static (x, _) => x!.Value)
.Collect(); .Collect();
context.RegisterSourceOutput(enumsToGenerate, context.RegisterSourceOutput(enumsToGenerate,
@ -74,7 +73,7 @@ namespace EllieBot.Generators
// if (model.GetSymbolInfo(attr).Symbol is not IMethodSymbol attrSymbol) // if (model.GetSymbolInfo(attr).Symbol is not IMethodSymbol attrSymbol)
// return null; // return null;
return new MethodPermData(name, attr.ArgumentList.Arguments[0].ToString()); return new MethodPermData(name, attr.ArgumentList.Arguments[0].ToString() ?? "__missing_perm__");
// return new MethodPermData(name, attrSymbol.Parameters[0].ContainingType.ToDisplayString() + "." + attrSymbol.Parameters[0].Name); // return new MethodPermData(name, attrSymbol.Parameters[0].ContainingType.ToDisplayString() + "." + attrSymbol.Parameters[0].Name);
} }
@ -99,7 +98,7 @@ namespace EllieBot.Generators
sw.Indent++; sw.Indent++;
foreach (var field in fields) foreach (var field in fields)
{ {
sw.WriteLine("{{ \"{0}\", {1} }},", field!.Name, field!.Value); sw.WriteLine("{{ \"{0}\", {1} }},", field.Name, field.Value);
} }
sw.Indent--; sw.Indent--;

View file

@ -8,8 +8,6 @@ public class GrpcApiService : IEService, IReadyExecutor
{ {
private Server? _app; private Server? _app;
private static readonly bool _isEnabled = true;
private readonly DiscordSocketClient _client; private readonly DiscordSocketClient _client;
private readonly OtherSvc _other; private readonly OtherSvc _other;
private readonly ExprsSvc _exprs; private readonly ExprsSvc _exprs;
@ -30,11 +28,11 @@ public class GrpcApiService : IEService, IReadyExecutor
_creds = creds; _creds = creds;
} }
public async Task OnReadyAsync() public Task OnReadyAsync()
{ {
var creds = _creds.GetCreds(); var creds = _creds.GetCreds();
if (creds.GrpcApi is null || creds.GrpcApi.Enabled) if (creds.GrpcApi is null || creds.GrpcApi.Enabled)
return; return Task.CompletedTask;
try try
{ {
@ -65,5 +63,7 @@ public class GrpcApiService : IEService, IReadyExecutor
{ {
_app?.ShutdownAsync().GetAwaiter().GetResult(); _app?.ShutdownAsync().GetAwaiter().GetResult();
} }
return Task.CompletedTask;
} }
} }

View file

@ -14,6 +14,7 @@ public class DownloadTracker : IEService
public async Task EnsureUsersDownloadedAsync(IGuild guild) public async Task EnsureUsersDownloadedAsync(IGuild guild)
{ {
#if GLOBAL_ELLIE #if GLOBAL_ELLIE
await Task.CompletedTask;
return; return;
#endif #endif
await _downloadUsersSemaphore.WaitAsync(); await _downloadUsersSemaphore.WaitAsync();

View file

@ -1,4 +1,3 @@
#nullable disable
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace EllieBot.Common; namespace EllieBot.Common;
@ -71,9 +70,10 @@ public sealed partial class ReplacementPatternStore
Register("%user.id%", static (IUser user) => user.Id.ToString()); Register("%user.id%", static (IUser user) => user.Id.ToString());
Register("%user.created_time%", static (IUser user) => user.CreatedAt.ToString("HH:mm")); Register("%user.created_time%", static (IUser user) => user.CreatedAt.ToString("HH:mm"));
Register("%user.created_date%", static (IUser user) => user.CreatedAt.ToString("dd.MM.yyyy")); Register("%user.created_date%", static (IUser user) => user.CreatedAt.ToString("dd.MM.yyyy"));
Register("%user.joined_time%", static (IGuildUser user) => user.JoinedAt?.ToString("HH:mm")); Register("%user.joined_time%", static (IGuildUser user) => user.JoinedAt?.ToString("HH:mm") ?? "??:??");
Register("%user.joined_date%", static (IGuildUser user) => user.JoinedAt?.ToString("dd.MM.yyyy")); Register("%user.joined_date%",
static (IGuildUser user) => user.JoinedAt?.ToString("dd.MM.yyyy") ?? "??.??.????");
Register("%user%", Register("%user%",
static (IUser[] users) => string.Join(" ", users.Select(user => user.Mention))); static (IUser[] users) => string.Join(" ", users.Select(user => user.Mention)));
Register("%user.mention%", Register("%user.mention%",