coin module.
This commit is contained in:
parent
af18b6c47a
commit
d9b180deb3
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
log.txt
|
||||
.bot.cfg
|
||||
.botinput
|
||||
|
12
bot.sh
12
bot.sh
@ -2,7 +2,17 @@
|
||||
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
[ -f bot.properties ] && source bot.properties
|
||||
input=".bot.cfg"
|
||||
input=".botinput"
|
||||
|
||||
close_bot()
|
||||
{
|
||||
echo -en "QUIT :$quitMessage\r\n" >> "$input"
|
||||
rm "$input"
|
||||
sleep 10
|
||||
}
|
||||
|
||||
trap close_bot EXIT $?
|
||||
|
||||
echo "Starting session: $(date "+[%y:%m:%d %T]")" | tee $log
|
||||
echo "NICK $nick" > $input
|
||||
echo "USER $user" >> $input
|
||||
|
19
functions.sh
19
functions.sh
@ -1,35 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
input=".bot.cfg"
|
||||
input=".botinput"
|
||||
fi
|
||||
|
||||
msg()
|
||||
{
|
||||
local msg="PRIVMSG $1"
|
||||
local msg="PRIVMSG $1 :"
|
||||
shift
|
||||
echo "$msg $@" | tee -a "$input"
|
||||
echo -en "${msg}$@\r\n" | tee -a "$input"
|
||||
}
|
||||
|
||||
reply()
|
||||
{
|
||||
shift
|
||||
local msg="PRIVMSG $1 :"
|
||||
echo "$msg $@" | tee -a "$input"
|
||||
echo -en "${msg}$@\r\n" | tee -a "$input"
|
||||
}
|
||||
|
||||
act()
|
||||
{
|
||||
local msg="PRIVMSG $1 :\x01ACTION"
|
||||
shift
|
||||
echo -e "$msg $@\x01" | tee -a "$input"
|
||||
echo -en "$msg $@\x01\r\n" | tee -a "$input"
|
||||
}
|
||||
|
||||
close_bot()
|
||||
{
|
||||
echo "QUIT :$quitMessage" >> "$input"
|
||||
echo "exiting..."
|
||||
sleep 10
|
||||
}
|
||||
|
||||
trap close_bot EXIT $?
|
||||
|
35
modules/coin/coin.sh
Executable file
35
modules/coin/coin.sh
Executable file
@ -0,0 +1,35 @@
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
case "${3^^}" in
|
||||
D|DI|DIM|DIME)
|
||||
coin="dime"
|
||||
;;
|
||||
D|DO|DOL|DOLL|DOLLA|DOLLAR)
|
||||
coin="silver dollar"
|
||||
;;
|
||||
H|HA|HAL|HALF|HALF-|HALF-D|HALF-DO|HALF-DOL|HALF-DOLL|HALF-DOLLA|HALF-DOLLAR)
|
||||
coin="fifty-cent piece"
|
||||
;;
|
||||
N|NI|NICNICK|NICKE|NICKEL)
|
||||
coin="nickel"
|
||||
;;
|
||||
P|PE|PEN|PENN|PENNY)
|
||||
coin="penny"
|
||||
;;
|
||||
Q|QU|QUA|QUAR|QUART|QUARTER)
|
||||
coin="quarter"
|
||||
;;
|
||||
*)
|
||||
coin="$(shuf -n1 -e dime "fifty-cent piece" nickel penny "silver dollar" quarter)"
|
||||
esac
|
||||
catch="$(shuf -n1 -e true false)"
|
||||
flip="$(shuf -n1 -e HEADS TAILS)"
|
||||
|
||||
message="pulls a $coin out, flips it high into the air,"
|
||||
if [ "$catch" = "true" ]; then
|
||||
message="$message and deftly catches it,"
|
||||
else
|
||||
message="$message and tries to grab it on the way back down but misses. After lots of cussin', tobaccer juce spittin' and searching, the $coin is found,"
|
||||
fi
|
||||
message="$message revealing $flip!"
|
||||
act "$2" "$message"
|
6
modules/do/do.sh
Executable file
6
modules/do/do.sh
Executable file
@ -0,0 +1,6 @@
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
shift
|
||||
chan="$1"
|
||||
shift
|
||||
act "$chan" "$@"
|
6
modules/say/say.sh
Executable file
6
modules/say/say.sh
Executable file
@ -0,0 +1,6 @@
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
shift
|
||||
chan="$1"
|
||||
shift
|
||||
msg "$chan" "$@"
|
Loading…
Reference in New Issue
Block a user