Example #1
0
        void Respond(DiscordMember author, string message, DiscordChannelBase chan, Action <string> response)
        {
            var  weather = WeatherClient.Factory(author.ID);
            bool handled = false;

            chan.SimulateTyping();
            foreach (var route in _routes)
            {
                if (message.IndexOf(route.Key) == 0)
                {
                    var data = new RouteArguments
                    {
                        parameter = message.Substring(message.IndexOf(" ") + 1),
                        author    = author
                    };
                    response(route.Value(weather, data));
                    handled = true;
                }
            }

            if (handled == false)
            {
                var help = "I couldn't understand your request. How can I be of help?";
                response(help);
            }
        }
Example #2
0
        public static WeatherClient Factory(string userId)
        {
            var client = new WeatherClient();

            client.userId = userId;
            return(client);
        }