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 keep

Old posts that have not been replied to for several years.
y
yvovandoorn
Voice
Posts: 15
Joined: Thu Apr 17, 2003 1:20 pm

topic keep

Post by yvovandoorn »

Is there a tcl that has the ability to do the following... When an op changes the topic that it keeps part of the topic. For example (and just for example)

If Op A changes the topic to: I am a nerd, leave me alone
a bot does the following:
Welcome to #win98 || I am a nerd, leave me alone

So whenever an op changes the topic a bot appends it with a default text before what ever the op changes it too.

Another example:
Op A changes the topic to: Boy this sucks
a bot does the following:
Welcome to #win98 || Boy this sucks

Hope that makes sense.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

bind topc -|- "#chan *" topc:check
proc topc:check { nick userhost handle chan topic } {
  if { ( $nick == $::botnick ) } {
    return 0
  }
set static "welcome to $chan || "
puthelp "TOPIC $chan :$static $topic"
}

something like that :)
photon?
y
yvovandoorn
Voice
Posts: 15
Joined: Thu Apr 17, 2003 1:20 pm

Post by yvovandoorn »

awesome

this will only work in one channel right. The bots are in multiple channels and I know some channels would hate this.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

yes, in the bind you specify what chan its triggered in

"#yourchannel *"
photon?
y
yvovandoorn
Voice
Posts: 15
Joined: Thu Apr 17, 2003 1:20 pm

Post by yvovandoorn »

One more question...

(I don't know anything of TCL heh)

Is it possible so if someone updates the topic and the static part is already in place is that it wont add it again.

For example...
Op A sets topic to I am a nerd
Bot changes topic to Welcome to #win98 || I am a nerd
Op B edits the topic by adding a ! to nerd
Bot changes topic to Welcome to #win98 || Welcome to #win98 || I am a nerd!

Is it possible that the script doesn't add it again?
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

I'm not sure but try this:

Code: Select all

bind topc -|- "#chan *" topc:check 
proc topc:check { nick userhost handle chan topic } {
set static "welcome to $chan || "
  if { ( $nick == $::botnick ) } { 
    return 0 
  } 
if {[string match $static $topic]} {
putlog "The new topic already contains the static part. I'll not change it."
return 0
}
puthelp "TOPIC $chan :$static $topic" 
} 
«A fantastic spaghetti is a spaghetti that does not exist»
y
yvovandoorn
Voice
Posts: 15
Joined: Thu Apr 17, 2003 1:20 pm

Post by yvovandoorn »

Nope it doesn't work

but I really appreciate the help guys.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

bind topc -|- "#chan *" topc:check
proc topc:check { nick userhost handle chan topic } {
  set static "welcome to $chan ||"
  if { ( $nick == $::botnick ) } {
    return 0
  }
  if { [string match "$static *" $topic] } {
    return 0
  }
puthelp "TOPIC $chan :$static $topic"
}

putlog "topic.tcl loaded"
realz just forgot a wildcard in the match pattern :wink:
string match ?-nocase? pattern string
* Matches any sequence of characters in string, including a null string.
photon?
y
yvovandoorn
Voice
Posts: 15
Joined: Thu Apr 17, 2003 1:20 pm

Post by yvovandoorn »

great, it works.

thanks for all the help spock & realz.
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

HMM it doesn`t work on my BOT, What I have done wrong

Code: Select all

bind topc -|- "#kaarel *" topc:check 
proc topc:check { nick userhost handle chan topic } { 
  set static "welcome to $chan ||" 
  if { ( $nick == $::botnick ) } { 
    return 0 
  } 
  if { [string match "$static *" $topic] } { 
    return 0 
  } 
puthelp "TOPIC $chan :$static $topic" 
} 

putlog "topic.tcl loaded" 
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

my bot says to me <Botman> [18:46] Tcl error [topc:check]: invalid command name "? "
<Botman> [18:47] Tcl error [topc:check]: invalid command name "? "
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

"?" isnt used anywhere in the script as far as i can tell.

you must've injected it
photon?
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

spock wrote:"?" isnt used anywhere in the script as far as i can tell.

you must've injected it

injected what?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

the questionmark --> ?

.tcl ?
<bot> TCL error: invalid command name "?"

.tcl invalidcommand
<bot> TCL error: invalid command name "invalidcommand"


and there shouldnt be any questionmark in the script so you must've put it there.
photon?
E
EEggy
Op
Posts: 122
Joined: Thu Sep 26, 2002 11:46 pm

Post by EEggy »

Hi, that works great, but just wondering if someone set the topic manually, instead of using the bot, then is there anyway when person will set the topic manually and bot will grab that topic and check the default text, if not then append the default text to it and set it.?

let say default text is welcome to $chan

thanks
EEggy
Locked