Permission chain will no longer mention people
This commit is contained in:
parent
3136560f15
commit
8b6750c5ba
@ -1,5 +1,6 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Services.Database;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@ -89,7 +90,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetCommand(this Permission perm)
|
||||
public static string GetCommand(this Permission perm, IGuild guild = null)
|
||||
{
|
||||
var com = "";
|
||||
switch (perm.PrimaryTarget)
|
||||
@ -125,7 +126,10 @@ namespace NadekoBot.Modules.Permissions
|
||||
switch (perm.PrimaryTarget)
|
||||
{
|
||||
case PrimaryPermissionType.User:
|
||||
com += $"<@{perm.PrimaryTargetId}>";
|
||||
if (guild == null)
|
||||
com += $"<@{perm.PrimaryTargetId}>";
|
||||
else
|
||||
com += guild.GetUser(perm.PrimaryTargetId).ToString() ?? $"<@{perm.PrimaryTargetId}>";
|
||||
break;
|
||||
case PrimaryPermissionType.Channel:
|
||||
com += $"<#{perm.PrimaryTargetId}>";
|
||||
|
@ -71,7 +71,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
var perms = uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission;
|
||||
|
||||
var i = 1;
|
||||
toSend = String.Join("\n", perms.AsEnumerable().Select(p => $"`{(i++)}.` {p.GetCommand()}"));
|
||||
toSend = String.Join("\n", perms.AsEnumerable().Select(p => $"`{(i++)}.` {p.GetCommand(channel.Guild)}"));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(toSend))
|
||||
|
Loading…
Reference in New Issue
Block a user