Skip to content

Commit

Permalink
#336: Minor fix with Help command
Browse files Browse the repository at this point in the history
Correctly fetch the required permission attribute
  • Loading branch information
jf-06 committed Oct 9, 2024
1 parent 4a99d5a commit 158b6c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion services/grid-bot/lib/commands/Modules/Commands/Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void SetupCache(CommandService commandService, CommandsSettings commands
aliases.UnionWith(module.Commands[0].Aliases);
}

var botRoleAttribute = module.Attributes.FirstOrDefault(attrib => attrib.GetType() == typeof(RequireBotRoleAttribute)) as RequireBotRoleAttribute;
var botRoleAttribute = module.Preconditions.FirstOrDefault(attrib => attrib.GetType() == typeof(RequireBotRoleAttribute)) as RequireBotRoleAttribute;
var requiredPermission = botRoleAttribute?.BotRole ?? BotRole.Default;

var builder = new EmbedBuilder().WithColor(Color.Green).WithTimestamp(DateTimeOffset.Now);
Expand Down
10 changes: 6 additions & 4 deletions services/grid-bot/src/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private static void SetupJobManager(ServiceCollection services, GridSettings gri

return;
}
#endif
#endif

var logger = new Logger(
name: gridSettings.JobManagerLoggerName,
Expand Down Expand Up @@ -423,15 +423,17 @@ private static void StartGrpcServer(IEnumerable<string> args, IServiceProvider s
{
httpsOptions.SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12;
});
} catch (Exception ex)
}
catch (Exception ex)
{
logger.Warning("Failed to configure gRPC with HTTPS because: {0}. Will resort to insecure host instead!", ex.Message);
}
});
});

// set urls
} else
}
else
{
builder.Services.Configure<KestrelServerOptions>(options =>
{
Expand Down Expand Up @@ -470,7 +472,7 @@ private static async Task InvokeAsync(IEnumerable<string> args)
Console.ReadKey();
return;
}

var services = InitializeServices();

_services = services;
Expand Down

0 comments on commit 158b6c7

Please sign in to comment.