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.
This commit is contained in:
parent
d067533902
commit
f5faacf250
2 changed files with 2 additions and 2 deletions
2
shbot.sh
2
shbot.sh
|
@ -11,7 +11,7 @@ do
|
||||||
if [[ "$LINE" =~ PING\ *:(.*) ]]; then
|
if [[ "$LINE" =~ PING\ *:(.*) ]]; then
|
||||||
echo "PONG :${BASH_REMATCH[1]}" >&3
|
echo "PONG :${BASH_REMATCH[1]}" >&3
|
||||||
else
|
else
|
||||||
[[ ${LINE} =~ :[a-zA-Z]*!.*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
|
[[ ${LINE} =~ :[^!]*![^#]*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
|
||||||
echo "${LINE}" | ./shbrain.sh | \
|
echo "${LINE}" | ./shbrain.sh | \
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
|
@ -8,7 +8,7 @@ do
|
||||||
LINE=${LINE[@]:0:$LEN}
|
LINE=${LINE[@]:0:$LEN}
|
||||||
|
|
||||||
### Parsing potential shcmd
|
### Parsing potential shcmd
|
||||||
if [[ $LINE =~ :([a-zA-Z]*)!.*:shcmd ]]; then
|
if [[ $LINE =~ :([^!]*)!.*:shcmd ]]; then
|
||||||
EXPAND=(${LINE})
|
EXPAND=(${LINE})
|
||||||
CMD=${EXPAND[4]#:}
|
CMD=${EXPAND[4]#:}
|
||||||
ARGS=${EXPAND[*]:5}
|
ARGS=${EXPAND[*]:5}
|
||||||
|
|
Reference in a new issue