summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou2013-11-05 15:34:05 +0200
committerVivia Nikolaidou2013-11-05 15:41:52 +0200
commitf5faacf250d7c5da5c1e4ebe53d84d2bf788b72f (patch)
treea837a9597e0d2750db6f554bd561a18774f2e253
parentAdded the quote module (diff)
downloadshbot-f5faacf250d7c5da5c1e4ebe53d84d2bf788b72f.tar.gz
shbot-f5faacf250d7c5da5c1e4ebe53d84d2bf788b72f.tar.bz2
shbot-f5faacf250d7c5da5c1e4ebe53d84d2bf788b72f.zip
Fix nickname and channel detection
* Nicknames were assumed to be in [A-Za-z] format. Just detecting a [^!] now as ! separates the nickname from the host. * Channels may start with two hashes, the previous regexp didn't recognize that.
Diffstat (limited to '')
-rwxr-xr-xshbot.sh2
-rwxr-xr-xshbrain.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/shbot.sh b/shbot.sh
index 066d202..0deee12 100755
--- a/shbot.sh
+++ b/shbot.sh
@@ -11,7 +11,7 @@ do
if [[ "$LINE" =~ PING\ *:(.*) ]]; then
echo "PONG :${BASH_REMATCH[1]}" >&3
else
- [[ ${LINE} =~ :[a-zA-Z]*!.*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
+ [[ ${LINE} =~ :[^!]*![^#]*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
echo "${LINE}" | ./shbrain.sh | \
while true
do
diff --git a/shbrain.sh b/shbrain.sh
index 06cad02..572bd10 100755
--- a/shbrain.sh
+++ b/shbrain.sh
@@ -8,7 +8,7 @@ do
LINE=${LINE[@]:0:$LEN}
### Parsing potential shcmd
- if [[ $LINE =~ :([a-zA-Z]*)!.*:shcmd ]]; then
+ if [[ $LINE =~ :([^!]*)!.*:shcmd ]]; then
EXPAND=(${LINE})
CMD=${EXPAND[4]#:}
ARGS=${EXPAND[*]:5}