Try if this works.

~addcom ~test this is a test
~test
~delcom ~test

Code:
on $*:text:/^~addcom ~?(\S+)/iS:#:{
  if ($nick !isop #) return
  writeini commands.ini commands $regml(1) $$3-
}
 
on $*:text:/^~delcom ~?(\S+)/iS:#:{
  if ($nick !isop #) return
  remini commands.ini commands $regml(1)
}

on $*:text:/^~(\S+)/:#:{
  if ((%floodcom) || ($($+(%,floodcom.,$2),2))) { return }
  set -u10 %floodcom On
  set -u30 %floodom. $+ $nick On
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}