merge
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| server="irc.freenode.net" | server="irc.freenode.net" | ||||||
| channel="linux" | channel="linux" | ||||||
| nick="irc-bash-bot" | nick="bashbot" | ||||||
| user="username hostname servername :realname" | user="username hostname servername :realname" | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								bot.sh
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								bot.sh
									
									
									
									
									
								
							| @@ -19,8 +19,7 @@ do | |||||||
|       echo "JOIN #$channel" >> $input |       echo "JOIN #$channel" >> $input | ||||||
|     ;; |     ;; | ||||||
|     # run when someone joins |     # run when someone joins | ||||||
|     *JOIN*) |     *JOIN*) who=$(echo "$res" | perl -pe "s/:(.*)\!.*@.*/\1/") | ||||||
|       who=$(echo "$res" | perl -pe "s/:(.*)\!.*@.*/\1/") |  | ||||||
|       if [ "$who" = "$nick" ] |       if [ "$who" = "$nick" ] | ||||||
|       then |       then | ||||||
|        continue  |        continue  | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								modules/talk.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								modules/talk.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | #! /bin/sh | ||||||
|  |  | ||||||
|  | arg1=$1 # sender (the person I am talking to) | ||||||
|  | arg2=$2 # unclear???? | ||||||
|  |  | ||||||
|  | user_dir=modules/talk/logs/$1 | ||||||
|  | if [ ! -d "$user_dir" ]; then | ||||||
|  |     mkdir $user_dir | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # if the user said goodbye and changed her mind! | ||||||
|  | if [ -f "$user_dir/GOODBYE" ]; then | ||||||
|  |     echo "PRIVMSG $arg2 :$arg1: I thought you just said goodbye!" | ||||||
|  |     rm $user_dir/GOODBYE | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | shift 3  # chop off the first two args | ||||||
|  | echo "$@" >> $user_dir/input | ||||||
|  | cat $user_dir/input | java -jar modules/talk/talk_bot.jar > $user_dir/output | ||||||
|  |  | ||||||
|  | # retcode of value 1 means the user said goodbye | ||||||
|  | retcode="${PIPESTATUS[1]}" | ||||||
|  |  | ||||||
|  | echo "PRIVMSG $arg2 :$arg1: `tail -n 1 $user_dir/output`" | ||||||
|  |  | ||||||
|  | if [ $retcode -eq "1" ]; then | ||||||
|  |     echo "PRIVMSG $arg2 :$arg1: That was a joke! It's free to talk to me. But we do accept donations! ;D" | ||||||
|  |     # clean up old conversations | ||||||
|  |     stamp="`date +%s`" | ||||||
|  |     mv $user_dir/input $user_dir/"input_$stamp" | ||||||
|  |     mv $user_dir/output $user_dir/"output_$stamp" | ||||||
|  |     # leave good-bye flag (indicating the user already said goodbye) | ||||||
|  |     touch $user_dir/GOODBYE | ||||||
|  | fi | ||||||
							
								
								
									
										
											BIN
										
									
								
								modules/talk/talk_bot.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								modules/talk/talk_bot.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user