Forum

Make .chanset on eg...
 
Notifications
Clear all

[Solved] Make .chanset on eggdrop's bot PM


Time Rider
(@timerider)
New Member
Joined: 2 weeks ago
Posts: 4
Topic starter  

Is it possible to make .chanset #chan +/-script work on eggdrop bot on private message (query)? It would be easy to set the script on or off without having to log on in the VPS/shell to turn it off.


Quote
BLaCkShaDoW
(@blackshadow)
Member Admin
Joined: 9 months ago
Posts: 73
 
#
#Chanset TCL
#
# chanset <#chan> <+/-settting> ; setting <value>
#
#						BLaCkShaDoW Production
#############################################################################

#Flags needed to use command (global|local)
set set_flags "nm|nm"

#############################################################################

bind msg - chanset set:msg_proc

proc set:msg_proc {nick host hand arg} {
	global set_flags
	set chan [lindex [split $arg] 0]
	set flag [lindex [split $arg] 1]
	set str [join [lrange [split $arg] 1 end]]
if {[matchattr $hand $set_flags $chan]} {
if {![validchan $chan]} {
	puthelp "PRIVMSG $nick :Invalid channel specified."
	return
}
	set value ""
	set error 0
if {$flag == ""} {
	puthelp "PRIVMSG $nick :use chanset <#chan> <+/-settting> ; setting <value>"
	return
}
if {[regexp {^[+-]} $flag]} {
	set rem_flag [string map {"+" ""
				  "-" ""} $flag]
	set error [catch {channel get $chan $rem_flag} value]
}
if {$error == "1"} {
	puthelp "PRIVMSG $nick :Invalid channel setting."
	return
	}
if {[regexp {^[+]} $flag]} {
	if {$value == "1"} {
	puthelp "PRIVMSG $nick :Setting \002$flag\002 is already set on $chan."
	} else {
	channel set $chan $flag
	puthelp "PRIVMSG $nick :Enabled \002$flag\002 setting on $chan."
	}
} elseif {[regexp {^[-]} $flag]} {
if {$value == "0"} {
	puthelp "PRIVMSG $nick :Setting \002$flag\002 is already disabled on $chan."
	} else {
	channel set $chan $flag
	puthelp "PRIVMSG $nick :Disabled \002$flag\002 setting on $chan."
		}
	} else {
	set error [catch {channel get $chan $flag} value]
	set rem_value [string map {" " ":"} $value]
if {$error == "1"} {
	puthelp "PRIVMSG $nick :Invalid channel setting."
	return
	}
if {$str == ""} {
	puthelp "PRIVMSG $nick :use chanset <#chan> <+/-settting> ; setting <value>"
	return
		}
if {[string equal -nocase $rem_value $str]} {
	puthelp "PRIVMSG $nick :\002$flag\002 is already set to \002$str\002 on $chan."
	return
}
	channel set $chan $flag $str
	puthelp "PRIVMSG $nick :Set \002$flag\002 to \002$str\002 on $chan"
		}
	}
}
This post was modified 2 weeks ago by BLaCkShaDoW

ReplyQuote
Time Rider
(@timerider)
New Member
Joined: 2 weeks ago
Posts: 4
Topic starter  

Thanks BLaCkShaDoW, it is working well.


ReplyQuote
Share: