mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Ban script, with read #210498 18/03/09 10:12 AM
Joined: Mar 2009
Posts: 6
M
mikkisofta Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2009
Posts: 6
I know I'm very bad script writer but how I can make this work correctly ?

on *:text:*:#: { $read(urls.txt) { $ifmatch { /mode $chan +b $nick | /kick # $nick No Advertiseing !
}
}
}

That works, but not right.. Some1 say some url my bot kicks hime/her.. And I want that my bot reads that text file I specified and kick if the url is there..

Re: Ban script, with read [Re: mikkisofta] #210500 18/03/09 12:08 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:text:*:#:{
if $read(urls.txt,w,$+(*,$1,*)) {
.ban -k $chan $nick No advertising
}
}

This will check the text file for a match to the first word entered. There are excellent regex methods of restricting the match text section of the ON TEXT event to just a URL format.
Then the actual URL can be checked, no matter if the URL is the first word or not. Unfortunately I'm still in the process of waking up and not thinking straight enough to provide the regex.

Last edited by RusselB; 18/03/09 12:57 PM.
Re: Ban script, with read [Re: RusselB] #210501 18/03/09 12:34 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
Regex is great when you want to match any link, here he want to match only link that are in his file.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Ban script, with read [Re: Wims] #210502 18/03/09 12:46 PM
Joined: Mar 2009
Posts: 6
M
mikkisofta Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2009
Posts: 6
Hmm.. Not working.. Where is should put that text file ?

I mean like this;

text file:

http://www.examble.com
http://examble.com
http://ThisIsExamble.com


mikkisofta: http://www.examble.com
Bot: set +b & kick.

mikkisofta: http://haveaniceday.org
Bot: nothing.

Re: Ban script, with read [Re: mikkisofta] #210503 18/03/09 12:57 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code modified to allow for any of the examples that you posted.

Remember that the URL in the text file must match that of the URL that is posted in the channel.

Quote:
mikkisofta: http://haveaniceday.org
Bot: nothing.

The bot does nothing in this case, since you don't have http://haveaniceday.org in your text file (according to the samples you provided).


Re: Ban script, with read [Re: mikkisofta] #210504 18/03/09 03:03 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
As an alternative, the script below will capture forbidden urls inside messages without the need to specify possile variations of the protocoll for each. It's the best method using $read for this task I can think of atm, though there may be a bether one, and $read isn't the best choice for this kind of matching at all. As long as you don't have an excessivly long list of urls, it may be sufficient.

Put all forbidden "urls" inside a textfile named "forbiddenurls.txt" located in your mirc main directory, each on a separate line.
DON'T add the protocol like http:// or host (www.) there, start at the domain part. You may use wildcards.
Examples:
for "www.google.com" add: google.com
for "http://forums.mirc.com" add: forums.mirc.com

The script will check all words that contain either the protocol "http://", "https://" "ftp://", or "www.". If any line in the textfile matches the text following the protocol, it will issue the kickban.

Example:
If you have e.g. in the textfile the line: test123.com
It will ban for messages:
"www.test123.com"
"Gratis testing? >http://www.test123.com<"
"check out http://test123.com/tests/something"

It won't ban for:
"www.anothertest123.com"
"I really like test123.com"


Code:
on @*:text:*:#YOURCHAN: { urlcheck $1- }
on @*:action:*:#YOURCHAN: { urlcheck $1- }

alias -l urlcheck {
  noop $regex($strip($1-),/(?:(?:http|https|ftp):\/\/|www\.)(?:www\.)?(\S+)/gi) 
  var %a = 1
  while ($regml(%a)) {
    var %b = 1
    while ($read(forbiddenurls.txt,%b)) {
      if ($+($v1,*) iswm $regml(%a)) {
        ban -k $chan $nick 1 No advertising!
        return
      }
      inc %b
    }
    inc %a
  }
}

(the regex is far from perfect, but it should work)

Re: Ban script, with read [Re: Horstl] #210505 18/03/09 03:42 PM
Joined: Mar 2009
Posts: 6
M
mikkisofta Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2009
Posts: 6
Originally Posted By: Horstl
As an alternative, the script below will capture forbidden urls inside messages without the need to specify possile variations of the protocoll for each. It's the best method using $read for this task I can think of atm, though there may be a bether one, and $read isn't the best choice for this kind of matching at all. As long as you don't have an excessivly long list of urls, it may be sufficient.

Put all forbidden "urls" inside a textfile named "forbiddenurls.txt" located in your mirc main directory, each on a separate line.
DON'T add the protocol like http:// or host (www.) there, start at the domain part. You may use wildcards.
Examples:
for "www.google.com" add: google.com
for "http://forums.mirc.com" add: forums.mirc.com

The script will check all words that contain either the protocol "http://", "https://" "ftp://", or "www.". If any line in the textfile matches the text following the protocol, it will issue the kickban.

Example:
If you have e.g. in the textfile the line: test123.com
It will ban for messages:
"www.test123.com"
"Gratis testing? >http://www.test123.com<"
"check out http://test123.com/tests/something"

It won't ban for:
"www.anothertest123.com"
"I really like test123.com"


Code:
on @*:text:*:#YOURCHAN: { urlcheck $1- }
on @*:action:*:#YOURCHAN: { urlcheck $1- }

alias -l urlcheck {
  noop $regex($strip($1-),/(?:(?:http|https|ftp):\/\/|www\.)(?:www\.)?(\S+)/gi) 
  var %a = 1
  while ($regml(%a)) {
    var %b = 1
    while ($read(forbiddenurls.txt,%b)) {
      if ($+($v1,*) iswm $regml(%a)) {
        ban -k $chan $nick 1 No advertising!
        return
      }
      inc %b
    }
    inc %a
  }
}

(the regex is far from perfect, but it should work)



Just this I ment.

Because I don't need script which ban all who say some url, ONLY them who say URL which is in text file. I'll test this script later today.

Re: Ban script, with read [Re: mikkisofta] #210509 18/03/09 05:31 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
If you want the exact match for url links that you specified in your urls.txt, this should do it:
Code:
on *:TEXT:*:#: {
  var %x = $lines(urls.txt)
  while (%x) {
    if ($read(urls.txt,%x) isin $1-) {
      ban -k # $nick 2 $v1 is forbidden to advertise!
    }
    dec %x
  }
}

Re: Ban script, with read [Re: Tomao] #210513 18/03/09 07:26 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
This code is very inefficient :/, check what was already given using $read(file,w,)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Ban script, with read [Re: Wims] #210514 18/03/09 07:42 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Wims, I did try Russel's before I posted mine. Russel's will kick on anything beginning with www or http with or without a dot by them. And it won't trigger anything if one posts: welcome to http://www.blah.com or just welcome to www.blah.com without http://, meaning to start with a sentence with an url in it.

Re: Ban script, with read [Re: Tomao] #210515 18/03/09 07:59 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
I'm talking about your method, not the code itself


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Ban script, with read [Re: Wims] #210519 18/03/09 08:35 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Rather than busting my chops, could you kindly show me your version of efficient method looks like?

Re: Ban script, with read [Re: Tomao] #210522 18/03/09 08:48 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
The one RusselB used in his first post, with $read ,w, smile
I'm just saying that you're not using a good way of doing something, that's all


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Ban script, with read [Re: Wims] #210526 18/03/09 09:36 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Wims, no offense. But you're not being forthcoming to point out the right way of going at this, and you're keeping me baffled.

Re: Ban script, with read [Re: Tomao] #210532 19/03/09 12:24 AM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
No offense wink
I'm saying you're using an inefficient method because you're doing a /while on each line in the file whereas the ,w, parameter of $read already do this itself.
But I agree that the way you're checking for a match isn't the same as $read(,w,), I should not have compared the two situation sorry.

Last edited by Wims; 19/03/09 12:24 AM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Ban script, with read [Re: Wims] #210546 19/03/09 06:02 AM
Joined: Mar 2009
Posts: 6
M
mikkisofta Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2009
Posts: 6
Where I should put that text file ? shocked

I tried both of those scripts, nothing happend.. Wtf I'm doing wrong with this ?

Re: Ban script, with read [Re: mikkisofta] #210548 19/03/09 06:47 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Make sure the text file is placed in mirc's directory, and the links you wish to kick are jotted down in the text file one per line.

Re: Ban script, with read [Re: Tomao] #210824 26/03/09 08:51 PM
Joined: Mar 2009
Posts: 6
M
mikkisofta Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2009
Posts: 6
I give up.. I've tried all the scripts on this page, nothing happened.. My bot didn't kick user who say url specified on urls.txt. My bot is running on the lates mIRC so I can't understoot whats wrong..

I think I've to do script like this:

on *:text:*http*:#: { /mode # $nick +b { -k Do not advertise } }

I even don't know will that work, but I'll try.. I hate that ppl are advertising on my channel!

Re: Ban script, with read [Re: mikkisofta] #210827 26/03/09 09:32 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Give this one a shot:
Code:
on *:TEXT:*:#: {
  if ($regex($1-,/(?<=^| )((?>[a-zA-Z-0-9]{3,8}:\/\/|www\.)\S+)/g)) || ($regex($1-,/(\.[a-zA-Z-0-9]{3,8}))) {
    ban -k $chan $nick 2 Do not advertise!
  }
}

Last edited by Tomao; 26/03/09 09:35 PM.
Re: Ban script, with read [Re: mikkisofta] #210830 26/03/09 10:31 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
At trying my suggestion, did you
- put a file "forbiddenurls.txt" in the main directory of the mIRC serving as your bot ( //echo -a $mircdir in the bot client)
- add url entries to this file as described: without http or www or the like
- replace "#YOURCHAN" in the code (2 instances) with the actual channel name or channel names
- make sure the bot running the script was @ in this channel
?

Page 1 of 2 1 2