private bool ConectarJira() { try { this.JiraUrl = Properties.Settings.Default.JiraUrlBase; jira.Connect(this.JiraUrl, Properties.Settings.Default.JiraUser, Properties.Settings.Default.JiraPass); return(true); } catch (Exception e) { log.Error("No se pudo conectar a Jira" + e.Message); var msg = MessageBox.Show("No se pudo conectar a Jira" + e.Message, "Error Coneccion jira", MessageBoxButtons.RetryCancel); if (msg == DialogResult.Cancel) { return(false); } ShowLoginJira(); } return(false); }
public void Report(IUser user, DiscordSocketClient client, RestUserMessage message, InteractiveService interactive, string type) { IDMChannel dmChannel = user.GetOrCreateDMChannelAsync().Result; IUserMessage sent = dmChannel.SendMessageAsync($"What is the title of this {type}?\n{message.Content}").Result; SocketMessage reply = WaitForReply(client, sent, dmChannel.Id, user.Id).Result; string title = reply?.Content; if (!string.IsNullOrEmpty(title)) { Jira.SDK.Jira jira = new Jira.SDK.Jira(); try { jira.Connect(settings.JiraUrl, settings.Username, settings.Password); } catch (Exception e) { Console.WriteLine(e.Message); } Project project = jira.GetProject(settings.JiraProject); StringBuilder stringBuilder = new StringBuilder(); foreach (Attachment attachment in message.Attachments) { stringBuilder.AppendLine(attachment.Url); } if (stringBuilder.ToString() == "") { stringBuilder.AppendLine("* No attachments."); } try { Issue newIssue = project.CreateIssue(new IssueFields() { Summary = title + " (USER)", //Set issue summary to the reply from the dev sent thru DMs. IssueType = new IssueType(int.Parse(type == "Bug" ? settings.BugIssueType : settings.UserStory), type), //set issue-type Description = "Issue reported by Discord user \"" + message.Author.Username + "\". " + $"*Reported bug*:\n{message.Content}\n*Attachments*:\n{stringBuilder.ToString()}", //Add bug description based on the reacted message // Labels = new List<string>() //{ // "User" //adds the "user" label //}, // CustomFields = new Dictionary<string, CustomField>() //{ // { "customfield_" + settings.CustomFieldId, new CustomField(int.Parse(settings.CustomFieldId), "Build")} //Adds custom field: build //} }); } catch (Exception e) { Console.WriteLine(e.Message); } IUserMessage confirmation = dmChannel.SendMessageAsync("Bug reported!").Result; } }