invite.tcl

invite.tcl

TCL script that invites a user based on nick and password.

Postat de Copyright Categorie Review user Vizualizari Data
btc Dreamer chanops Cod netestat 320 2023-12-25 09:32:36

###########################################
#							
# Channel invite 0.1 BETA			
# Scripted by Dreamer				
# 							
###########################################
#	
# Type /msg <botnick> @add <nick> <pass> 
# to add someone to the database
# Type /msg <botnick> @invite <nick> <pass>
# to get invited in to channel
#
# History:
# 0.1: First version
#
###########################################
# EDIT FROM HERE

# Channel where the bot wil invite
set chan_1 "#chav"

# Name of the database
set db scripts/chan.invite

# STOP EDITING FROM HERE

set ver "0.1"

bind msg - @add add_1
bind msg - @invite inv_1

putlog "Channel invite $ver by Dreamer loaded"

# Script starts now

proc add_1 { nick uhost hand args } {
	global chan_1 db
	set args [split $args " "]
	set user [lindex $args 0]
	set user [string range $user 1 end]
	set pass [lindex $args 1]
	set pass [string range $pass 0 end-1]
	if { $user == "" || $pass == "" } { 
			putserv "PRIVMSG $nick :Please instert a Nickname and a password" 
			return 0
	}
	set up $user|$pass
	set wfile [open $db a+]
	puts $wfile $up
	close $wfile
	putserv "PRIVMSG $chan_1 :\[\00314DB UPDATE\003\] $user is added to Database by $nick"
}

proc inv_1 { nick uhost hand arg } {
	global chan_1 db
	set found 0
	set arg [split $arg " "]
	set user1 [lindex $arg 0]
	set user1 [string range $user1 0 end]
	set pass1 [lindex $arg 1]
	set pass1 [string range $pass1 0 end]
	set up1 $user1|$pass1
	set found 0 
	set fs [open $db r] 
	while {![eof $fs]} { 
	gets $fs line 
	if {$line == $up1} { set found 1 } 
	} 
	close $fs 
	if {$found} { 
	putserv "PRIVMSG $chan_1 :\[\00314INVITE\003\] $user1 invited him/herself as $nick"
 	putserv "invite $nick $chan_1"
	} else {
	putserv "PRIVMSG $nick :Wrong pass or username !!!!"
	putserv "PRIVMSG $chan_1 :\[\0034INTRUDER\003\] $nick tried to get in the channel"
	} 
}