/// <summary> /// Executes the specified options. /// </summary> /// <param name="options">The options.</param> public override void Execute(Options options) { var credentials = CredentialService.GetCredentials(); Out.WriteLine("Logging in as {0}...", credentials.JabberId); HipChatService.Login(credentials); }
public override void Receive(Message message, Room room, Options options) { var id = options.Id; IntranetService.Add(id, message.From); room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, "<b>{0}</b> is registered with the id <i>{1}</i>", message.From, id); }
/// <summary> /// Receives the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="room">The room.</param> /// <param name="options">The options.</param> public override void Receive(Message message, Room room, Options options) { if (!UpdateService.IsNewVersionAvailable()) { HipChatService.Say(room, "No new version is available."); } else { HipChatService.Say(room, "Downloading new version of bot..."); UpdateService.DownloadUpdate(); HipChatService.Say(room, "New version downloaded. Recycle me to upgrade."); } }
public override void Receive(Message message, Room room, Options options) { var result = IntranetService.NotAfk(message.From); result.Wait(); if (result.Result) { room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, "<b>Back at work!</b>"); } else { room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, "<b>Failed to check you back in!</b>"); } }
public override void Receive(Message message, Room room, Options options) { var result = IntranetService.Afk(message.From, options.Location, options.Duration); result.Wait(); if (result.Result) { room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, "<b>Checked out!</b>"); } else { room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, "<b>Failed to checked out!</b>"); } }
public override void Receive(Message message, Room room, Options options) { string tfsUri, collectionName; TfsService.GetUserConfig(message.From, out tfsUri, out collectionName); var result = TfsService.RetrieveWorkItem(message.From, tfsUri, options.Collection ?? collectionName, options.Item); if (result == null) { HipChatService.Say(room, "Could not find work item"); } else { var wiResourceUri = result.Project.Uri; var uri = string.Format("{0}/web/UI/Pages/WorkItems/WorkItemEdit.aspx?id={1}&pguid={2}", tfsUri, result.Id, wiResourceUri.Segments.Last()); var info = string.Format("<a href=\"{5}\">{1} ({0})</a><br/>Type: {2}<br/>State: {3}<br/>Assigned To: {4}", result.Id, result.Title, result.Type.Name, result.State, result.Fields["System.AssignedTo"].Value, uri); room = RoomService.GetRoomByJabberId(room.JabberId); HipChatService.SayHtml(room, info); } }
/// <summary> /// The interactive HipBot command line. /// </summary> public override void Default() { In.OnInput += In_OnInput; In.DynamicPrompt = () => { return(string.Format("{0:HH:mm:ss}>", DateTime.Now)); }; Out.WriteLine("|cyan|HipBot.|gray|"); In.Listen(); if (CredentialService.CredentialsSet()) { var credentials = CredentialService.GetCredentials(); HipChatService.Login(credentials); } while (true) { Thread.Sleep(1000); } }
/// <summary> /// Receives the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="room">The room.</param> /// <param name="options">The options.</param> public override void Receive(Message message, Room room, Options options) { HipChatService.Say(room, "Recycling bot."); UpdateService.RunLatestVersion(false, true); }
public override void Receive(Message message, Room room, Options options) { TfsService.SetUserConfig(message.From, options.TfsUri, options.Collection); HipChatService.Say(room, string.Format("{0} tfs settings updated!", message.From)); }