mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 17:20:14 +00:00
feat: add command blacklisting
This commit is contained in:
parent
1cb554e9c5
commit
a3aa02e779
12 changed files with 155 additions and 8 deletions
|
|
@ -109,6 +109,9 @@ public partial class CommandTree
|
|||
public static Command ProxyBlacklistShow = new Command("serverconfig proxy blacklist", "serverconfig proxy blacklist", "Displays the current list of channels where message proxying is disabled");
|
||||
public static Command ProxyBlacklistAdd = new Command("serverconfig proxy blacklist add", "serverconfig proxy blacklist add all|<channel> [channel 2] [channel 3...]", "Disables message proxying in certain channels");
|
||||
public static Command ProxyBlacklistRemove = new Command("serverconfig proxy blacklist remove", "serverconfig proxy blacklist remove all|<channel> [channel 2] [channel 3...]", "Enables message proxying in certain channels");
|
||||
public static Command CommandBlacklistShow = new Command("serverconfig command blacklist", "serverconfig command blacklist", "Displays the current list of channels where running text commands is disabled");
|
||||
public static Command CommandBlacklistAdd = new Command("serverconfig command blacklist add", "serverconfig command blacklist add all|<channel> [channel 2] [channel 3...]", "Disables running text commands in certain channels");
|
||||
public static Command CommandBlacklistRemove = new Command("serverconfig command blacklist remove", "serverconfig command blacklist remove all|<channel> [channel 2] [channel 3...]", "Enables running text commands in certain channels");
|
||||
public static Command ServerConfigLogClean = new Command("serverconfig log cleanup", "serverconfig log cleanup [on|off]", "Toggles whether to clean up other bots' log channels");
|
||||
public static Command ServerConfigInvalidCommandResponse = new Command("serverconfig invalid command error", "serverconfig invalid command error [on|off]", "Sets whether to show an error message when an unknown command is sent");
|
||||
public static Command ServerConfigRequireSystemTag = new Command("serverconfig require tag", "serverconfig require tag [on|off]", "Sets whether server users are required to have a system tag on proxied messages");
|
||||
|
|
@ -160,7 +163,8 @@ public partial class CommandTree
|
|||
ServerConfigLogClean, ServerConfigInvalidCommandResponse, ServerConfigRequireSystemTag,
|
||||
ServerConfigSuppressNotifications,
|
||||
LogChannel, LogChannelClear, LogShow, LogDisable, LogEnable,
|
||||
ProxyBlacklistShow, ProxyBlacklistAdd, ProxyBlacklistRemove
|
||||
ProxyBlacklistShow, ProxyBlacklistAdd, ProxyBlacklistRemove,
|
||||
CommandBlacklistShow, CommandBlacklistAdd, CommandBlacklistRemove
|
||||
};
|
||||
|
||||
public static Command[] AutoproxyCommands =
|
||||
|
|
|
|||
|
|
@ -642,6 +642,15 @@ public partial class CommandTree
|
|||
else
|
||||
return ctx.Execute<ServerConfig>(null, m => m.ShowProxyBlacklisted(ctx));
|
||||
}
|
||||
if (ctx.MatchMultiple(new[] { "command" }, new[] { "blacklist" }))
|
||||
{
|
||||
if (ctx.Match("enable", "on", "add", "deny"))
|
||||
return ctx.Execute<ServerConfig>(null, m => m.SetCommandBlacklisted(ctx, true));
|
||||
else if (ctx.Match("disable", "off", "remove", "allow"))
|
||||
return ctx.Execute<ServerConfig>(null, m => m.SetCommandBlacklisted(ctx, false));
|
||||
else
|
||||
return ctx.Execute<ServerConfig>(null, m => m.ShowCommandBlacklisted(ctx));
|
||||
}
|
||||
|
||||
// todo: maybe add the list of configuration keys here?
|
||||
return ctx.Reply($"{Emojis.Error} Could not find a setting with that name. Please see `{ctx.DefaultPrefix}commands serverconfig` for the list of possible config settings.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue