mirror of https://github.com/nealey/irc-bot
commit
99c617f4a6
|
@ -1,5 +1,4 @@
|
|||
*.o
|
||||
*~
|
||||
*.o
|
||||
dispatch
|
||||
irc
|
||||
|
||||
|
|
9
bot
9
bot
|
@ -2,6 +2,11 @@
|
|||
|
||||
nickname=$1; export nickname
|
||||
|
||||
echo "NICK $1" 1>&6
|
||||
echo "USER $1 $1 $1 :I'm a little printf, short and stdout." 1>&6
|
||||
(
|
||||
# UCSPI wants input on FD 7, and sets $PROTO
|
||||
[ -n "$PROTO" ] && exec 1>&7
|
||||
echo "NICK $1"
|
||||
echo "USER $1 $1 $1 :I'm a little printf, short and stdout."
|
||||
)
|
||||
|
||||
exec ./dispatch ./irc ./$1-handler
|
||||
|
|
|
@ -21,7 +21,9 @@ join () {
|
|||
|
||||
case $command in
|
||||
001)
|
||||
join "#cobalt"
|
||||
for chan in ${CHANNELS:-#cobalt}; do
|
||||
join $chan
|
||||
done
|
||||
;;
|
||||
433)
|
||||
raw "NICK bottimus"
|
||||
|
|
|
@ -173,10 +173,8 @@ call_with_lines(char *buf,
|
|||
|
||||
while ((p = memchr(b, '\n', l))) {
|
||||
size_t n = p - b + 1;
|
||||
size_t buflen = n;
|
||||
|
||||
if ('\r' == *(p-1)) buflen -= 1;
|
||||
func(b, buflen);
|
||||
func(b, n);
|
||||
l -= n;
|
||||
b += n;
|
||||
}
|
||||
|
|
5
firebot
5
firebot
|
@ -1,5 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec 2>&1
|
||||
|
||||
cmd=${1%% *}
|
||||
[ "$cmd" = "$1" ] || args=${1#* }
|
||||
case $cmd in
|
||||
|
@ -16,3 +18,6 @@ case $cmd in
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
|
|
4
irc.c
4
irc.c
|
@ -65,6 +65,10 @@ main(int argc, char *argv[])
|
|||
line += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Strip trailing carriage return */
|
||||
while (*line) line += 1;
|
||||
if ('\r' == *(line-1)) *(line-1) = '\0';
|
||||
}
|
||||
|
||||
/* Set command, converting to upper case */
|
||||
|
|
12
whuffie
12
whuffie
|
@ -13,7 +13,7 @@ put () {
|
|||
}
|
||||
|
||||
adj () {
|
||||
who=${text%%$1$1}
|
||||
who=${text%%$1$1*}
|
||||
if [ "$who" = "$sender" ]; then
|
||||
echo "Nice try, $sender."
|
||||
else
|
||||
|
@ -23,15 +23,15 @@ adj () {
|
|||
|
||||
|
||||
case "$text" in
|
||||
whuffie\ *)
|
||||
who=${text##whuffie }
|
||||
.whuffie\ *)
|
||||
who=${text#.whuffie }
|
||||
amt=$(get "$who")
|
||||
echo "$who has $amt whuffie"
|
||||
echo "$who has whuffie score of $amt"
|
||||
;;
|
||||
*++)
|
||||
*++|*++\ *)
|
||||
adj +
|
||||
;;
|
||||
*--)
|
||||
*--|*--\ *)
|
||||
adj -
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in New Issue