Skip to content

Commit db7b569

Browse files
committed
fix !help outside server showing extra commands it shouldnt
1 parent ef70e65 commit db7b569

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Commands/GlobalCmds.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -337,18 +337,20 @@ private async Task<IEnumerable<ContextCheckAttribute>> CheckPermissionsAsync(Com
337337

338338
foreach (var check in contextChecks)
339339
{
340-
if (check is HomeServerAttribute homeServerAttribute)
340+
// if command requiring homes erver is used outside, fail the check
341+
if (check is HomeServerAttribute homeServerAttribute
342+
&& (ctx.Channel.IsPrivate || ctx.Guild is null || ctx.Guild.Id != Program.cfgjson.ServerID)
343+
)
341344
{
342-
if (ctx.Channel.IsPrivate || ctx.Guild is null || ctx.Guild.Id != Program.cfgjson.ServerID)
343-
{
344-
failedChecks.Add(homeServerAttribute);
345-
}
345+
failedChecks.Add(homeServerAttribute);
346346
}
347347

348348
if (check is RequireHomeserverPermAttribute requireHomeserverPermAttribute)
349349
{
350-
// Fail if guild member is null but this cmd does not work outside of the home server
351-
if (member is null && !requireHomeserverPermAttribute.WorkOutside)
350+
// Fail if guild is wrong but this command does not work outside of the home server
351+
if (
352+
(ctx.Channel.IsPrivate || ctx.Guild is null || ctx.Guild.Id != Program.cfgjson.ServerID)
353+
&& !requireHomeserverPermAttribute.WorkOutside)
352354
{
353355
failedChecks.Add(requireHomeserverPermAttribute);
354356
}

0 commit comments

Comments
 (0)