summaryrefslogtreecommitdiff
path: root/hack_of_all_hacks
diff options
context:
space:
mode:
authorJoe <joe@joelightning.com>2011-11-10 15:47:16 +0000
committerJoe <joe@joelightning.com>2011-11-10 15:47:16 +0000
commit089dac51e9f96de38078ecdb4d24f329765cb40d (patch)
tree1c048f9c800a11b30fccb8f5476059f42af9d9d7 /hack_of_all_hacks
parentc40170cb03e41bd1efe775bbd430a50da6cdeea4 (diff)
Improved it.
Diffstat (limited to 'hack_of_all_hacks')
-rw-r--r--hack_of_all_hacks35
1 files changed, 19 insertions, 16 deletions
diff --git a/hack_of_all_hacks b/hack_of_all_hacks
index 0c4e026..009fd0f 100644
--- a/hack_of_all_hacks
+++ b/hack_of_all_hacks
@@ -7,9 +7,12 @@ function rdom
read -d \< element content
}
+source common_codez
function l33t_codes
{
+ channel_it_came_from="$( echo ${line} | cut -d ' ' -f 3 )"
+
person="${sender%%!*}"
##########################
@@ -18,7 +21,7 @@ function l33t_codes
if [[ ${line} == *"error while loading shared libraries"* ]]
then
- send_msg '#parabola' "${person}: please report a bug, specifying exact error message, package of the failing command and architecture"
+ send_msg "${channel_it_came_from}" "${person}: please report a bug, specifying exact error message, package of the failing command and architecture"
fi
##########
@@ -29,7 +32,7 @@ function l33t_codes
# for fun.
if [[ ${line##*PRIVMSG} == ${lastline} ]] && [[ ${person} != ${lastsender} ]]
then
- send_msg '#parabola' "${line##*PRIVMSG}"
+ send_msg "${channel_it_came_from}" "${line##*PRIVMSG}"
fi
lastline="${line##*PRIVMSG}"
@@ -64,7 +67,7 @@ EOF
if (( ( $( stat -c %Y announcements/people/${personoslash}/seen ) +
10800 ) < the_time_now ))
then
- send_msg '#parabola' \
+ send_msg "${channel_it_came_from}" \
"$( shuf "announcements/people/${personoslash}/phrases" | head -1 )"
fi
@@ -94,24 +97,24 @@ EOF
years_ago_seen="$(( ( the_time_now - $( stat -c %Y announcements/people/${subject}/seen ) ) / 946080000 ))"
if (( seconds_ago_seen < 120 ))
then
- send_msg '#parabola' "I last saw ${subject} speak ${seconds_ago_seen} seconds ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${seconds_ago_seen} seconds ago."
elif (( minutes_ago_seen < 120 ))
then
- send_msg '#parabola' "I last saw ${subject} speak ${minutes_ago_seen} minutes ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${minutes_ago_seen} minutes ago."
elif (( hours_ago_seen < 48 ))
then
- send_msg '#parabola' "I last saw ${subject} speak ${hours_ago_seen} hours ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${hours_ago_seen} hours ago."
elif (( days_ago_seen < 60 ))
then
- send_msg '#parabola' "I last saw ${subject} speak ${days_ago_seen} days ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${days_ago_seen} days ago."
elif (( months_ago_seen < 24 ))
then
- send_msg '#parabola' "I last saw ${subject} speak ${months_ago_seen} months ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${months_ago_seen} months ago."
else
- send_msg '#parabola' "I last saw ${subject} speak ${years_ago_seen} years ago."
+ send_msg "${channel_it_came_from}" "I last saw ${subject} speak ${years_ago_seen} years ago."
fi
else
- send_msg '#parabola' "I never saw ${subject} speak."
+ send_msg "${channel_it_came_from}" "I never saw ${subject} speak."
fi
fi
@@ -126,12 +129,9 @@ EOF
if [[ ${personoslash} == tlCJ99mfZl ]]
then
- send_msg '#parabola' "${line_filtered}"
+ send_msg "${channel_it_came_from}" "${line_filtered}"
fi
- # TODO: add a birthday announcement feature, cointoss feature, timer
- # feature.
-
#####################
# Page title getter #
#####################
@@ -146,17 +146,20 @@ EOF
do
if [[ ${element} = title ]]
then
- echo "${content}" | sed 's/&mdash;/—/g ; s/&lt;/</g ; s/&gt;/>/g ; s/&amp;/&/g ; s/&quot;/"/g'
+ echo "${content}" | replace_wierd_html_chars
fi
done
)
if ! [[ -z ${the_title} ]]
then
- send_msg '#parabola' "The title of that page is: \`${the_title}'"
+ send_msg "${channel_it_came_from}" "The title of that page is: \`${the_title}'"
fi
fi
+ # TODO: add a birthday announcement feature, cointoss feature, timer
+ # feature.
+
#########
# Tests #
#########