예제 #1
0
        static async Task AsyncMain(IConfigurationRoot config)
        {
            var launchpadConfig = config.GetSection("launchpad");

            var loggedIn = await LogInToLaunchpad(launchpadConfig);

            if (!loggedIn)
            {
                return;
            }

            var launchpad = new Launchpad.Cache(launchpadConfig["oauth_token"], launchpadConfig["oauth_token_secret"]);
            var project   = await launchpad.GetProject($"https://api.launchpad.net/devel/{launchpadConfig["project"]}");

            foreach (var bugTask in await project.GetRecentBugTasks())
            {
                var bug = await bugTask.GetBug();

                var attachments = await bug.GetAttachments();

                Console.WriteLine($"{bugTask.Json.web_link} - {bug.Name}");

                if (IsBugCrashMissingLog(bug, bugTask, attachments))
                {
                    await bug.AddUniqueMessage(
                        "Automated response (ORTB-C1)",
                        "Hello human, I am the Open Rails Triage Bot (https://github.com/openrails/openrails-triage-bot).\n" +
                        "\n" +
                        "It looks to me like you are reporting a crash in Open Rails, but I don't see a log file attached to this bug. To help my human friends diagnose what has gone wrong, it would be greatly appreciated if you could attach the complete 'OpenRailsLog.txt' file from your desktop to this bug.\n" +
                        "\n" +
                        "If you have provided the log file and I've missed it, or you're not actually reporting a crash, don't worry - I won't ask about this again and the humans will know what to do.\n"
                        );
                }
            }
        }
예제 #2
0
 internal Project(Cache cache, JsonProject json) => (Cache, Json) = (cache, json);
예제 #3
0
 internal BugTask(Cache cache, JsonBugTask json) => (Cache, Json) = (cache, json);
예제 #4
0
 public Task <List <BugTask> > GetRecentBugTasks() => Cache.GetBugTaskCollection(Json.self_link + "?ws.op=searchTasks&status=New&status=Incomplete&status=Opinion&status=Invalid&status=Won't+Fix&status=Expired&status=Confirmed&status=Triaged&status=In+Progress&status=Fix+Committed&status=Fix+Released&modified_since=" + DateTime.UtcNow.AddDays(-7).ToString("s"));
예제 #5
0
 public async Task <Bug> GetBug() => await Cache.GetBug(Json.bug_link);