So, I created my script for you. Most likely this is what you wanted. When tested under my conditions, it performed well. It is possible that when used in your conditions, something may go wrong, so I suggest you test this script thoroughly and watch it work.
Akick Temp Ban v1.0 – description: 1.Sets a temporary ban, which is automatically removed after a while and the intruder is entered into the database for subsequent auto-ban.
2.You can use the command with the syntax: "
!b <nick>". (All nicknames for which this command will be available are recorded in the "
%atb_admins" or who has a channel operator prefix "
%atb_prefix").
3.Through the alias "
atb_set" you can customize the configuration parameters work of the script, changing the value of variables:
%atb_work – configures enable or disable for work of the script. The options are:
<yes|no>.
%atb_kick – configures enable or disable the ability to install kicks. The options are:
<yes|no>.
%atb_akick – configures enable or disable of the user's record in the database for the subsequent auto-ban. The options are:
<yes|no>.
%atb_notice – configures enable or disable of sending a report to the notice message. The options are:
<yes|no>.
%atb_private – configures enable or disable sending a report to a private message. The options are:
<yes|no>.
%atb_comm – contains a command for the channel, after which the bot will execute the script function. Default:
<!b>. (You can change this to any command you like).
%atb_btype – configures the type (format) of the ban for the offender. More details about the types of bans are described here:
$mask. Default:
<2>.
%atb_chans – contains a comma-separated list of channels on which the bot should execute the script function. The options are:
<#test,#myroom|all>. (You can specify "
all" to work on all channels).
%atb_reason – contains the path to a text file with a list of reasons for the kick. By default, it is assumed that the file will be located in the same place as the script:
<$scriptdir $+ atb_reason.txt>.
%atb_pathdb – contains the path to the text file with the database, where the data of the violators will be saved. By default, the file will be located where the script:
<$scriptdir $+ atb_database.txt>.
%atb_icons – contains additional comma-separated icons (
Unicode emoji) for add to the kick reason. Default:
<🔨,✞,☠>. (Optional parameter, can be left blank or set "
–". You can also add your own icons).
%atb_time – contains the time for which a temporary ban will be set. Correct format:
<1s|1m|1h|1d>.
%atb_admins – contains a comma-separated list of aliases that are allowed to control the script. (Optional parameter, can be left blank or set "
–". You can also specify other nicknames).
%atb_prefix – contains prefixes, separated by commas, that must appear next to the alias (channel operator) who is allowed to control the script. Default:
<[!,~,&,@,%]>. (If necessary, you can leave this field blank: "
[]").
Demo screenshot of the script's operability:
![[Linked Image from i.ibb.co]](https://i.ibb.co/Fw1mnsT/Akick-Temp-Ban.jpg)
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 "
AkickTempBan.mrc":
#####################################################################
# Name: Akick Temp Ban v1.0
# Author: Epic (epicnet@mail.ru, http://epicnet.ru)
# Description: Sets a temporary ban, which is automatically removed after a while and the intruder is entered into the database for subsequent auto-ban.
#####################################################################
alias atb_set {
%atb_work = yes
%atb_kick = yes
%atb_akick = yes
%atb_notice = yes
%atb_private = no
%atb_comm = !b
%atb_btype = 2
%atb_chans = all
%atb_reason = $scriptdir $+ atb_reason.txt
%atb_pathdb = $scriptdir $+ atb_database.txt
%atb_icons = 🔨,✞,☠
%atb_time = 5m
%atb_admins = Epic,Robert
%atb_prefix = [!,~,&,@,%]
}
=====================================================
on *:TEXT:*:#:{
atb_set | if (%atb_work == yes) {
if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) {
if ($strip($1) == %atb_comm) {
var %atb_up $remove($nick($chan,$nick).pnick,$nick) | var %atb_knick $strip($2)
if (!$count($nick($chan,$me).pnick,%,@,&,~,!)) { .notice $nick I have no channel rights. Required prefix: !,~,&,@,% | halt }
if (!$istok(%atb_admins,$nick,44) && $sprefix(%atb_up,%atb_prefix,44) == $false) { .notice $nick You do not have sufficient rights to execute this command. Required prefix: $remove(%atb_prefix,[,]) | halt }
if ($2 == $null) { .notice $nick Correct syntax: %atb_comm <nick> | halt }
if (!$comchan(%atb_knick,0).nick) { .notice $nick I do not see on the channels a nickname: %atb_knick | halt }
var %atb_banid $+([ID:,$chr(32),$rand(A,Z),$rand(A,Z),$rand(1000,9999),])
atb_bankick $chan %atb_knick %atb_banid
if (%atb_akick == yes) {
if (!$read(%atb_pathdb, -w, $+(*,%atb_knick,*)) && !$read(%atb_pathdb, -w, $+(*,$address(%atb_knick,%atb_btype)))) {
.write -il1 $qt(%atb_pathdb) $+(%atb_banid,$chr(44),%atb_knick,$chr(44),$address(%atb_knick,%atb_btype))
}
}
if (%atb_notice == yes) { .notice $nick AkickTempBan: %atb_knick - $+($chr(40),%atb_time,$chr(41)) %atb_banid }
if (%atb_private == yes) { .msg $nick AkickTempBan: %atb_knick - $+($chr(40),%atb_time,$chr(41)) %atb_banid }
}
}
}
}
on *:JOIN:#:{
atb_set | if (%atb_work == yes) {
if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) {
if ($read(%atb_pathdb, -w, $+(*,$nick,*))) || ($read(%atb_pathdb, -w, $+(*,$address($nick,%atb_btype)))) {
var %atb_jbanid $gettok($read(%atb_pathdb,$readn),1,44) | atb_bankick $chan $nick %atb_jbanid
}
}
}
}
-----------------------------------------------------
alias atb_bankick {
.ban $+(-u,$convertsec(%atb_time)) $1 $2 %atb_btype
if (%atb_kick == yes) {
if (%atb_icons != $null) var %atb_i $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44)
if ($exists(%atb_reason) == $true) var %atb_r Bye! - $read(%atb_reason) | else var %atb_r Bye! - You are banned
.kick $1 $2 %atb_i %atb_r $3-
}
}
alias sprefix {
var %sp_sp $remove($2,[,]) | var %sp_sn $numtok(%sp_sp,$3)
var %q 1 | while (%q <= %sp_sn) { if ($gettok(%sp_sp,%q,$3) isin $1) return $true | inc %q } | return $false
}
alias convertsec {
var %cst $right($1,1) | var %csn $remove($1,%cst)
if ($count(%cst,s,m,h,d)) {
if (%cst == s) return %csn
if (%cst == m) return $calc(%csn * 60)
if (%cst == h) return $calc(%csn * 3600)
if (%cst == d) return $calc(%csn * 86400)
}
else { .echo -s Error: Invalid time format - Correct format: 1s,1m,1h,1d | return 300 }
}
The script was tested on
InspIRCD v3 +
mIRC v7.63.
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.
P.S. Thanks for your good words. I'm not a magician, I'm still on the path of knowledge ✨

✨ To be fair, except me here there are many other professionals in the field of scripting, whose level I rate how very high
⭐⭐⭐, and who can do it even better than me. But the most important words of gratitude, of course, to
Khaled for creating for all of us such a wonderful and multi-functional mIRC client with advanced capabilities thanks to scripts codes.