Merge branch 'master' of gitlab.com:stormdragon2976/stormbot

This commit is contained in:
Storm Dragon 2020-11-22 18:55:35 -05:00
commit 1cfefaad53
3 changed files with 3 additions and 2 deletions

2
bot.sh
View File

@ -149,7 +149,7 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
set -f
# Although this calls modules, it triggers on text other than the bot's nick
# To make sure that modules are only called when they are supposed to be, had to combine string monipulation with regexp.
elif [[ "${result#:*:}" =~ ^[${botCaller}][a-zA-Z_].* ]]; then
elif [[ "${result#:*:}" =~ ^[${botCaller}][a-zA-Z0-9_].* ]]; then
command="${result#*:[[:punct:]]}"
command="${command//# /}"
will="${command#* }"

View File

@ -6,4 +6,5 @@ shift
if [[ "$user" =~ $allowList ]]; then
./modules/do/do.sh "$1" "#$channel" "does a magical gesture and turns into ${1}!"
nick $1
sed -i bot.cfg -e "s/nick=.*/nick=\"$1\"/"
fi

View File

@ -3,7 +3,7 @@
for l in $3 ; do
text="${l#:}"
if [[ "${text}" =~ http://|https://|www\..* ]]; then
pageTitle="$(curl -L -s --connect-timeout 5 "$text" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}' | pandoc -t plain | tr '[:space:]' ' ')"
pageTitle="$(curl -L -s --connect-timeout 5 "$text" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}' | w3m -dump -T text/html | tr '[:space:]' ' ')"
pageTitle="$(echo "$pageTitle" | tr -cd '[:print:]')"
if [[ ${#pageTitle} -gt 1 ]]; then
msg "$2" "$pageTitle"