What an update! Such an improvement!
This commit is contained in:
parent
bfffde1957
commit
f4540a87ff
6 changed files with 2 additions and 78 deletions
25
bin/connect
25
bin/connect
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
alias logdate=date +'%Y-%m-%d %H:%M:%S'
|
||||
|
||||
cd "${1:-/home/happybot}"
|
||||
export PATH="$(pwd)/bin:$PATH"
|
||||
|
||||
if test -e input; then rm input; fi
|
||||
if test -e /tmp/happybot; then rm -r /tmp/happybot; fi
|
||||
mkfifo input
|
||||
mkdir /tmp/happybot
|
||||
|
||||
if hateweek/isnow; then
|
||||
echo 'hatebot' > /tmp/happybot/nick;
|
||||
else
|
||||
echo 'happybot' > /tmp/happybot/nick;
|
||||
fi
|
||||
|
||||
tail -f input | while read -r line; do
|
||||
printf '%s :%s %s\n' "$(logdate)" "$(cat /tmp/happybot/nick)" "$line" >> log.txt
|
||||
printf '%s\n' "$line"
|
||||
done | openssl s_client -quiet -connect irc.freenode.net:6697 | while read -r line; do
|
||||
printf '%s %s\n' "$(logdate)" "$line" >> log.txt
|
||||
callirc "$line" &
|
||||
done
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
sed -i 's/0/1/' bin/hateweek/isnow
|
||||
raw 'NICK happybot'
|
||||
privmsg '#offtopia' 'Hate how hateweek is over!'
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
exit 1
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
sed -i 's/1/0/' bin/hateweek/isnow
|
||||
raw 'NICK hatebot'
|
||||
privmsg '#offtopia' "Hateweek is here! Hate how it's only once a year!"
|
41
readme.md
41
readme.md
|
@ -1,40 +1,3 @@
|
|||
`input`:
|
||||
- The named pipe to talk as the bot.
|
||||
# happybot 2.0
|
||||
|
||||
`bin/`:
|
||||
- `raw` - Sends `$1` to freenode.
|
||||
- `reply` - Uses env vars to send message `$@`.
|
||||
- `result` - Like reply, but does not prepend `nick:`.
|
||||
- `privmsg` - Sends privmsg to `$1`, with message `shift;$@`.
|
||||
- `notice` - Sends privmsg to `$1`, with message `shift;$@`.
|
||||
- `action` - Sends ctcp action to `$1`, with message `shift;$@`.
|
||||
- `ctcp` - Sends a ctcp query, returns the response.
|
||||
- `connect` - Connects to IRC, calls commands in `irc/`, listens to `input`,
|
||||
and writes to log the file.
|
||||
- `hateweek/start` - Begins hateweek mode.
|
||||
- `hateweek/end` - Ends hateweek mode.
|
||||
- `hateweek/isnow` - Check to see if hateweek is now (returns 0 if now, 1 if
|
||||
not now).
|
||||
|
||||
`log.txt`:
|
||||
- The single file that has all of the logs.
|
||||
- Uses the IRC format with a timestamp prepended.
|
||||
|
||||
`irc/`:
|
||||
- IRC commands are run as shell commands.
|
||||
- `bin/` is in their `PATH`.
|
||||
- Set up env vars before calling various functions.
|
||||
- Add data to log files if needed.
|
||||
|
||||
Env vars:
|
||||
- `$acct`: NickServ account name, or `\*`.
|
||||
- `$nick`
|
||||
- `$cmd`
|
||||
- `$where`
|
||||
- `$msg`
|
||||
|
||||
`/tmp/happybot/`:
|
||||
- directory for temporary information
|
||||
- `nick` - The bot's nick.
|
||||
- `acct` - Look up account name by nick.
|
||||
- Either a directory, or a file.
|
||||
You've heard the rumors, you know it's been a long time in the making, and it's finally here! Happybot 2.0: Vaporware Edition.
|
||||
|
|
1
sudoers
1
sudoers
|
@ -1 +0,0 @@
|
|||
happybot ALL=(root) NOPASSWD: /sbin/rc-service happybot
|
Loading…
Reference in a new issue