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.

Topic script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Topic script

Post by Football »

Hey,

I couldn't find a regula, simple script, that allows flag "v" to change a selected channel's topic via private message.

Would be glad if anyone could help, shouldn't be a long script right?
Idling at #Football, Quakenet.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

I just use a this simple bit of script to do channel topics

Code: Select all

bind msg v|v topic cmd:topic
proc cmd:topic {nick uhost hand arg} {
  set chan [lindex [split $arg] 0]  
  set text [join [lrange [split $arg] 1 end]]  
  putserv "TOPIC $chan :$text"  
}
/msg botnick topic #chan topic text
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

setudef flag mytopic

bind msg v|v topic cmd:topic

proc cmd:topic {nick uhost hand arg} {
	set chan [lindex [split $arg] 0]
	set text [join [lrange [split $arg] 1 end]]
	if {[string match *[string index $chan 0]* "#&"]} {
		if {[validchan $chan] && [botison $chan]} {
			if {[botisop $chan]} {
				if {[channel get $chan mytopic]} {
					if {[onchan $nick $chan]} {
						putserv "TOPIC $chan :$text"
					} else {
						putserv "NOTICE $nick :You need to be in the channel to witness the topic change. Nice try. :P"
					}
				} else {
					putserv "NOTICE $nick :You CANNOT change topic of $chan. Nice try."
				}
			} else {
				putserv "NOTICE $nick :I'm not op of $chan so no topic change for you. :P"
			}
		} else {
			putserv "NOTICE $nick :I'm not on $chan. How do you expect me to change topic?!"
		}
	} else {
		putserv "NOTICE $nick :What is $chan? That doesn't look like any IRC channel I've ever seen. :P"
	}
}
Here's the same script with some extra checks to make sure users aren't causing your bot to send garbage to the IRCD.
To get it to work in #yourchan: .chanset #yourchan +mytopic
After that, it will work for users with voice in #yourchan. Other users cannot manipulate your bot without being in it's presence.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

That doesn't seem to work, even though I used .chanset #EPL +mytopic and added the user with a +v flag, and he is voiced on the channel.


[17:45] Tcl error [cmd:topic]: invalid command name "botison"
Idling at #Football, Quakenet.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Replace "botison" with "botonchan".
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Sir_Fz wrote:Replace "botison" with "botonchan".
DOH! Sir_Fz to the rescue.. ;)
Thanks for the save.. keke
Post Reply