Used to access Wolfram Alpha. Submits expressions, retrieves and parses responses.
示例#1
0
        public void HandleCalc(IRCMessage sIRCMessage)
        {
            var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage;

            if(sIRCMessage.Info.Length < 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoValue", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            var client = new WAClient(WolframAlphaConfig.Key);
            var solution = client.Solve(sIRCMessage.Info.SplitToString(4, SchumixBase.Space));
            sSendMessage.SendChatMessage(sIRCMessage, "{0}", solution);
        }
示例#2
0
        public static void HandleWACommand(AlarisMainParameter mp, params string[] parameters)
        {
            var expression = parameters.ConcatenateWithSpaces();
            expression = expression.Replace("=", " = "); // for equations

            var client = new WAClient("557QYQ-UUUWTKX95V");
            /*var result = client.GetResult(expression);

            var results = from pod in result.Pods
                          where pod.Title.ToLower().Contains("solution")
                                || pod.Title.ToLower().Contains("result")
                                || pod.Title.ToLower().Contains("derivative")
                          select pod;

            foreach (var rs in results.Select(pod => pod.SubPods[0].PlainText))
            {
                mp.Bot.SendMsg(mp.Channel, rs);
            }*/

            var result = client.Solve(expression);

            mp.Bot.SendMsg(mp.Channel, result);
        }