示例#1
0
        //Handle the difference between "weather set" and "weather" due to a Discord.Net limitation
        private async Task HandleRequestAsync(string location)
        {
            EmbedBuilder embed;

            if (location.Contains("set "))
            {
                location = location.Substring(4);
                if (String.IsNullOrEmpty(location))
                {
                    embed = await service.NoLocation();
                }
                else
                {
                    await SaveUserData("City", location);

                    embed = await service.SuccessfulLocationSet();
                }

                await ReplyAsync("", embed : embed.Build());

                return;
            }

            if (location == String.Empty)
            {
                var user = await FindUserAsync();

                location = user.City;
            }

            embed = await service.CurrentWeather(location);
            await ReplyAsync("", embed : embed.Build());
        }