示例#1
0
        private async void DisplayPokemon(object state)
        {
            Random rand       = new Random();
            var    newMinutes = rand.Next(MIN_MINUTE_INTERVAL, MAX_MINUTE_INTERVAL + 1);
            var    newPeriod  = 1000 * 60 * newMinutes;

            _timer.Change(newPeriod, newPeriod);
            Console.WriteLine($"Logging next Pokemon in {newMinutes}...");

            var channel = _discord.GetChannel(_channelId) as ISocketMessageChannel;

            var pokemon = await _pokeController.GetRandomPokemonData();

            var cwp = _provider.GetRequiredService <CurrentWanderingPokemon>();

            cwp.SetPokemon(pokemon);
            cwp.SetIsCaptured(false);

            Embed embeddedMessage = CreateEmbeddedMessage(pokemon);

            await channel.SendMessageAsync(embed : embeddedMessage);
        }