예제 #1
0
        public async Task <string> FetchRandomTwoTimeMessageAsync()
        {
            var allTwoTimeEntires = await GetAllTwoTimeEntries().FreeContext();

            var output      = _defaultTwoTimeMessage;
            var currentTime = _timeSync.GetCurrentTime();

            foreach (var entry in allTwoTimeEntires)
            {
                if (!currentTime.Matches(entry))
                {
                    continue;
                }
                if (entry.TwoTimeMessages == null)
                {
                    continue;
                }

                do
                {
                    var randomIndex = _random.Next(0, entry.TwoTimeMessages.Length);
                    // TODO: Check if we have sent this message recently
                    output = entry.TwoTimeMessages[randomIndex];
                }while (string.IsNullOrWhiteSpace(output));
            }

            return(output);
        }
예제 #2
0
 public void Log(string message)
 {
     Console.WriteLine($"[{_timeSync.GetCurrentTime():dd MMMM HH:mm:ss}]: {message}");
 }