This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

add channels

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

add channels

Post by blake »

Hi im looking for a small script that will allow me to add/del channels to the bots channel list via bind msg

Ex /msg botnick addchan #channelname
/msg botnick delchan #channelname

in theory it should do as .+chan #channelname .-chan #channelname would do

many thanks
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

I set the bind to n only, I figured you only wanted owners to use this command. There really is not an exact equivalent of .+/-chan in tcl commands. Closest I could get was with using channel add/remove. This will make the channels dynamic though, meaning, your bot will automatically join them when it starts, just as it does the channels set in your config. I have not configured channel options into channel add:

Code: Select all

bind msg n addchan addchan
proc addchan {nick host hand text} {
	set chan [join [lindex [split $text] 0]]
	if {![string length $chan]} {
		putserv "PRIVMSG $nick :You need to specify which channel to join."
		return 0
	}
	if {[validchan $chan]} {
		if {[channel get $chan "inactive"]} {
			channel set $chan -inactive
			return 0
		}
		putserv "PRIVMSG $nick :I am already on $chan."
		return 0
	}
	channel add $chan
}

bind msg n delchan delchan
proc delchan {nick host hand text} {
	set chan [join [lindex [split $text] 0]]
	if {![string length $chan]} {
		putserv "PRIVMSG $nick :You need to specify which channel to remove."
		return 0
	}
	if {![validchan $chan]} {
		putserv "PRIVMSG $nick :Unknown channel: $chan."
		return 0
	}
	channel remove $chan
}
Syntax is: /msg botnick add/delchan <channel>.
Post Reply