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