1using System.Text.RegularExpressions;
2using System.Threading.Tasks;
16 : base(
@"^disable\s+key\s+(?'Key'[^\s]+)$")
23 public override string Name =>
"Disable";
33 public override async Task
Execute(
ChatState State,
string[] Arguments,
string OrgMessage, Match Details,
36 int c = Arguments.Length;
37 string Key = c < 2 ? string.Empty : Arguments[1];
42 await
XmppServerModule.SendErrorMessage(
"An API key with key `" + Key +
"` does not exist.",
string.Empty, ResponseCallback);
45 ApiKey.MaxAccounts = 0;
46 await Persistence.Database.Update(
ApiKey);
47 await ResponseCallback(
"API key `" + Key +
"` has been disabled.",
string.Empty);
59 new HelpItem(
"disable key KEY",
"Disables an existing API Key `KEY`. It is not possible to create more accounts using this key. Created accounts will continue to work however.")
DisableKey()
Disables an API key.
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
override string Name
Command name
override HelpItem[] GetHelp()
Gets help about the command.
An administrative command whose syntax is validated with a regular expression.
Contains an item of information about a command.
Service Module hosting the XMPP broker and its components.
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.