2 using System.Collections.Generic;
6 using System.Threading.Tasks;
18 public string Name =>
"revision";
21 public string HelpText =>
"Display live commit sha. Add --repo to view repository revision";
24 public bool AdminOnly =>
false;
49 this.watchdog = watchdog ??
throw new ArgumentNullException(nameof(watchdog));
50 this.repositoryManager = repositoryManager ??
throw new ArgumentNullException(nameof(repositoryManager));
51 this.instance = instance ??
throw new ArgumentNullException(nameof(instance));
55 public async Task<string>
Invoke(
string arguments,
User user, CancellationToken cancellationToken)
58 if (arguments.Split(
' ').Any(x => x.ToUpperInvariant() ==
"--REPO"))
59 using (var repo = await repositoryManager.LoadRepository(cancellationToken).ConfigureAwait(
false))
62 return "Repository unavailable!";
67 if (!watchdog.Running)
68 return "Server offline!";
69 result = watchdog.ActiveCompileJob?.RevisionInformation.CommitSha;
72 return String.Format(CultureInfo.InvariantCulture,
"^{0}", result);
Use server authentication
readonly IRepositoryManager repositoryManager
The IRepositoryManager for the PullRequestsCommand
async Task< string > Invoke(string arguments, User user, CancellationToken cancellationToken)
Invoke the ICommand
readonly IWatchdog watchdog
The IWatchdog for the PullRequestsCommand
readonly Models.Instance instance
The Models.Instance for the PullRequestsCommand
RevisionCommand(IWatchdog watchdog, IRepositoryManager repositoryManager, Models.Instance instance)
Construct a RevisionCommand
For displaying Api.Models.Internal.RevisionInformation
Represents a tgs_chat_user datum
Factory for creating and loading IRepositorys
Represents a command that can be invoked by talking to chat bots
Runs and monitors the twin server controllers