mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2021
Posts: 7
K
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2021
Posts: 7
Hi, I don't know if it is possible to create this type of script but I will try to explain anyway.

A lot of people on the channel where I am evade bans on forbidden words using special characters and things like that.

For example, there are people who spam their contacts (let's take the telegram contact for example) by saying they offer paid photos and videos and then scam those who believe in them.

If I block the word "telegram", then they use special characters to write it and avoid the ban, for example by using ๐“ฃ๐“ฎ๐“ต๐“ฎ๐“ฐ๐“ป๐“ช๐“ถ.

I would like to cut off the head of the bull and know if it is possible to create a script (with the ability to activate and deactivate it) that will ban any message that does not contain the characters entered in the script.

So, something like this: a script that contains the normal letters of the alphabet, the exlamation and question mark and the numbers (with the possibility to add and remove what you want) and which then ban any message in the channel (/say and /me also) that contains anything else: emoticons, special characters, and so on. All. Anything that is not in the script. So you can only write messages with the characters contained in the script.

Would it be possible to create such a script?

Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
You can try using the script I created especially for you.

Allow Chars v1.0 โ€“ description:

โ€‡โ€‡1.This script controls the use of only those characters in channel messages that are allowed and listed in the variable "%ach_characters". Otherwise, the user will receive "Kiัk+Ban".
โ€‡โ€‡2.In the alias "allowchars_set" you can remake all the settings for this script by changing the values of the variables:

โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_work โ€“ configures the enable or disable of the script. The options are: <yes|no>.
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_kick โ€“ configures whether to enable or disable execution "Kick" for the offender. The options are: <yes|no>.
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_ban โ€“ configures whether to enable or disable execution "Ban" for the offender. The options are: <yes|no>.
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_reason โ€“ configures the reason for the ban, which will be indicated in the kick message. (You can change this to your text).
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_btype โ€“ configures the type (format) of the ban for the offender. More details about the types of bans are described here: $mask. Default: <2>.
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_btime โ€“ contains the time (in seconds) for which a temporary ban will be set, and after which it will be automatically canceled on the channel. If you do not want to remove the ban, then set: <0>.
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_exceptpref โ€“ contains prefixes of symbols (channel operator status) for which there will be an exception and the script will not react to these users. Default: <[!~&@%+]>. (You can change this to other prefixes).
โ€‡โ€‡โ€‡โ€‡โ€‡โ€‡%ach_characters โ€“ contains all characters that are allowed for use in channel messages. (You can change or add to this set your national valid characters Unicode and Emoji).

Screenshot for demo operability of the script's:

โ€‡โ€‡โ€‡โ€‡ โ€‡[Linked Image from i.ibb.co]

The script was tested on InspIRCD v3 + mIRC v7.67.

Click on the button to reveal the spoiler. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R" and save this code as new "File/New" script called "AllowChars.mrc":

Code
#####################################################################
#   Name: Allow Chars v1.0
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Allows to use in channel messages only those characters that are specified in the script.
#####################################################################

alias -l allowchars_set {
  %ach_work = yes
  %ach_kick = yes
  %ach_ban = yes
  %ach_reason = There are forbidden characters in your message!
  %ach_btype = 2
  %ach_btime = 3600
  %ach_exceptpref = [!~&@%+]
  %ach_characters = [abcdefghijklmnopqrstuvwxyz0123456789^`'"*#โ„–@%$&(){}[]|\/<>:;!?+=-~,._]
}
on *:TEXT:*:#: allowchars $nick $chan $1-
on *:ACTION:*:#: allowchars $nick $chan $1-
alias -l allowchars {
  allowchars_set | var %ach_pnick $remove($nick($2,$1).pnick,$1)
  if (%ach_work == yes && %ach_pnick !isin %ach_exceptpref) {
    var %text $remove($strip($3-),$chr(32))
    if ($checkchars(%text) == false) allowchars_ban $1 $2
  }
}
alias -l checkchars {
  var %chars $remove(%ach_characters,$left(%ach_characters,1),$right(%ach_characters,1))
  var %i 1 | while (%i <= $len($1)) { if ($mid($1,%i,1) !isin %chars) { return false | break } | inc %i } | return true
}
alias -l allowchars_ban {
  if (%ach_kick == yes) {
    if ($len(%ach_reason) > 1) var %ach_kr %ach_reason | else var %ach_kr -
    .kick $2 $1 %ach_kr
  }
  if (%ach_ban == yes) {
    if (!%ach_btype) %ach_btype = 2 | if (%ach_btime > 0) var %ach_key $+(-u,%ach_btime)
    .ban %ach_key $2 $1 %ach_btype
  }
}


Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.
If you find any errors in the code and in its work, or maybe you have new ideas or if you think that this script needs to be improved, then be sure to write to me here about it, and we are together think about what we can do.



๐ŸŒ http://forum.epicnet.ru ๐Ÿ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Your script will be somewhat slower than it needs to be. It's doing a scripted comparison of the message against the list of allowed characters. It would be much faster to let that comparison loop happen inside the $regex identifier.

https://en.wikichip.org/wiki/mirc/regex

The simplest verify against the allowed list would look something like:

//echo -a $regex(string,/[^abcdef]/u)

This looks at the string and checks to see if it can find a character that is NOT on the list. As soon as it does, $regex returns '1' indicating the number it found. If you're interested in how many bad characters there are, you can change the /u to /ug and it will return the number of matches instead of 1. But this will take slightly longer since it doesn't return as soon as it finds something not on the list.

With this method, you can also avoid the $remove of the spaces by simply having spaces be as part of your list.

If you want to allow color/control codes without needing to put them into %allowed you can add the "S" flag by changing /u to /uS. The /u identifier is not needed until you start putting codepoints outside the normal 7-bit text range, but it's harmless to leave it there. Without the /u flag, if it encounters a codepoint above 127, it instead sees the individual bytes making up the UTF8 encoding, instead of seeing the codepoint character.

Inside the [list] you need to make sure that any chars with special meaning have been 'escaped' by preceding them with a \backslash. For example, if you have a hyphen in the list that's not in the first/last position, it behaves like a range, so [^a-z] means the range 'a' THROUGH 'z' not the 2 letters and the hyphen. The ^ as the 1st character means 'not the following characters, but anywhere else it means the literal carat.

So, just to be safe, you should preced these characters with a backslash: []-^\

Just to be clear, there are other characters having special meaning in other places in a regex pattern, but not inside the [list].

//var %string foo bar , %allowed !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ | var -s %pattern $+( /[^, $replacecs(%allowed,\,\\,[,\[,],\],-,\-,^,\^) ,]/u) | echo -a $regex(%string,%pattern)

Note how this example returns a '1' because the string contains a space which I didn't put in the list. But as soon as you add the space anywhere inside the %allowed list, then it reports 0 (zero characters not in the list).

If you change it so you do not $replacex "-" with "\-" then you can have the variable be much shorter, because you can have ranges defined by the characters sandwiching the hyphen. Instead of listing the entire alphabet, you can just have A-Z. If you want to avoid listing the A-Z a-z alphabet twice, you can add the 'i' flag, changing /u to /ui. The /i flag seems to only see case-insensitive within the A-Z and a-z ranges, and not among the accented characters above codepoint 127.

While only those 5 characters have special meaning in a regex [list], there are other characters that you'll have trouble with if you try to use them literally inside the $regex() identifier. But only because they have special meaning to mIRC, such as commas, parenthesis, dollars, etc. But by parking them in a %variable like you did, that also avoids a lot of problems.

Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
Actually, I originally wanted to use regular expressions to check when creating such a script, but faced the difficulty of building a regex and the confusion of implementing this idea. In addition, provided that for some special characters it is necessary to use escaping these characters with a backslash "\" and also follow some other regex rules, this can cause difficulties and questions for most users when editing and configuring the script. It is also likely that some users, for some reason, may need to use only a certain limited set of characters, maybe not even the entire English alphabet (or mixed with other national characters) and also possibly not with all numbers, etc. Therefore, I decided to do it easier, to the detriment of efficiency, but with the ability to manually enumerate all the necessary symbols to resolve them in messages.

Nevertheless, I will try to figure it out with this, to would improve the script and make it more efficient, taking into account your useful advice and recommendations.

Thanks to you for the sufficiently meaningful capacious post and a detailed explanation of how to use $regex. Undoubtedly, this information will be useful both to me and to many other scripters.


๐ŸŒ http://forum.epicnet.ru ๐Ÿ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
If you're certain the script is not going to forbid any of the normal 7-bit text characters, you can use a much simpler range regex that avoids all the issues of escaping those 5 special characters.

/[^\x20-\x7e]/uS

The above regex pattern looks for anything that's not in the $chr(20) through $chr(126) range where the space and the 95 7-bit text characters exist. If you want to include additional accented characters above codepoint 126, you can include them literally inside the [^list] Since this range includes the A-Z and a-z, there's no need for a case-insensitive /i flag.

That makes the regex much simpler, and the /S flag there is if you're wanting to allow colors/bold/etc. Instead of listing the literal accented letters, they can be listed in the \xformat, however if the codepoint is above 255 it needs to be wrapped inside {brackets}. i.e. \x31 is the number '1', but codepoint 10004 is \x{2714}
If you want to put allowed emojis on the list, you can either put the literal emoji symbol into the %allowed list, or include something like the black cat emoji at codepoint 128049 is \x{1f431}

if you change the above regex pattern to have parenthesis around it, you can retrieve the offending symbol.

/([^\x20-\x7e])/uS

This will put the 1st encountered not-allowed character into $regml(1)

Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
At your request in personal correspondence made several changes and improvements in the script. Please tested the script before using it.

Allow Chars v1.1 โ€“ updates:

โ€‡โ€‡1.Now instead of setting through an alias "allowchars_set" you can customize the script through the channel Menu or the bar Menu, by right-clicking. (All missing variables will be set by default).
โ€‡โ€‡2.Now messages will be checked through regular expressions, instead of loops (while), which in the past could lead to a slowdown in the script with a large number of messages. (Thanks "maroon").
โ€‡โ€‡3.Now in the variable "%ach_btype" you can specify several values of the ban type at once separated by commas (to install several bans at once on the intruder) or leave only one number. Default: <2,3>.
โ€‡โ€‡4.Now instead of the variable "%ach_characters" will be used the variable "%ach_charfile" to specify the full path to the text file, where you can write all the characters allowed. (Within reasonable limits).


An example of how can be filled the file "allowchars.txt" which was specified in the variable "%ach_charfile":
Code
abcdefghijklmnopqrstuvwxyz
ะฐะฑะฒะณะดะตั‘ะถะทะธะนะบะปะผะฝะพะฟั€ัั‚ัƒั„ั…ั†ั‡ัˆั‰ัŠั‹ัŒััŽั
0123456789^`'"*#โ„–@%$&(){}[]|\/<>:;!?+=-~,._
๐Ÿ˜€๐Ÿ˜‰๐Ÿ˜๐Ÿ˜†๐Ÿ˜…๐Ÿ˜‚๐Ÿคฃ๐Ÿ˜Š๐Ÿ™‚๐Ÿ˜„๐Ÿ™ƒ๐Ÿ˜‡๐Ÿ˜ƒ๐Ÿ˜š๐Ÿฅฐ๐Ÿ˜™โ˜บ๐Ÿ˜๐Ÿ˜—๐Ÿฅฒ๐Ÿ˜˜๐Ÿคฉ๐Ÿ˜‹๐Ÿ˜›๐Ÿ˜œ๐Ÿคช๐Ÿ˜๐Ÿค‘๐Ÿค”๐Ÿคญ๐Ÿค—๐Ÿคซ๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜ถ๐Ÿ˜ฌ๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ™„๐Ÿค๐Ÿคฅ๐Ÿ˜Œ๐Ÿ˜”๐Ÿ˜ช๐Ÿ˜ด๐Ÿคค๐Ÿฅถ๐Ÿคง
๐Ÿ˜ท๐Ÿคฏ๐Ÿฅด๐Ÿ˜ต๐Ÿค’๐Ÿฅต๐Ÿคฎ๐Ÿค•๐Ÿคข๐Ÿฅธ๐Ÿค ๐Ÿฅณ๐Ÿค“๐Ÿ˜Ž๐Ÿง๐Ÿ˜•๐Ÿ˜–๐Ÿ˜ง๐Ÿฅบ๐Ÿ˜ซ๐Ÿ˜ฑ๐Ÿ˜ž๐Ÿ˜ฏ๐Ÿ˜ฎ๐Ÿ˜ญ๐Ÿ˜Ÿ๐Ÿ˜“๐Ÿ˜ฉ๐Ÿ˜ข๐Ÿ˜ฒ๐Ÿ˜จ๐Ÿฅฑ๐Ÿ˜ณ๐Ÿ™๐Ÿ˜ฅ๐Ÿ˜ฃ๐Ÿ˜ฆโ˜น๐Ÿ˜ฐโ˜ ๐Ÿ˜ค๐Ÿ˜ˆ๐Ÿ˜ก๐Ÿ’€๐Ÿ‘ฟ๐Ÿคฌ๐Ÿ˜ 
๐Ÿ’ฉ๐Ÿคก๐Ÿค–๐Ÿ‘ฝ๐Ÿ‘พ๐Ÿ‘ป๐Ÿ‘บ๐Ÿ‘น๐Ÿ™€๐Ÿ˜ฝ๐Ÿ˜ธ๐Ÿ˜ฟ๐Ÿ˜พ๐Ÿ˜ป๐Ÿ˜บ๐Ÿ˜ผ๐Ÿ˜น๐Ÿ™‰๐Ÿ™Š๐Ÿ™ˆ


Click on the button to reveal the spoiler. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R" and replace with this code the old code, then save it under the name "AllowChars.mrc":

Code
#####################################################################
#   Name: Allow Chars v1.1
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Allows to use in channel messages only those characters that are specified in the script.
#####################################################################

alias -l allowchars_set {
  if (!%ach_work) %ach_work = yes
  if (!%ach_kick) %ach_kick = yes
  if (!%ach_ban) %ach_ban = yes
  if (!%ach_reason) %ach_reason = There are forbidden characters in your message!
  if (!%ach_btype) %ach_btype = 2,3
  if (!%ach_btime) %ach_btime = 30
  if (!%ach_exceptpref) %ach_exceptpref = [+%@&~!]
  if (!%ach_charfile) %ach_charfile = scripts\Allowะกhars\allowchars.txt
}
menu menubar,status,channel {
  Allow Chars
  .Work
  ..Enable: %ach_work = yes | .echo -a "Allow Chars" - Script:03 enabled.
  ..Disable: %ach_work = no | .echo -a "Allow Chars" - Script:04 disabled.
  .Characters
  ..File: allowchars_set | .run %ach_charfile
  ..Path: var %p $$?="Enter the full path to the file with allowed characters:" | if ($len(%p) > 0) { %ach_charfile = %p | .echo -a "Allow Chars" - The path to the file:03 %ach_charfile }
  .Kick
  ..Enable: %ach_kick = yes | .echo -a "Allow Chars" - Kick:03 enabled.
  ..Disable: %ach_kick = no | .echo -a "Allow Chars" - Kick:04 disabled.
  ..-
  ..Reason: var %r $$?="Enter the reason for the kick:" | if ($len(%r) > 0) { %ach_reason = %r | .echo -a "Allow Chars" - Kick reason:03 %ach_reason }
  .Ban
  ..Enable: %ach_ban = yes | .echo -a "Allow Chars" - Ban:03 enabled.
  ..Disable: %ach_ban = no | .echo -a "Allow Chars" - Ban:04 disabled.
  ..-
  ..Type: var %t $$?="Enter one or more types of bans separated by commas:" | if ($len(%t) > 0) { %ach_btype = %t | .echo -a "Allow Chars" - Ban type:03 %ach_btype }
  ..Time: var %t $$?="Enter the number of seconds after which you want to remove the ban:" | if ($len(%t) > 0) { %ach_btime = %t | .echo -a "Allow Chars" - Ban time:03 %ach_btime }
  .Except: var %p $$?="Enter the prefixes of the channel operators to exclude:" | if ($len(%p) > 0) { %ach_exceptpref = $+([,$remove(%p,]),]) | .echo -a "Allow Chars" - Except prefix:03 %ach_exceptpref }
}
on *:TEXT:*:#: allowchars $nick $chan $1-
on *:ACTION:*:#: allowchars $nick $chan $1-
alias -l allowchars {
  allowchars_set | var %ach_pnick $remove($nick($2,$1).pnick,$1)
  if (%ach_work == yes && %ach_pnick !isin %ach_exceptpref) {
    var %text $remove($3-,$chr(32))
    if ($exists(%ach_charfile)) {
      var %c 1 | while (%c <= $lines(%ach_charfile)) { %chars = $+(%chars,$read(%ach_charfile,n,%c)) | inc %c }
      var %pattern $+(/[^,$replacecs(%chars,\,\\,[,\[,],\],-,\-,^,\^),]/iuS) | unset %chars
      if ($regex(%text,%pattern) > 0) allowchars_ban $1 $2
    }
  }
}
alias -l allowchars_ban {
  if (%ach_ban == yes) {
    if (!%ach_btype) %ach_btype = 2 | if (%ach_btime > 0) var %ach_key $+(-u,%ach_btime)
    var %i 1 | while (%i <= $numtok(%ach_btype,44)) { .ban %ach_key $2 $1 $gettok(%ach_btype,%i,44) | inc %i }
  }
  if (%ach_kick == yes) {
    if ($len(%ach_reason) > 1) var %ach_kr %ach_reason | else var %ach_kr -
    .kick $2 $1 %ach_kr
  }
}


Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.
If you find any errors in the code and in its work, or maybe you have new ideas or if you think that this script needs to be improved, then be sure to write to me here about it, and we are together think about what we can do.


๐ŸŒ http://forum.epicnet.ru ๐Ÿ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Sep 2021
Posts: 7
K
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2021
Posts: 7
As Epic also wrote while working on the script I was in contact with him to try to create the best version of the script.

A perfect job came out of it smile

Thank you so much for your availability and expertise, Epic!

Being on a net that, at least at the moment, does not have many settings to counter this kind of messages, spam and such, this script in combination with badwords and badnicks will surely be useful for me to clean up the channel a bit!
Maybe it will be useful to other users too smile

So, see you next time, thanks again for everything! : D

Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
At your request in personal correspondence, several new changes and improvements were made to the script code. Please tested the script before using it.

Allow Chars v1.2 โ€“ updates:

โ€‡โ€‡1.Now when you select the "Enable" or "Disable" item in the menu, a checkmark will be set on the left, indicating which item is currently selected.
โ€‡โ€‡2.Now when viewing menu items, the values of the configured parameters will be displayed next to the right in square brackets.
โ€‡โ€‡3.Now after each detected violation, an echo message with the name of the channel, user nick and the message for which he was banned will be displayed in the status window.
โ€‡โ€‡4.Now together with the space, all invisible characters (similar to space) will also be removed from the message (for ignored) when checking for valid characters. See all: Here (There is no need to list them in the file).
โ€‡โ€‡5.In the menu in the "Except" item, a new sub-item "Nicks" has been added so that you can specify a comma-separated list of nicknames for to exclude from checking. Default variable: %ach_exceptnick = Epic,krisb34213


Screenshot for demo operability of the script's:

โ€‡โ€‡[Linked Image from i.ibb.co]

Click on the button to reveal the spoiler. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R" and replace with this code the old code, then save it under the name "AllowChars.mrc":

Code
#####################################################################
#   Name: Allow Chars v1.2
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Allows to use in channel messages only those characters that are specified in the script.
#####################################################################

alias -l allowchars_set {
  if (!%ach_work) %ach_work = yes
  if (!%ach_kick) %ach_kick = yes
  if (!%ach_ban) %ach_ban = yes
  if (!%ach_reason) %ach_reason = There are forbidden characters in your message!
  if (!%ach_btype) %ach_btype = 2,3
  if (!%ach_btime) %ach_btime = 3600
  if (!%ach_exceptpref) %ach_exceptpref = [+%@&~!]
  if (!%ach_exceptnick) %ach_exceptnick = Epic,krisb34213
  if (!%ach_charfile) %ach_charfile = scripts\Allowะกhars\allowchars.txt
}
menu menubar,status,channel {
  Allow Chars
  .Work
  ..$iif(%ach_work == yes,$style(1)) Enable: %ach_work = yes | .echo -a "Allow Chars" - Script:03 enabled.
  ..$iif(%ach_work == no,$style(1)) Disable: %ach_work = no | .echo -a "Allow Chars" - Script:04 disabled.
  .Characters
  ..File $+([,$nopath(%ach_charfile),]): allowchars_set | if ($exists(%ach_charfile)) .run %ach_charfile
  ..Path $+([..\,$nopath(%ach_charfile),]): var %p $$?="Enter the full path to the file with allowed characters:" | if ($len(%p) > 0) { %ach_charfile = %p | .echo -a "Allow Chars" - The path to the file:03 %ach_charfile }
  .Kick
  ..$iif(%ach_kick == yes,$style(1)) Enable: %ach_kick = yes | .echo -a "Allow Chars" - Kick:03 enabled.
  ..$iif(%ach_kick == no,$style(1)) Disable: %ach_kick = no | .echo -a "Allow Chars" - Kick:04 disabled.
  ..-
  ..Reason: var %r $$?="Enter the reason for the kick:" | if ($len(%r) > 0) { %ach_reason = %r | .echo -a "Allow Chars" - Kick reason:03 %ach_reason }
  .Ban
  ..$iif(%ach_ban == yes,$style(1)) Enable: %ach_ban = yes | .echo -a "Allow Chars" - Ban:03 enabled.
  ..$iif(%ach_ban == no,$style(1)) Disable: %ach_ban = no | .echo -a "Allow Chars" - Ban:04 disabled.
  ..-
  ..Type $+([,%ach_btype,]): var %t $$?="Enter one or more types of bans separated by commas:" | if ($len(%t) > 0) { %ach_btype = %t | .echo -a "Allow Chars" - Ban type:03 %ach_btype }
  ..Time $+([,%ach_btime,]) sec: var %t $$?="Enter the number of seconds after which you want to remove the ban:" | if ($len(%t) > 0) { %ach_btime = %t | .echo -a "Allow Chars" - Ban time:03 %ach_btime }
  .Except
  ..Prefixes %ach_exceptpref: var %p $$?="Enter the prefixes of the channel operators to exclude:" | if ($len(%p) > 0) { %ach_exceptpref = $+([,$remove(%p,]),]) | .echo -a "Allow Chars" - Except prefixes:03 %ach_exceptpref }
  ..Nicks $+([,$numtok(%ach_exceptnick,44),]): var %n $$?="Enter all users nicks separated by commas that you want to exclude:" | if ($len(%n) > 0) { %ach_exceptnick = %n | .echo -a "Allow Chars" - Except nicks:03 %ach_exceptnick }
}
on *:TEXT:*:#: allowchars $nick $chan $1-
on *:ACTION:*:#: allowchars $nick $chan $1-
alias -l allowchars {
  allowchars_set | if (%ach_work == yes) {
    var %ach_pnick $remove($nick($2,$1).pnick,$1)
    if (%ach_pnick isin %ach_exceptpref) || ($istok(%ach_exceptnick,$1,44)) { halt }
    if ($exists(%ach_charfile)) {
      var %text $remove($3-,$chr(32),$chr(160),$chr(8194),$chr(8195),$chr(8196),$chr(8197),$chr(8198),$chr(8199),$chr(8201),$chr(8202),$chr(8203),$chr(8239),$chr(8287),$chr(12288),$chr(65279))
      var %c 1 | while (%c <= $lines(%ach_charfile)) { %chars = $+(%chars,$read(%ach_charfile,n,%c)) | inc %c }
      var %pattern $+(/[^,$replacecs(%chars,\,\\,[,\[,],\],-,\-,^,\^),]/iuS) | unset %chars
      if ($regex(%text,%pattern) > 0) { allowchars_ban $1 $2 | .echo -st "Allow Chars" Violation detected - Channel05 $2 Nick:05 $1 Message: $+("04,$3-,") }
    }
  }
}
alias -l allowchars_ban {
  if (%ach_ban == yes) {
    if (!%ach_btype) %ach_btype = 2,3 | if (%ach_btime > 0) var %ach_key $+(-u,%ach_btime)
    var %i 1 | while (%i <= $numtok(%ach_btype,44)) { .ban %ach_key $2 $1 $gettok(%ach_btype,%i,44) | inc %i }
  }
  if (%ach_kick == yes) { if ($len(%ach_reason) > 1) var %ach_kr %ach_reason | else var %ach_kr - | .kick $2 $1 %ach_kr }
}


Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.


๐ŸŒ http://forum.epicnet.ru ๐Ÿ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Sep 2021
Posts: 7
K
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2021
Posts: 7
Point 4 of the new update is fundamental.

There seemed to be apparently some meaningless bans in messages that looked okay, instead they were those special characters equal to simple spaces ... And it's a big mess if you don't know that those special characters exist .-.

Also great are the rest of the changes that make the script much better to use!


Link Copied to Clipboard