5 using System.Threading.Tasks;
17 public string Name =>
"revision";
20 public string HelpText =>
"Display live commit sha. Add --repo to view repository revision";
23 public bool AdminOnly =>
false;
42 this.watchdog = watchdog ??
throw new ArgumentNullException(nameof(watchdog));
43 this.repositoryManager = repositoryManager ??
throw new ArgumentNullException(nameof(repositoryManager));
47 public async Task<string>
Invoke(
string arguments,
ChatUser user, CancellationToken cancellationToken)
50 if (arguments.Split(
' ').Any(x => x.ToUpperInvariant() ==
"--REPO"))
51 using (var repo = await repositoryManager.LoadRepository(cancellationToken).ConfigureAwait(
false))
54 return "Repository unavailable!";
59 if (!watchdog.Running)
60 return "Server offline!";
61 result = watchdog.ActiveCompileJob?.RevisionInformation.CommitSha;
64 return String.Format(CultureInfo.InvariantCulture,
"^{0}", result);
async Task< string > Invoke(string arguments, ChatUser user, CancellationToken cancellationToken)
Invoke the ICommand
Use server authentication
readonly IRepositoryManager repositoryManager
The IRepositoryManager for the PullRequestsCommand
readonly IWatchdog watchdog
The IWatchdog for the PullRequestsCommand
Represents a tgs_chat_user datum
For displaying Api.Models.Internal.RevisionInformation
Factory for creating and loading IRepositorys
RevisionCommand(IWatchdog watchdog, IRepositoryManager repositoryManager)
Construct a RevisionCommand
Represents a command that can be invoked by talking to chat bots
Runs and monitors the twin server controllers