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.

need help: advertising revenge

Old posts that have not been replied to for several years.
Locked
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

need help: advertising revenge

Post by eiSi »

hi there!

I want to code a little script.

For example someone says: Hello there! Join #thischannel now!!!

I want the bot to kick the user (that's no problem), join #thischannel and says a specific line.

My problem: How to get #thischannel saved in a var?

Thanks for any help!
Greetz,
eiSi
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

by using a regexp probably ...

e.g. if what he says is stored in the var $rest it would be something like this:

Code: Select all

regexp -line -- {#(.*) } $rest -> chan
$chan will be the channame without the # ...
It is a mistake to think you can solve any major problems just with potatoes.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thx!

than 2 other questions (sorry...):

what about string manipulation? how to add the # to the front?
that regexp doesn't work, i tried it that way:

proc blocked:words {nick uhost handle chan text} {
set chan [regexp -line -- {#(.*) } $text]
puthelp "PRIVMSG #bot-hub : $chan"
}

but it says: "0".

whats that? can you help me again please? thanks!!
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

Use the regexp just like it was in my post. (more information about regexp: http://www.tcl.tk/man/tcl8.4/TclCmd/regexp.htm
And for the String manipulation, just put a # in front of $chan would do the job (e.g. set chan "#$chan")

Code: Select all

proc blocked:words {nick uhost handle chan text} { 
regexp -line -- {#(.*) } $text -> chan
set chan "#$chan"
puthelp "PRIVMSG #bot-hub : $chan" 
} 
It is a mistake to think you can solve any major problems just with potatoes.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thx, but it won't work:
that's my proc:

proc blocked:words {nick uhost handle chan text} {
set revchan ""
regexp -line -- {#(.*) } $text -> revchan
set revchan "#$revchan"
puthelp "PRIVMSG #bot-hub : $revchan"
}

but it says: "#"

thanks again!!! :) and sorry for me posting again :roll:
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

hmz well, did your the chan in your message end with a space? if you would say something like "join #chan" it will not work, if you say "join #chan now" it will work ... there is a space after the (.*) in the regexp to make sure he only takes the first word after the # ... perhaps a better way to do this is, is to take everything and split it into a list:

Code: Select all

proc blocked:words {nick uhost handle chan text} { 
set revchan "" 
regexp -line -- {#(.*)} $text -> revchan 
set revchan "#[lindex [split $revchan] 0]" 
puthelp "PRIVMSG #bot-hub : $revchan" 
} 
allthough you can probably do all this in one regexp, this works for me ;-)
Last edited by mortician on Tue Jun 10, 2003 2:51 am, edited 1 time in total.
It is a mistake to think you can solve any major problems just with potatoes.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thanks!

but for me it's the same error.

if I type: #asd
it says: #
if I type: #asd now
it says: #asd

hm, I don't know the error, but I'll have a closer look at it tomorrow.

thanks for your help!
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Code: Select all

proc blocked:words {nick uhost handle chan text} {
  set revchan ""
  regexp {(#\S+)} $text match revchan
  puthelp "PRIVMSG #bot-hub :$revchan"
}
Just a note, though: I've seen many times that people will spam for a particular channel in order to get people angry at that channel. For instance, if #sheep bans baduser, then baduser might set up a spambot to join every channels and say "join #sheep now!!" because it annoys everybody, and some people take revenge on #sheep, when they didn't really even do it.

So the moral is, you should be careful with this, because you might be doing more harm than good.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

yep, thanks for the info.

I don't want to use that.. a friend of mine wants to.. I told him your remark...

thanks anyway! now it works fine!
Locked