HI so I recently trying to figure out a command on my Twitch bot to !addcommand and !delete Command and The !addcom works just fine but the delete is not... I also want to figure out how to edit a Command as well if anyone can help me out that would be great

Code:
on*:text:!addcommand *:#: { 
write commands.txt $2-
}
on*:text:*:#: {
if ($read(commands.txt, ns, $1)) {
 msg $chan $v1
}
}
on *:text:!delcom *:#: {
if ($read(commands.txt, ns, $2)) {
 write -dl $+ $readn commands.txt
}
}