Coders-IRC


IRC for Coders

ban script particular.


image

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:.
%ach_kick – configures whether to enable or disable execution "Kick" for the offender. The options are:.
%ach_ban – configures whether to enable or disable execution "Ban" for the offender. The options are:.
%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 charactersUnicode andEmoji).

#####################################################################
#   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
  }
}

Comments 0