Fixed regexp in reminder.

This commit is contained in:
Storm Dragon
2025-10-25 02:14:29 -04:00
parent d32baa66ba
commit 6f6f7159c1

View File

@@ -14,15 +14,15 @@ if [[ -z "$time" ]]; then
exit 0
fi
# Normalize time format
# Normalize time format - add 's' suffix if no time unit specified
if ! [[ "$time" =~ ^[0-9]+[HhMmSs]$ ]]; then
time="${time}s"
fi
# Validate time is numeric
if ! [[ "${time%[HhMmSs]}" =~ ^[0-9]+$ ]]; then
msg "$chan" "$userNick: Time must be numeric (e.g., 30s, 5m, 1h)."
exit 0
# Check if it's just a number without a unit
if [[ "$time" =~ ^[0-9]+$ ]]; then
time="${time}s"
else
msg "$chan" "$userNick: Time must be numeric (e.g., 30s, 5m, 1h)."
exit 0
fi
fi
# Validate time is reasonable (max 24 hours)
@@ -47,7 +47,7 @@ if [[ -z "$*" ]]; then
fi
msg "$chan" "ok, $userNick, reminder in $time."
reminderMessage="$@"
reminderMessage="$*"
# Handle 'tell' syntax for targeting other users
if [[ "$reminderMessage" =~ ^[Tt]ell[[:space:]]+ ]]; then