Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # AyyAyyBot
- # An ii IRC bot written in bash
- #
- trap quit SIGINT
- workingDir="~/Documents/AyyAyyBot/"
- networks=$(cat $workingDir/networks.txt)
- introduction="[AyyAyy] A bash bot wrapper for ii."
- startAyyAyyBot()
- {
- echo "== Starting AyyAyyBot =="
- cd $workingDir
- echo "[AyyAyy] Loading support for the following networks:"
- echo "$networks"
- echo "[AyyAyy] Starting ii and connecting to networks..."
- for i in $networks;
- do
- echo "[AyyAyy] Joining: $i"
- screen -dmS AyyAyy-$i ii -n AyyAyyBot -i $workingDir -s $networks
- echo "[AyyAyy] Joined $i"
- done
- echo "[AyyAyy] ii launched and connected!"
- echo "[AyyAyy] Executing autostart commands and joining channels..."
- for i in $networks;
- do
- grep -v '^#' ayyAutostart-$i >> $i/in # Run autostart commands.
- for c in $(cat chans-$i.txt); # Autojoin channels listed in chans-network.txt
- do
- echo "[AyyAyy] Joining $c on $i."
- echo "/join $c" >> $i/in
- echo $introduction >> $i/$c/in
- done
- done
- }
- bots()
- {
- for i in $networks;
- do
- for c in $(cat chans-$i.txt); # Fetch channels.
- do
- if tail -n 1 $i/$c/out | grep ".bots"; then
- echo "Reporting in! [Bash] AyyAyy is a bot wrapper for ii." >> $i/$c/in
- fi
- done
- done
- }
- about()
- {
- for i in $networks;
- do
- for c in $(cat chans-$i.txt); # Fetch channels.
- do
- if tail -n 1 $i/$c/out | grep "&ayy about"; then
- echo "[AyyAyy] AyyAyy is a wrapper for ii written in bash. v0.01" >> $i/$c/in
- fi
- done
- done
- }
- help()
- {
- for i in $networks;
- do
- for c in $(cat chans-$i.txt); # Fetch channels.
- do
- if tail -n 1 $i/$c/out | grep "&ayy help"; then
- echo "[AyyAyy] Preface commands with &ayy" >> $i/$c/in
- echo "[AyyAyy] &ayy version: Prints about and version information." >> $i/$c/in
- fi
- done
- done
- }
- auth() # Auth botmods.
- {
- for i in $networks;
- do
- if tail -n 1 $i/$c/out | grep "&ayy auth"; then
- echo "[AyyAyy] Usage: &ayy auth {status | auth | deauth}" >> $i/$c/in
- echo "[AyyAyy] ^^ This command doesn't work yet. ^^" >> $i/$c/in
- fi
- done
- }
- # iiStatus()
- # {
- # pgrep ii || echo "[AyyAyy] ii died!"
- # }
- tick()
- {
- # iiStatus >> /dev/null
- # Channel Commands
- bots # Respond to .bots
- help # Prints help information.
- about # Prints about information.
- # PM Commands
- # auth -- Disabled for now.
- }
- quit()
- {
- echo "[AyyAyy] Shutting Down..."
- killall ii
- exit
- }
- startAyyAyyBot
- while true; do tick; done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement