diff options
author | Joe <joe@joelightning.com> | 2011-11-10 15:47:16 +0000 |
---|---|---|
committer | Joe <joe@joelightning.com> | 2011-11-10 15:47:16 +0000 |
commit | 089dac51e9f96de38078ecdb4d24f329765cb40d (patch) | |
tree | 1c048f9c800a11b30fccb8f5476059f42af9d9d7 | |
parent | c40170cb03e41bd1efe775bbd430a50da6cdeea4 (diff) |
Improved it.
-rw-r--r-- | bot_settings.sh | 7 | ||||
-rw-r--r-- | bug_tracker_change_detector | 6 | ||||
-rw-r--r-- | hack_of_all_hacks | 35 |
3 files changed, 27 insertions, 21 deletions
diff --git a/bot_settings.sh b/bot_settings.sh index 2207364..e5fe04a 100644 --- a/bot_settings.sh +++ b/bot_settings.sh @@ -4,6 +4,7 @@ # # # envbot - an IRC bot in bash # # Copyright (C) 2007-2008 Arvid Norlander # +# Copyright (C) 2011 Joseph Graham # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -131,7 +132,7 @@ config_feedback_unknown_commands=1 config_log_dir="logs" # (*) Should we log raw data or not? # Can be 1 (log) or 0 (don't log) -config_log_raw=1 +config_log_raw=0 # (*) Should we always log to STDOUT as well? # Note that this doesn't mean it will not log at all if set to 0. # It will still log errors and other important log messages to STDOUT. @@ -235,7 +236,7 @@ config_module_quotes_file='data/quotes.txt' # Channels to autojoin on connect config_module_autojoin_channels[1]='#parabola' # A channel can have a key as showed in the example below -config_module_autojoin_channels[2]='#otherchannel channelkey' +config_module_autojoin_channels[2]='#botwars' ##################################################################### @@ -249,7 +250,7 @@ config_module_umodes_default_umodes="+isB-w" # CTCP module # # (*) What to reply to VERSION requests. -config_module_ctcp_version_reply="envbot $envbot_version" +config_module_ctcp_version_reply="pbot-ng $envbot_version" ##################################################################### diff --git a/bug_tracker_change_detector b/bug_tracker_change_detector index 2f64518..00d239a 100644 --- a/bug_tracker_change_detector +++ b/bug_tracker_change_detector @@ -2,6 +2,8 @@ while true do + source common_codez + log_file=bug_sums temp_file=$( mktemp ) @@ -46,7 +48,7 @@ do then tdir="$( mktemp -d )" curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%<title>%1' - bug_title=$( head -1 ${tdir}/xx* ) + bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) rm -r "${tdir}" echo "${bug_number} created: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${changes}" # It is in the log file so now we check if the entire line is there, @@ -55,7 +57,7 @@ do then tdir="$( mktemp -d )" curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%<title>%1' - bug_title=$( head -1 ${tdir}/xx* ) + bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) rm -r "${tdir}" echo "${bug_number} changed: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${changes}" fi 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/—/—/g ; s/</</g ; s/>/>/g ; s/&/&/g ; s/"/"/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 # ######### |