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