############################
### BotnetNotify.tcl	 ###
### Version 1.7		 ###
### By Wcc		 ###
### wcc@techmonkeys.org  ###
### http://dawg.dynu.com ###
### EFnet #|DAWG|Tcl     ###
############################

############################################################################
### Copyright © 2000 - 2001 |DAWG| Scripting Group. All rights reserved. ###
############################################################################

############################################################################################
## This script notifies a channel what a user joins the partyline, when a user leaves	  ##
## the partyline, when a bot disconnects, when a bot links, and when a user changes there ## 
## handle. If hub mode is set to 1, it will notify when any bot links or delinks.	  ##
############################################################################################

#############################################################
## Just load the script, set the variables, and rehash.    ##
#############################################################

######################################
# Set your botnet info channel here. #
######################################

set botnetnotify_setting(infochan) "#|DAWG|Net"

#######################################
# If your bot is a hub, set "1" here. #
#######################################

set botnetnotify_setting(hub) 0

####################
# Code begins here #
####################

if {![string match 1.6.* $version]} {
	putlog "\002BOTNETNOTIFY:\002 \002CRITICAL ERROR\002 BotnetNotify.tcl requires eggdrop 1.6.x to run."
	die "\002BOTNETNOTIFY:\002 \002CRITICAL ERROR\002 BotnetNotify.tcl requires eggdrop 1.6.x to run."
}
bind chon - * bnet_user_login
bind chof - * bnet_user_logout
bind link - * bnet_bot_link
bind disc - * bnet_bot_disconnect

proc bnet_user_login {hand idx} {
	global botnetnotify_setting
	if {([validchan $botnetnotify_setting(infochan)]) && ([botonchan $botnetnotify_setting(infochan)])} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :$hand has joined the partyline."
	}
}
proc bnet_user_logout {hand idx} {
	global botnetnotify_setting
	if {([validchan $botnetnotify_setting(infochan)]) && ([botonchan $botnetnotify_setting(infochan)])} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :$hand has left the partyline."
	}
}
proc bnet_bot_link {botname to} {
	global botnetnotify_setting
	if {($botnetnotify_setting(hub)) && ([validchan $botnetnotify_setting(infochan)]) && ([botonchan $botnetnotify_setting(infochan)])} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :$botname is now linked to $to." 
	}
}
proc bnet_bot_disconnect {botname} {
	global botnetnotify_setting
	if {($botnetnotify_setting(hub)) && ([validchan $botnetnotify_setting(infochan)]) && ([botonchan $botnetnotify_setting(infochan)])} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :$botname has disconnected from the botnet." 
	}
}
putlog "\002BOTNETNOTIFY:\002 BotnetNotify.tcl Version 1.7 by Wcc is loaded."
putlog "\002BOTNETNOTIFY:\002 Botnet info is being sent to $botnetnotify_setting(infochan)."
if {$botnetnotify_setting(hub)} {
	putlog "\002BOTNETNOTIFY:\002 Hub Mode is on."
} else {
	putlog "\002BOTNETNOTIFY:\002 Leaf Mode is on."
}