Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
RemoveDomain.cs
1using System.Text.RegularExpressions;
2using System.Threading.Tasks;
5
7{
12 {
16 public RemoveDomain()
17 : base(@"^remove\s+domain\s+(?'Name'[^\s]+)$")
18 {
19 }
20
24 public override string Name => "Remove";
25
34 public override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details,
35 ResponseCallbackHandler ResponseCallback)
36 {
37 string Name = Arguments[1];
38
40 {
41 await ResponseCallback("Domain not used.", string.Empty);
42 return;
43 }
44
46 (sender, Status) => ResponseCallback(MarkdownDocument.Encode(Status), string.Empty));
47
48 if (string.IsNullOrEmpty(Msg))
49 await ResponseCallback("Domain successfully removed.", string.Empty);
50 else
51 await ResponseCallback("Domain not removed.", string.Empty);
52 }
53
58 public override HelpItem[] GetHelp()
59 {
60 return new HelpItem[]
61 {
62 new HelpItem("remove domain NAME", "Removes the domain given by `NAME` from the domain configuration.")
63 };
64 }
65 }
66}
Contains a markdown document. This markdown document class supports original markdown,...
static string Encode(string s)
Encodes all special characters in a string so that it can be included in a markdown document without ...
static DomainConfiguration Instance
Current instance of configuration.
bool IsDomainRegistered(string Name)
Checks if a domain name is registered.
async Task< string > RemoveDomain(string Name, EventHandlerAsync< string > Status)
Removes a domain from the list of domains supported by the gateway.
An administrative command whose syntax is validated with a regular expression.
Definition: CommandRegEx.cs:12
Contains an item of information about a command.
Definition: HelpItem.cs:9
Removes a domain from the domain configuration.
Definition: RemoveDomain.cs:12
RemoveDomain()
Removes a domain from the domain configuration.
Definition: RemoveDomain.cs:16
override HelpItem[] GetHelp()
Gets help about the command.
Definition: RemoveDomain.cs:58
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
Definition: RemoveDomain.cs:34
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.