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.

ban someone who types ???? or !!!!

Old posts that have not been replied to for several years.
Locked
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

ban someone who types ???? or !!!!

Post by Bytez »

Hi, I want my bot to ban people who type 4 or more consecutive ???? or !!!! after a sentence, or just by itself. How can I do this?

Code: Select all

bind pubm - *!!!!* kickass

proc kickass { nick host hand chan text } {
if {[matchattr $hand o|o $chan]} return
putserv "KICK $chan $nick :kicked for using 4 consecutive !!!!"

}
This didn't work, it kicked when people used 2 consecutive ?? and when they type :) and ;-)

Thanks!
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

could you rephrase your question ?
XplaiN but think of me as stupid
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I think the bind should be:

bind pubm - *\!\!\!\!* kickass
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

and what would that do ?
XplaiN but think of me as stupid
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

well my bad, I thought ! is a wildcard like ? * % ~ . but no

then try:

Code: Select all

bind pubm - * kickass

proc kickass {nick uhost hand chan arg} {
if {[string match [split $arg] "*!!!!*"] || [string match [split $arg] "*\?\?\?\?*"]} {
putserv "KICK $chan $nick :kicked for using 4 consecutive !!!!/????"
 }
}
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The [string match [split $arg] "*\?\?\?\?*"] should actualy be [string match "*\?\?\?\?*" [split $arg]] because is a match of a string against something, not something against a string like you did. Anyway, is not good. Demonstration:

Code: Select all

bind pubm - * my:bla

proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\?\?\?\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
(07:05) (caesar) ????
(07:05) (@bot) match!
(07:05) (caesar) ?aaaaa
(07:05) (@bot) match!
and with

Code: Select all

bind pubm - * my:bla

proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\\\?\\\?\\\?\\\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
do you notice any difference? ;)
(07:07) (caesar) ?aaaaa
(07:07) (caesar) ????
(07:07) (@bot) match!
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

using \\ would work right I guess too?
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:and with

Code: Select all

bind pubm - * my:bla

proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\\\?\\\?\\\?\\\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
ok... first off....
string match (as the name suggests) performs an operation on a string.
the variable text is a string.
split converts a string into a list.

Thus... we nix the split altogether, as 'string match' is a string function, not a list function. which gives us...

Code: Select all

if {[string match -nocase "*\\\?\\\?\\\?\\\?*" $text]} {
Secondly, you can save on keystrokes by using {}'s instead of "'s and removing some of the back slashes:

Code: Select all

if {[string match -nocase {*\?\?\?\?*} $text]} {
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Duno whty I've added the split there.. :) Your sugestion is good also.. :P
Once the game is over, the king and the pawn go back in the same box.
Locked