From eef139412c15d236fb797262a36f9e75fea860d9 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 28 Jun 2020 21:09:46 +0200 Subject: webclient: /help command --- webclient/client.html | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'webclient/client.html') diff --git a/webclient/client.html b/webclient/client.html index 57eee90..766b035 100644 --- a/webclient/client.html +++ b/webclient/client.html @@ -9,6 +9,15 @@ var roomlist=[":console"]; var currentroom=":console"; var roomlogs=new Map([[":console",[]]]); +var commandlist=[ + {cmd:"register",usage:"/register "}, + {cmd:"login",usage:"/login "}, + {cmd:"createroom",usage:"/createroom"}, + {cmd:"invite",usage:"/invite (adds to current room)"}, + {cmd:"shrug",usage:"/shrug (sends '¯\\_(ツ)_/¯')"}, + {cmd:"help",usage:"/help (show list of commands)"} +]; + var uniqid=(function(){ var id=1; return function uniqid(){ @@ -296,6 +305,16 @@ function addRoomEntry(roomid,type,args){ } } +function showUsage(roomid,cmd){ + for(var i=0;i "]); + showUsage(roomid,cmd); break; } creds=[spl.word[1],spl.rest[2]]; @@ -325,7 +344,7 @@ function executeCommand(roomid,text){ case "createroom": if(spl.word.length!=1){ - addRoomEntry(roomid,"error",[now(),"Usage: /createroom"]); + showUsage(roomid,cmd); break; } if(!username){ @@ -344,7 +363,7 @@ function executeCommand(roomid,text){ case "invite": if(spl.word.length<2){ - addRoomEntry(roomid,"error",[now(),"Usage: /invite (adds to current room)"]); + showUsage(roomid,cmd); break; } if(!username){ @@ -369,6 +388,12 @@ function executeCommand(roomid,text){ sendMessage(roomid,"¯\\_(ツ)_/¯"); break; + case "help": + for(var i=0;i