You can now specify m, h, or s for reminders. Also, you can use tell nick to leave reminders for other people.

This commit is contained in:
Storm Dragon 2016-09-14 07:38:35 -04:00
parent 63f1aa1b30
commit e4e87dc176

View File

@ -7,11 +7,20 @@ shift
time="$1"
shift
if ! [[ "$time" =~ ^[0-9]+$ ]]; then
reminderMessage="Times must be numeric (seconds)."
msg "$chan" "$userNick: $reminderMessage"
else
msg "$chan" "ok, $userNick, reminder in $time seconds."
reminderMessage="$@"
sleep $time && msg "$chan" "$userNick $reminderMessage"&
if ! [[ "$time" =~ ^[0-9]+[HhMmSs]$ ]]; then
time="${time}s"
fi
if ! [[ "${time%[HhMmSs]}" =~ ^[0-9]+$ ]]; then
reminderMessage="Times must be numeric (seconds)."
msg "$chan" "$userNick: $reminderMessage"
else
msg "$chan" "ok, $userNick, reminder in $time."
reminderMessage="$@"
if [[ "$reminderMessage" =~ ^[Tt]ell* ]]; then
userNick="$(echo "$reminderMessage" | rev | cut -d ' ' -f2 | rev)"
reminderMessage="${reminderMessage#[Tt]ell }"
reminderMessage="${reminderMessage#* }"
fi
sleep $time && msg "$chan" "$userNick: $reminderMessage"&
fi