示例#1
0
        public static async Task Run([TimerTrigger("0 14 14-22 * * MON-FRI")] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"PostureRemind executed at: {DateTime.Now}");


            if (new Random().Next(4) == 0)
            {
                await Slack.BroadcastMessage(Slack.GeneralChannel, "<!here> Posture check");
            }
        }
示例#2
0
        public static async Task Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger logger)
        {
            var           client = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("AzureWebJobsStorage")).CreateCloudTableClient();
            var           table  = client.GetTableReference("BlackListedPosts");
            List <string> freshMemes;

            do
            {
                var sweetMemes = await GetSweetMemes();

                freshMemes = FilterFreshMemes(sweetMemes, table);
            }while (!freshMemes.Any());

            var freshlyHandpickedMeme = freshMemes.First();

            await BlacklistNewMeme(freshlyHandpickedMeme, table);

            await Slack.BroadcastImage(Slack.MemesChannel, $"https://i.redd.it/{freshlyHandpickedMeme}");
        }