示例#1
0
    public async Task <IActionResult> OnPost(string teamId)
    {
        _logger.LogInformation($"Deleting {teamId}");
        var slackClient = await CreateSlackClient(teamId);

        try
        {
            var res = await slackClient.AppsUninstall(_slackAppOptions.Value.CLIENT_ID, _slackAppOptions.Value.CLIENT_SECRET);

            if (res.Ok)
            {
                TempData["msg"] = "Uninstall queued, and will be handled at some point";
            }
            else
            {
                TempData["msg"] = $"Uninstall failed '{res.Error}'";
            }
        }
        catch (WellKnownSlackApiException e) when(e.Message == "account_inactive")
        {
            await _teamRepo.DeleteByTeamId(teamId);

            TempData["msg"] = "Token no longer valid. Team deleted.";
        }


        return(RedirectToPage("../Index"));
    }
示例#2
0
        public async Task Uninstall(string teamId)
        {
            var team = await _slackTeamRepo.GetTeam(teamId);

            await _slackTeamRepo.DeleteByTeamId(teamId);

            await _messageSession.Publish(new AppUninstalled(team.TeamId, team.TeamName, (int)team.FplbotLeagueId, team.FplBotSlackChannel));
        }