Example #1
0
        public static string GetLogLine()
        {
            var    client  = new WebClient();
            var    url     = $"{Config.bot.serverIp}/api/getwebuiupdates?&adminuser={Token}&admintoken={AuthPass}";
            var    logurl  = $"{Config.bot.serverIp}/api/getlog?&adminuser={Token}&admintoken={AuthPass}&firstline=";
            var    json    = client.DownloadString(url);
            var    data    = WebApi.FromJson(json);
            var    lastnum = data.Newlogs;
            var    logdata = client.DownloadString(logurl + lastnum);
            var    chat    = WebApi.FromJson(logdata);
            string chatMsg = "";

            foreach (var t in chat.Entries)
            {
                if (t.Msg.ToLower().Contains("chat") && t.Msg.Contains("Global"))
                {
                    if (t.Msg == LastLine)
                    {
                        chatMsg = "";
                        break;
                    }

                    chatMsg = t.Msg;
                    var strlen = chatMsg.Length;
                    chatMsg  = chatMsg.Split(')')[1];
                    LastLine = t.Msg;
                    break;
                }
            }

            return(chatMsg);
        }