refresh = () => response = fetch('http://127.0.0.1:5500/') .then((response) => { return response.text(); }) ConnectionTest = async () => { var a = await refresh(); console.log(a) return a } async function BotStatus() { var connectionStatus = await ConnectionTest(); document.getElementById("BotStatus").innerHTML = connectionStatus; } BotStatus(); fetch_GetList = (fetchURL) => response = fetch(fetchURL) .then((response) => { return response.text(); }) GetList = async (listType) => { if (true) { ListRequestOBJ = { 'request_name': listType, 'request_type': "list" } params = "?request_name="+encodeURIComponent(ListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(ListRequestOBJ.request_type); targetURL = "http://127.0.0.1:5500/api/v1/user_client/get"+params; console.log(targetURL) a = await fetch_GetList(targetURL); //console.log("return: "+a); return a } else { return None } } async function GetListChyron() { returnedList = await GetList("Chyron"); obj = JSON.parse(returnedList); console.log(obj["message"]) return returnedList } async function GetListCommands() { returnedList = await GetList("Commands"); var obj_main = JSON.parse(returnedList); console.log(returnedList); console.log(obj_main); console.log(typeof obj_main["message"]) console.log(obj_main["message"]); obj_temp = JSON.parse(obj_main["message"]); searchPattern = "(?<='command': ')[^]'+"; searchPattern = "(?<='command': ')[^']+" newString = returnedList.search(searchPattern); console.log(newString) //obj_temp = JSON.parse(obj_main["message"]); for (var x in Object.keys(obj_main)) { console.log(x); } console.log(obj_main['message']['!lights']); return returnedList } var returnedCommands = GetListCommands(); async function GetListRewards() { returnedList = await GetList("Rewards"); obj = JSON.parse(returnedList); console.log(obj["message"]) return returnedList } async function GetListTimers() { returnedList = await GetList("Timers"); obj = JSON.parse(returnedList); console.log(obj["message"]) return returnedList } async function GetListTextSources() { returnedList = await GetList("TextSources"); obj = JSON.parse(returnedList); console.log(obj["message"]) return returnedList }