mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Add command to show current proxy blacklist (#189)
This commit is contained in:
parent
42b9b4f08e
commit
224b653ee0
2 changed files with 27 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -71,7 +72,28 @@ namespace PluralKit.Bot
|
|||
$"{Emojis.Success} Message logging for the given channels {(enable ? "enabled" : "disabled")}." +
|
||||
(logChannel == null ? $"\n{Emojis.Warn} Please note that no logging channel is set, so there is nowhere to log messages to. You can set a logging channel using `pk;log channel #your-log-channel`." : ""));
|
||||
}
|
||||
|
||||
|
||||
public async Task ShowBlacklisted(Context ctx)
|
||||
{
|
||||
ctx.CheckGuildContext().CheckAuthorPermission(Permissions.ManageGuild, "Manage Server");
|
||||
|
||||
await using (var conn = await _db.Obtain())
|
||||
{
|
||||
var guild = await conn.QueryOrInsertGuildConfig(ctx.Guild.Id);
|
||||
List<string> blacklist = new List<string>();
|
||||
|
||||
foreach (ulong item in guild.Blacklist.ToHashSet()) {
|
||||
blacklist.Add($"<#{item}>");
|
||||
}
|
||||
|
||||
await ctx.Paginate(blacklist.ToAsyncEnumerable(), blacklist.Count, 25, $"Blacklisted channels for {ctx.Guild.Name}",
|
||||
async (eb, l) => {
|
||||
eb.Description += String.Join("\n", l);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetBlacklisted(Context ctx, bool shouldAdd)
|
||||
{
|
||||
ctx.CheckGuildContext().CheckAuthorPermission(Permissions.ManageGuild, "Manage Server");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue