public static async void Run([TimerTrigger("0 36 15 * * 5")] TimerInfo myTimer, ILogger log) { ChallongeSQLHelper.ChallongeSQLHelperConnectionString = Environment.GetEnvironmentVariable("dbConnection"); ChallongeApiHelper.HttpHelper.ChallongeHttpHelper.setAuthorizationHeader(Environment.GetEnvironmentVariable("ApiUsername"), Environment.GetEnvironmentVariable("ApiPassword")); FrayDbCurrentWeek currentWeek = ChallongeSQLHelper.GetCurrentWeekInfo(); if (!currentWeek.TournamentId.HasValue) { return; } ChallongeHttpHelper.ShuffleSeeds(currentWeek.TournamentId.Value); ChallongeHttpHelper.OpenPredictionsTournament(currentWeek.TournamentId.Value); var postyBoi = Activity.CreateMessageActivity(); postyBoi.Text = "Sign-ups are closed. Predictions are open"; try { var connectorClient = new ConnectorClient(new Uri(Environment.GetEnvironmentVariable("ServiceUrl")) , microsoftAppId: Environment.GetEnvironmentVariable("MicrosoftAppId") , microsoftAppPassword: Environment.GetEnvironmentVariable("MicrosoftAppPassword")); MicrosoftAppCredentials.TrustServiceUrl(Environment.GetEnvironmentVariable("ServiceUrl"), DateTime.MaxValue); var response = await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(currentWeek.ConversationId, "NotActuallyImportant", (Activity)postyBoi); } catch (Exception ex) { //figure out what to do with this } log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); }
public static List <MatchRetrieval> GetTournamentMatches(int tournamentId) { if (!_tournamentMatches.ContainsKey(tournamentId)) { _tournamentMatches.Add(tournamentId, ChallongeHttpHelper.GetTournamentMatches(tournamentId)); } return(_tournamentMatches[tournamentId]); }
public static List <ParticipantRetrieval> GetTournamentParticipants(int tournamentId) { if (!_tournamentParticipants.ContainsKey(tournamentId)) { _tournamentParticipants.Add(tournamentId, ChallongeHttpHelper.GetTournamentParticipants(tournamentId)); } return(_tournamentParticipants[tournamentId]); }
public static List <TournamentRetrieval> GetAllTournaments() { if (_allTournaments == null) { _allTournaments = ChallongeHttpHelper.GetAllTournaments(); } return(_allTournaments); }