But if you wish to be spammed, nobody but you should be able to unspam yourself.
This commit is contained in:
parent
402cbbaadd
commit
4c8609d7c7
|
@ -12,7 +12,7 @@ irc | while read -r n m; do
|
||||||
if [ "$(m 1)" == "add" ]; then
|
if [ "$(m 1)" == "add" ]; then
|
||||||
if [ ! -e "$file" ]; then
|
if [ ! -e "$file" ]; then
|
||||||
touch "$file"
|
touch "$file"
|
||||||
elif grep -F -i -e "$n" "$file"; then
|
elif grep -x -F -i -e "$n" "$file"; then
|
||||||
var "$n: You're already part of @$group." | zwsp | say
|
var "$n: You're already part of @$group." | zwsp | say
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -26,7 +26,7 @@ irc | while read -r n m; do
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -e "$file" ]; then
|
if [ -e "$file" ]; then
|
||||||
new="$(grep -F -i -v -e "$n" "$file")"
|
new="$(grep -x -F -i -v -e "$n" "$file")"
|
||||||
if [ -z "$new" ]; then
|
if [ -z "$new" ]; then
|
||||||
rm "$file"
|
rm "$file"
|
||||||
else
|
else
|
||||||
|
@ -42,12 +42,13 @@ irc | while read -r n m; do
|
||||||
elif hreg '^happybot[:,] groups?(?:$| .*$)' "$m"; then
|
elif hreg '^happybot[:,] groups?(?:$| .*$)' "$m"; then
|
||||||
var "$n: Usage: groups add|del|list @[a-z0-9][a-z0-9_-]*" | zwsp | say
|
var "$n: Usage: groups add|del|list @[a-z0-9][a-z0-9_-]*" | zwsp | say
|
||||||
elif reg ' cc ([^ ,]+(?:, ?[^ ,]+)*)' "$m"; then
|
elif reg ' cc ([^ ,]+(?:, ?[^ ,]+)*)' "$m"; then
|
||||||
grep='grep -o -F -i '"$(ls -1 "$base" | sed "s/^/-e '@/;s/\$/'/" | tr '\n' ' ')"
|
grep='grep -o -F -i -x '"$(ls -1 "$base" | sed "s/^/-e '@/;s/\$/'/" | tr '\n' ' ')"
|
||||||
groups="$(var "$(m 1)" | sed 's/,/ /g;s/ / /g' | tr ' ' '\n' | eval "$grep" | sed 's/^@//')"
|
groups="$(m 1 | sed 's/[^a-zA-Z0-9\-_]*$//')"
|
||||||
|
groups="$(var "$groups" | sed 's/,/ /g;s/ / /g' | tr ' ' '\n' | eval "$grep" | sed 's/^@//')"
|
||||||
if [ ! -z "$groups" ]; then
|
if [ ! -z "$groups" ]; then
|
||||||
new="$m"
|
new="$m"
|
||||||
for group in $groups; do
|
for group in $groups; do
|
||||||
people="$(cat "$base/$group" | grep -v -F -e "$n" | tr '\n' ',' | sed 's/,$//;s/,/, /g')"
|
people="$(cat "$base/$group" | grep -v -F -e -x "$n" | tr '\n' ',' | sed 's/,$//;s/,/, /g')"
|
||||||
if [ ! -z "$people" ]; then
|
if [ ! -z "$people" ]; then
|
||||||
new="$(var "$new" | sed 's/ cc \(.*\)@'"$group"'/ cc \1'"$people"'/')"
|
new="$(var "$new" | sed 's/ cc \(.*\)@'"$group"'/ cc \1'"$people"'/')"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue