mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
How to kick with older reason? Help me pls #268791 29/04/21 02:21 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
I use the illustrative example to make it easy for you to imagine and understand as follows:
1. When Op type the command:! B <Nickname here> then Bot will automatically banned and kicked that Nickname with radom reason.txt.
For example:
<@Robert>! B petra
* MyBot sets mode: + b *!*@01.11.21.22
* petra was kicked from #myroom by MyBot (Bye! You are not welcome here [id: 12345])

(The reason kick "Bye! You are not welcome here" was in reasonkick.txt and the [id: %knum], [id: 12345] is an example)
(Code example: kick $chan $2 $read(reasonkick.txt) [id: %knum])

[10 Mins later i set mode unban]
* Robert sets mode -b *!*@01.11.21.22

[Then 5 Mins later Nickname petra comeback and join #myroom]
* petra (abc@01.11.21.22) joins #myroom
* MyBot sets mode: + b *!*@01.11.21.22
* petra was kicked from #myroom by MyBot (Bye! You are not welcome here [id: 12345])

MyBot kick with older reason, how to make a code like that? Can you help me write that code? Thank you very much for your help and look forward to receiving your help soon.

Last edited by Robert; 29/04/21 03:29 PM. Reason: Explain exactly i means again
Re: How to kick with older reason? Help me pls [Re: Robert] #268792 29/04/21 02:45 PM
Joined: Feb 2009
Posts: 25
W
WKN Offline
Ameglian cow
Offline
Ameglian cow
W
Joined: Feb 2009
Posts: 25
Why does MyBot set mode -b if you want that user not to join at all anymore? Would be unnecessary Kick-Ban-Loop.

Re: How to kick with older reason? Help me pls [Re: WKN] #268793 29/04/21 03:18 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
That's is an example. So, i must be able to set 10mins for banned and auto unban after 10mins, because i don't want list of bans is full and list of akick is full

My purpose is how to get MyBot banned and kicked someone with an older reason kicked earlier.

Thanks!

Re: How to kick with older reason? Help me pls [Re: Robert] #268794 30/04/21 12:24 AM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
Not sure I understand what you're wanting. If you want to only have a temporary ban along with the kick, you can have the bot do it like:

/ban -ku600 NICK 2 message goes here

... and the bot's mirc will remove the ban 600 seconds later. Is what you're wanting is to have the bot remember the nicks that it's hit with a temp-ban, and if they come again, it should ban them again for another 10 minutes using the same "reason" message again? If so, if that nick comes in again using a different host, are you wanting it to remember the same-nick or same-host for a future ban?

Re: How to kick with older reason? Help me pls [Re: maroon] #268795 30/04/21 01:15 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
MyBot will remember the IP address and Reason Kick. If anyone using that IP in the room will be banned and Kicked with reason has been kicked before
maroon, thanks for your answer. I want MyBot remember "reason kick" on the ip/host only. Can you help me to make a code like that pls?

Last edited by Robert; 30/04/21 01:36 PM.
Re: How to kick with older reason? Help me pls [Re: Robert] #268796 30/04/21 02:25 PM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
I do not see anything in your example which shows how the text was chosen to be applied to petra. How does the "you are not welcome" reason get attached to Petra? is it randomly chosen from many items in the text file? Or is it the text attached to the ID 12345? Can 2 different people have the same text attached to 2 different ID numbers, or does 12345 for everyone always mean that same text?

Does the bot need to remember all the bans after restarting itself? Or only after it reconnects to the server?

How should the bot forget the ban, by being told to forget the ban against a host, or forget an ID number, or other way?

Re: How to kick with older reason? Help me pls [Re: maroon] #268797 30/04/21 02:38 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
1. How does the "you are not welcome" reason get attached to Petra? is it randomly chosen from many items in the text file? <=== yes (kickreason.txt there are some reasons like this:
You are not welcome here (next line)
The Operator is always right
....
2. Can 2 different people have the same text attached to 2 different ID numbers <--- this one. May be have the same text attached, but differnt ID numbers. (The kick ID is assigned randomly to any given IP (*!*@ip/host), when Op uses the command: .b <nickname> or .b <ip example: *! * @ 01.02.03.04>)

3. Does the bot need to remember all the bans after restarting itself? <=== yes

4. How should the bot forget the ban, by being told to forget the ban against a host, or forget an ID number, or other way? <==== when i deleted it from blacklist.txt only.

Last edited by Robert; 30/04/21 02:44 PM.
Re: How to kick with older reason? Help me pls [Re: Robert] #268798 30/04/21 04:04 PM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
From the above, I basically figured out what you want your bot to do and I am almost done creating my version of the script for you. It will probably be ready today.

Regarding the further automatic kick, would not it be easier to do it through the service command "/msg ChanServ help AKICK" ??? (assuming your services have such a module function)

Otherwise, the bot will have to create its own database with a list of banned users for automatic execution (kick + ban) in the future, referring to this list.


πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Epic] #268799 01/05/21 12:09 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
1. From the above, I basically figured out what you want your bot to do and I am almost done creating my version of the script for you. It will probably be ready today. <=== Thank you very much and I hope to look forward to receiving your code today. You are awesome and good at coding

2. Regarding the further automatic kick, would not it be easier to do it through the service command "/msg ChanServ help AKICK" ??? (assuming your services have such a module function) <=== i don't want to use chanserv akick and my services have NOT such a module funtion smile

2. Otherwise, the bot will have to create its own database with a list of banned users for automatic execution (kick + ban) in the future, referring to this list. <=== I like this way. Can you write that code for me.

You are so smart that you understand my wording and know what I want in my Bot. Thank you if you help write this code for me soon. Best regards !

Re: How to kick with older reason? Help me pls [Re: Robert] #268800 01/05/21 05:39 PM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
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]

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":


Code
#####################################################################
#   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 ✨ cool ✨  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.




πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Epic] #268801 02/05/21 02:01 AM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
WOW....Thank you Epic, you are number 1. That code work exactly i means and want.

1. But how to deleted (removed) ban? I open atb_database.txt to remove the Ip in here, but i can't see any Ip.

2. [ID: NU4810] <=== Please change it to [id: numberOnly]

3. I creat atb_reason.txt and put some reasons on it (1 reason per line) but MyBot doesn't kick with random reason

4. Can you remove the icon in front of the reason for the kick? (☠ πŸ”¨)

NOTE (IMPORTANT): In file atb_reason.txt i have 10 reasons from 1 to 10. If kick with random reasons from file atb_reason.txt: Example: if reason kick is reason2 and [id: randomnumber, example [id: 1234]] then next time auto kick with reason2 and [id: oldnumber 1234]. I thinks you make a code to save and remember ReasonKick and id number is the best way i guess :P

5. (New idea) If i type command: !b <Nickname> <reason> (Example: !b ChatNick Hello how are you today?) then MyBot will ban ip/host and kick with reason: Hello how are you today? [id: randomNumber,Ex:1234]. Next time this Ip/host rejoin room will be kicked with older reason anf kick id: Hello how are you today? [id: 1234]

6. Can you write code to check On Nick event.If Nick change ip/host then join room,and when change the Nick of kick above (the older Nick has been kick/ban before) will be banned ip/host and kicked with OlderReason and Older id number is: Hello how are you today? [id: 1234]

If i found an error i will tell you to fixed it. Thanks so much to Epic


Last edited by Robert; 02/05/21 05:48 AM.
Re: How to kick with older reason? Help me pls [Re: Robert] #268802 02/05/21 08:01 AM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
I have change something on your code like this:

https://pastebin.com/raw/AmENQK5G

BUT THERE IS A PROBLEM IS:

1. MyBot has been kicked with random reason from atb_reason.txt BUT on next time that person come back and rejoin my room, MyBot banned and kicked but with different reason,
not older reason has been kicked before. Can you fixed it for me. Thank you so much.

Re: How to kick with older reason? Help me pls [Re: Robert] #268803 02/05/21 11:21 AM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
Quote
1. But how to deleted (removed) ban? I open atb_database.txt to remove the Ip in here, but i can't see any Ip.

It all depends on what path you specified to save data in the file. If you want the file to be in the root folder of the client together with all other executable files,
then specify the path in the variable as follows: "%atb_pathdb = $mircdir $+ atb_database.txt", or any other path to file. For example: "%atb_pathdb = C:\atb_database.txt".
I think that the removal of records will be much more convenient if the ban ID or nickname will be specified in the command to delete: "!b <nick|id> del" or "!bd <nick|id>".

Quote
2. [ID: NU4810] <=== Please change it to [id: numberOnly]

You can remove from the variable value "%atb_banid" multiple identifiers for creating random alphabet letters: "$rand(A,Z),$rand(A,Z)":
Code
var %atb_banid $+([ID:,$chr(32),$rand(1000,9999),])

Quote
3. I creat atb_reason.txt and put some reasons on it (1 reason per line) but MyBot doesn't kick with random reason

The same as in the first question. Probably you did not correctly indicate the path in the variable "%atb_reason" where your file is.

Quote
4. Can you remove the icon in front of the reason for the kick? (☠ πŸ”¨)

Yes, you can simply delete them all or vice versa, add other badges, but necessarily through the comma: "%atb_icons = 😁,πŸ˜‡,😈" or leave dash, or space "%atb_icons = -".
Note: This variable should be used only for the icons (emoji). If you want to add to the message for kick some add static text,
then you can create new variables with any name in alias "atb_set" then you can insert this variable in the string ".kick $1 $2 %atb_i %atb_text1 %atb_r $3-":
Code
alias atb_set {
  ...
  %atb_text1 = Here is my new text1
  %atb_text2 = Here is my new text2
  %atb_text3 = Here is my new text3
}

Quote
NOTE (IMPORTANT): In file atb_reason.txt i have 10 reasons from 1 to 10. If kick with random reasons from file atb_reason.txt: Example: if reason kick is reason2 and [id: randomnumber, example [id: 1234]] then next time auto kick with reason2 and [id: oldnumber 1234]. I thinks you make a code to save and remember ReasonKick and id number is the best way i guess :P

Yes, this can be added to save in the database.

Quote
5. (New idea) If i type command: !b <Nickname> <reason> (Example: !b ChatNick Hello how are you today?) then MyBot will ban ip/host and kick with reason: Hello how are you today? [id: randomNumber,Ex:1234]. Next time this Ip/host rejoin room will be kicked with older reason anf kick id: Hello how are you today? [id: 1234]

Yes, this can also be added to this team. In addition, I think it will be necessary to additionally record the #Channel itself in the database in the line along with the nick.

Quote
6. Can you write code to check On Nick event.If Nick change ip/host then join room,and when change the Nick of kick above (the older Nick has been kick/ban before) will be banned ip/host and kicked with OlderReason and Older id number is: Hello how are you today? [id: 1234]

Yes, this will be logical. I will add event handler "on NICK" to check the changes in the nicknames.


Okay, I will make all these changes in the code, taking into considering your remarks and new proposals.




πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Epic] #268804 02/05/21 12:03 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
Yes, this will be logical. I will add event handler "on NICK" to check the changes in the nicknames.


Okay, I will make all these changes in the code, taking into account your remarks and new proposals.


Thanks Epic forever so much! I'm waiting for new code from you and I hope will receive your code soon, Best regards!

Re: How to kick with older reason? Help me pls [Re: Robert] #268807 03/05/21 03:13 AM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
Dear Epic, i have an idea for you to make code :P

1. When Admin type command: !b <NickName> in every channels Bot have Op, then MyBot will banned IP/HOST (default $address 2) and kicked that NickName with RANDOM REASON on file text atb_reason.txt AND AUTO SAVE [id: number]; NickName; IP/HOST and REASONKICK like this in atb_database.txt file text:

Example:
Line1: [id: number],NickName,*!*@IP/HOST,ReasonKick <==== If this NickName or IP/HOST join myroom will be kicked and banned with this ReasonKick and [id: number] in atb_database.txt.

Line2: similar above.....
Line3:.....etc........

2. I have already to make some commands to add blacklisted user to atb_database.txt with syntax:

a) Add Auto ban command: !badd [id: number],NickName,*!*@IP/HOST,ReasonKick

Example: !badd [id: 5864],BlackNick,*!*@10.11.12.13,You are bad chatter not welcome here


b)Del Auto ban: !bdel [id: number],NickName,*!*@IP/HOST,ReasonKick or !bdel NumberWantToDeleted

Example: + !bdel [id: 5864],BlackNick,*!*@10.11.12.13,You are bad chatter not welcome here
OR + !bdel 2

c) List Auto ban: !blist <== then MyBot will list all of auto ban blacklisted in atb_database.txt to channel

Send you for reference and for the purpose of writing code is more convenient and correct for me. Thanks Epic so much! You are so kind and wonderful

Re: How to kick with older reason? Help me pls [Re: Robert] #268823 08/05/21 08:44 AM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
So, the new version of the script is ready. I had to tinker a little (especially with testing) because of which I had to constantly make new edits to the code and also had to create custom identifiers for repetitive actions.
I hope I managed to implement all your ideas and even a little more, so that the script matches your requirements.

Akick Temp Ban v2.0 – updates:

  1.Highly it is recommended in bot to run the command: "/atb_remove_vars" so that delete all old data stored in variables for the correct transition to the new version of the script.
  2.All text used in the script has been moved to variables in alias "atb_set" for easy editing and translation into your native language, so that more don't have to search/fix this is in another part of the code (to avoid crashing).
  3.Now all tokens-values in the database are separated by semicolon ";" instead of the usual comma "," – please change this on every line or just remove the old database. (It is very important).
     Example line from database: "[id:XW93884];troll;*!*@OKCHI.VPXW7.JMXH6.HEQ79;#test;πŸ”¨ Get out of here away!"

  4.Added new and changed some names of old variables in alias "atb_set". You can edit the values of these variables at your discretion, observing the correct format in the examples given:

     %atb_commhelp – contains a command for help. Default: <!bhelp>. (You can change this to any command you like).
     %atb_commadd – contains a command to add new users to the database list. Default: <!badd>. (You can change this to any command you like).
     %atb_commdel – contains a command to remove users from the database list. Default: <!bdel>. (You can change this to any command you like).
     %atb_commfind – contains a command to search for users in the database list. Default: <!bfind>. (You can change this to any command you like).
     %atb_commlist – contains a command to display a list of users in the database. Default: <!blist>. (You can change this to any command you like).
     %atb_pathreason – 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_idprefix – contains a prefix for the id of the kick number. Default: <id:>. (You can change this to any other text/prefix you like).
     %atb_idformat – contains a value from characters to generate an identification number in random order: <L> = one letter, <N> = one numeral. Correct default format: <LLNNNNN>. If want only numbers, then set: <NNNNN>.
     %atb_btime – contains the time for which a temporary ban will be set. Correct format: <1s|1m|1h|1d>. Default: <10m>.
     %atb_stopcomm – contains time to protect against frequent and fast execution of commands. Correct format: <1s|1m|1h|1d>. Default: <3s>.

  5.Added new commands. Full list and their correct syntax:

     Add user to database: "!badd <nick> <host> [id] [reason]".
     Delete user from database: "!bdel <nick|host|id>".
     Find a user in the database: "!bfind <nick|mask|id>".
     List of users in the database: "!blist [N[-N]]".


Demo screenshots of the script's operability:


    [Linked Image from i.ibb.co]


This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R" find the old code and replace it with the new one via "View", further save script called "AkickTempBan.mrc":


Code
#####################################################################
#   Name: Akick Temp Ban v2.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.
#   Commands: !bhelp
#####################################################################

alias atb_set {
  %atb_work = yes
  %atb_kick = yes
  %atb_akick = yes
  %atb_notice = yes
  %atb_private = no
  %atb_chans = all
  %atb_comm = !b
  %atb_commhelp = !bhelp
  %atb_commadd = !badd
  %atb_commdel = !bdel
  %atb_commfind = !bfind
  %atb_commlist = !blist
  %atb_pathreason = $scriptdir $+ atb_reason.txt
  %atb_pathdb = $scriptdir $+ atb_database.txt
  %atb_icons = πŸ”¨,✞,☠,πŸ”₯,⚑,🌠,🏁,🚩,😈
  %atb_idprefix = id:
  %atb_idformat = LLNNNNN
  %atb_btype = 2
  %atb_btime = 10m
  %atb_stopcomm = 3s
  %atb_admins = Epic,Robert
  %atb_prefix = [!,~,&,@,%]
  ;-------------------------
  %atb_logo = AkickTempBan
  %atb_msg_rd = Bye! You are banned
  %atb_msg_cs = Correct syntax:
  %atb_msg_stopcomm = %atb_logo - Stop! Don't write commands so fast. It remains to wait:
  ;-------------------------
  %atb_msg_syntax_comm = %atb_comm <nick> [reason]
  %atb_msg_syntax_commadd = %atb_commadd <nick> <host> [id] [reason]
  %atb_msg_syntax_commdel = %atb_commdel <nick|host|id>
  %atb_msg_syntax_commfind = %atb_commfind <nick|mask|id>
  %atb_msg_syntax_commlist = %atb_commlist [N[-N]]
  ;-------------------------
  %atb_head_help = %atb_logo - Help for commands:
  %atb_msg_help1 = Set a temporary ban on the channel: %atb_msg_syntax_comm
  %atb_msg_help2 = Add user to database: %atb_msg_syntax_commadd
  %atb_msg_help3 = Delete user from database: %atb_msg_syntax_commdel
  %atb_msg_help4 = Find a user in the database: %atb_msg_syntax_commfind
  %atb_msg_help5 = List of users in the database: %atb_msg_syntax_commlist
  ;-------------------------
  %atb_head_add = %atb_logo - Adding a write to the database:
  %atb_false_add = %atb_logo - Such an entry already exists in the database:
  %atb_head_del1 = %atb_logo - Deleting channel from a line:
  %atb_head_del2 = %atb_logo - Line deleted from database:
  %atb_msg_del = Your channel has been removed from the list:
  %atb_false_del1 = %atb_logo - For this user there is no longer a ban for your channel:
  %atb_false_del2 = %atb_logo - Nothing found... Try changing search data.
  %atb_head_find = %atb_logo - According to your request, the database found:
  %atb_false_find = %atb_logo - Nothing found... Try changing search data.
  %atb_head_list = %atb_logo -  List of users in the database - Total:
  %atb_msg_check1 = %atb_logo - You don't have enough rights. Mandatory status prefix on the channel:
  %atb_msg_check2 = %atb_logo - I have no rights on this channel. I need a status prefix: ~,&,@,%
  %atb_msg_check3 = %atb_logo - I do not see on the channels a nickname:
}
=====================================================
on *:TEXT:*:#:{
  atb_set | if (%atb_work == yes) {
    if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) {
      var %atb_tokens $strip($1) $chan $nick $strip($2-) | tokenize 32 %atb_tokens
      if ($1 == %atb_comm) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_bankick_comm $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commhelp) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_help $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commadd) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_add $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commdel) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_del $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commfind) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_find $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commlist) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_list $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
    }
  }
}
on *:JOIN:#:{ atb_set | if (%atb_work == yes) { if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) { var %atb_jnick $nick | var %atb_jhost $address($nick,%atb_btype) | if ($istok($findb(%atb_jnick).chan,$chan,44)) { atb_bankick_jn $chan !nomsg! %atb_jnick $findb(%atb_jnick).id $findb(%atb_jnick).reason | halt } | if ($istok($findb(%atb_jhost).chan,$chan,44)) { atb_bankick_jn $chan !nomsg! %atb_jnick $findb(%atb_jhost).id $findb(%atb_jhost).reason } } } }
on *:NICK:{ atb_set | if (%atb_work == yes) { var %atb_nn $newnick | if ($findc(%atb_nn)) { var %atb_fcs $v1 | var %y 1 | while (%y <= $numtok(%atb_fcs,44)) { var %atb_fc $gettok(%atb_fcs,%y,44) | var %atb_nnick %atb_nn | var %atb_nhost $address(%atb_nn,%atb_btype) | if ($istok($findb(%atb_nnick).chan,%atb_fc,44)) { atb_bankick_jn %atb_fc !nomsg! %atb_nnick $findb(%atb_nnick).id $findb(%atb_nnick).reason | goto next1 } | if ($istok($findb(%atb_nhost).chan,%atb_fc,44)) { atb_bankick_jn %atb_fc !nomsg! %atb_nnick $findb(%atb_nhost).id $findb(%atb_nhost).reason } | :next1 | inc %y } } } }
-----------------------------------------------------
alias -l atb_check {
  var %atb_up $remove($nick($2,$3).pnick,$3)
  if (!$istok(%atb_admins,$3,44) && $sprefix(%atb_up,%atb_prefix,44) == $false) { .notice $3 %atb_msg_check1 $remove(%atb_prefix,[,]) | halt }
  if ($1 == %atb_comm) { if (!$count($nick($2,$me).pnick,~,&,@,%)) { .notice $3 %atb_msg_check2 | halt } | if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_comm | halt } | if (!$comchan($4,0)) { .notice $3 %atb_msg_check3 $4 | halt } }
  if ($1 == %atb_commadd) { if (!$4) || (!$5) { .notice $3 %atb_msg_cs %atb_msg_syntax_commadd | halt } | if ($6 && $chr(35) isin $6) { .notice $3 %atb_msg_cs %atb_msg_syntax_commadd | halt } }
  if ($1 == %atb_commdel) { if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_commdel | halt } }
  if ($1 == %atb_commfind) { if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_commfind | halt } }
  if ($1 == %atb_commlist) { if ($4 && $4 !isnum && - !isin $4) || ($4 && - isin $4 && !$count($gettok($4,1,45),0,1,2,3,4,5,6,7,8,9)) || ($4 && - isin $4 && !$count($gettok($4,2,45),0,1,2,3,4,5,6,7,8,9)) { .notice $3 %atb_msg_cs %atb_msg_syntax_commlist | halt } }
}
-----------------------------------------------------
alias -l atb_bankick_comm { if ($findb($3)) { var %atb_banid $findb($3).id | var %atb_reason $findb($3).reason } | else { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) | if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | if ($4) var %atb_reason %atb_icon $4- | else { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } } | atb_bankick_act $1 $2 $3 %atb_banid %atb_reason }
alias -l atb_bankick_jn { if ($findb($3)) { var %atb_banid $findb($3).id | var %atb_reason $findb($3).reason } | else { if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | if (!$4) { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) } | else { var %atb_banid $4 } | if (!$5) { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } | else { var %atb_reason $5- } } | atb_bankick_act $1 $2 $3 %atb_banid %atb_reason }
alias -l atb_bankick_act {
  if (%atb_akick == yes) { var %atb_aknick $3 | var %atb_akhost $address($3,%atb_btype) | if ($findb(%atb_aknick) && $2 != !nomsg!) { if (!$istok($findb(%atb_aknick).chan,$1,44)) { var %atb_l $findb(%atb_aknick).line | var %atb_s $findb(%atb_aknick).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns } } | if ($findb(%atb_akhost) && $2 != !nomsg!) { if (!$istok($findb(%atb_akhost).chan,$1,44)) { var %atb_l $findb(%atb_akhost).line | var %atb_s $findb(%atb_akhost).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns } } | if (!$findb(%atb_aknick) && !$findb(%atb_akhost)) { .write -il1 $qt(%atb_pathdb) $+($4,$chr(59),$3,$chr(59),$address($3,%atb_btype),$chr(59),$1,$chr(59),$5-) } }
  .ban $+(-u,$convertsec(%atb_btime)) $1 $3 %atb_btype | if (%atb_kick == yes && $3 ison $1) { .kick $1 $3 $5- $4 } | if (%atb_notice == yes && $2 != !nomsg!) { .notice $2 %atb_logo - $3 $+($chr(40),%atb_btime,$chr(41)) $4 $findb($3).chan - $5- } | if (%atb_private == yes && $2 != !nomsg!) { .msg $2 %atb_logo - $3 $+($chr(40),%atb_btime,$chr(41)) $4 $findb($3).chan - $5- }
}
-----------------------------------------------------
alias -l atb_help { .notice $2 %atb_head_help | .notice $2 %atb_msg_help1 | .notice $2 %atb_msg_help2 | .notice $2 %atb_msg_help3 | .notice $2 %atb_msg_help4 | .notice $2 %atb_msg_help5 }
alias -l atb_add {
  if (!$findb($3)) { var %atb_ah $+(*!*@,$remove($4,*,!,@)) | if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | var %atb_banchans $1 | if ($5) { var %atb_banid $+([,%atb_idprefix,$remove($5,id,:,[,]),]) } | else { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) } | if ($6) { var %atb_reason %atb_icon $6- } | else { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } | .write -il1 $qt(%atb_pathdb) $+(%atb_banid,$chr(59),$3,$chr(59),%atb_ah,$chr(59),%atb_banchans,$chr(59),%atb_reason) | .notice $2 %atb_head_add | .notice $2 $+(,1,.,) %atb_banid $3 %atb_ah %atb_banchans - %atb_reason | return }
  else { if (!$istok($findb($3).chan,$1,44)) { var %atb_l $findb($3).line | var %atb_s $findb($3).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns | var %atb_an $2 | tokenize 59 $findb($3).string | .notice %atb_an %atb_head_add | .notice %atb_an $+(,%atb_l,.,) $1-4 - $5- | return } } | var %atb_an $2 | tokenize 59 $findb($3).string | .notice %atb_an %atb_false_add $2 = line $+($chr(40),,$findb($3).line,,$chr(41)) | .notice %atb_an $+(,$findb($3).line,.,) $1-4 - $5-
}
alias -l atb_del { if ($3 && $findb($3)) { var %atb_dcc $1 | var %atb_dn $2 | var %atb_dl $findb($3).line | var %atb_ds $findb($3).string | var %atb_dc $findb($3).chan | if ($istok(%atb_dc,$1,44)) { var %atb_dc $remextcom($remove(%atb_dc,%atb_dcc)) | if (%atb_dc != $null) { var %atb_dst $puttok(%atb_ds,%atb_dc,4,59) | .write -l $+ %atb_dl $qt(%atb_pathdb) %atb_dst | tokenize 59 $findb($3).string | .notice %atb_dn %atb_head_del1 | .notice %atb_dn $+(,%atb_dl,.,) $1-4 - $5- | .notice %atb_dn %atb_msg_del %atb_dcc } | else { tokenize 59 %atb_ds | .write -dl $+ %atb_dl $qt(%atb_pathdb) | .notice %atb_dn %atb_head_del2 | .notice %atb_dn $+(,%atb_dl,.,) $1-4 - $5- } } | else { tokenize 59 %atb_ds | .notice %atb_dn %atb_false_del1 %atb_dcc | .notice %atb_dn $+(,%atb_dl,.,) $1-4 - $5- } } | else { .notice $2 %atb_false_del2 } }
alias -l atb_find { if ($3 && $findb($3)) { .notice $2 %atb_head_find | var %atb_fn $2 | var %atb_fl $findb($3).line | var %atb_fs $findb($3).string | tokenize 59 %atb_fs | .notice %atb_fn $+(,%atb_fl,.,) $1-4 - $5- } | else { .notice $2 %atb_false_find } }
alias -l atb_list { var %atb_ln $2 | var %atb_lnum $3 | var %atb_ll $lines(%atb_pathdb) | .notice %atb_ln %atb_head_list $+($chr(40),,%atb_ll,,$chr(41)) | var %w 1 | while (%w <= %atb_ll) { tokenize 59 $read(%atb_pathdb,%w) | if (!%atb_lnum) .notice %atb_ln $+(,%w,.,) $1-4 - $5- | if (%atb_lnum && - !isin %atb_lnum) { if (%w <= %atb_lnum) { .notice %atb_ln $+(,%w,.,) $1-4 - $5- } | else { .break } } | if (%atb_lnum && - isin %atb_lnum) { if (%w >= $gettok(%atb_lnum,1,45)) { .notice %atb_ln $+(,%w,.,) $1-4 - $5- } | if (%w >= $gettok(%atb_lnum,2,45)) { .break } } | inc %w } }
alias atb_remove_vars { unset %atb_* | .echo -st All script variables "AkickTempBan" have been deleted successfully. }
-----------------------------------------------------
alias -l findb { :next3 | if (!%sbd_line) var %sbd_line 1 | if ($read(%atb_pathdb, -w, $+(*,$1,*), %sbd_line)) { var %sdb_r $readn | var %sdb_s $read(%atb_pathdb,%sdb_r) | var %sbd_s1 $remove($gettok(%sdb_s,1,59),[id:,]) | var %sbd_s2 $gettok(%sdb_s,2,59) | var %sbd_s3 $gettok(%sdb_s,3,59) | if ($1 == %sbd_s1) || ($1 == %sbd_s2) || ($+(*,$1,*) iswm %sbd_s3) { if (line == $prop) return %sdb_r | if (string == $prop) return %sdb_s | if (id == $prop) return $gettok(%sdb_s,1,59) | if (nick == $prop) return $gettok(%sdb_s,2,59) | if (host == $prop) return $gettok(%sdb_s,3,59) | if (chan == $prop) return $gettok(%sdb_s,4,59) | if (reason == $prop) return $gettok(%sdb_s,5-,59) | return $true } | else { inc %sbd_line | if (%sbd_line <= $lines(%atb_pathdb)) goto next3 } } }
alias -l findc { var %n 1 | while (%n <= $comchan($1,0)) { var %coc $comchan($1,%n) | if (%atb_chans == all) || ($istok(%atb_chans,%coc,44)) { if (!%clc) var %clc %coc | else var %clc $+(%clc,$chr(44),%coc) } | inc %n } | return %clc }
alias -l 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 -l stopcomm { if ($hget($+(stopcomm,$2),$1)) return %atb_msg_stopcomm $+($chr(40),,$v1,,$chr(41),$chr(32),sec.) | if (!$hget($+(stopcomm,$2),$1)) .hadd -mz $+(stopcomm,$2) $1 $convertsec(%atb_stopcomm) }
alias -l 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 -st %atb_logo - Error: Invalid time format - Correct format: 1s,1m,1h,1d | return 60 } }
alias -l idform { if ($countcs($1,L,N)) { unset %atb_cif | var %i 1 | while (%i <= $len($1)) { if ($mid($1,%i,1) == L) var %atb_cif $+(%atb_cif,$rand(A,Z)) | if ($mid($1,%i,1) == N) %atb_cif = $+(%atb_cif,$rand(0,9)) | inc %i } | return %atb_cif } | else { .echo -st %atb_logo - Error: Invalid ID format - Correct format: LLNNNNN - L = random letter, N = random number. | return $+($rand(A,Z),$rand(A,Z),$rand(10000,99999)) } }
alias -l remextcom { var %rc_s $1 | :next4 | var %rc_s $replace(%rc_s,$+($chr(44),$chr(44)),$chr(44)) | if ($left(%rc_s,1) == $chr(44)) var %rc_s $mid(%rc_s,2) | if ($right(%rc_s,1) == $chr(44)) { var %rc_s $mid(%rc_s,1,$calc($len(%rc_s) -1)) | goto next4 } | return %rc_s }
=====================================================



Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.
I recommend that you test this script thoroughly on empty channels before you start using it for real with real users.
If you find any errors in the code or in its work, then be sure to write to me here about it, and we are together think about what we can do.




πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Epic] #268825 08/05/21 12:17 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
Let me remind you that my purpose of asking you to help code is:

1. I have 2 text files:
+ (1) atb_reason.txt (in this file there are about 10 reasons kick from reason1 to reason10 I have preset, one reason per line);

+ (2) atb_database.txt (in this file will save the data about [id kicknumber],NickNameOfKick,AddressIP/HOST,ReasonKick), if any NickName or AddressIp/HOST is in there, entering the room will be banned and kicked with ReasonKick and this [id: kicknumber]. I mean when you kick and ban with 1 id and 1 reason kick, the next time MyBot will kicked and banned with the correct id and reason kick before.

+ Example: When I type the command:!b NickName, MyBot will ban IP/HOST and kick with random reasons (For example kick with reason3 and id is 1234: Please benice if you don't want to get a face of ban [id: 1234])

+ After kicking and ban MyBot will automatically save to the file atb_database.txt as follows: [id: 1234], NickName, *!*@ IP/HOST, Please benice if you don't want to get a face of ban. Next time, if NickName or IP/HOST this join room will join the room will be auto kick and ban with this id and kick reason.

2. Regarding the add/del/list commands I have the following comments:

2.1. Command:!b <nick> [reason] <== I want this command when there is no reason, MyBot will automatically random reason from atb_reason.txt. If there is reason, MyBot will save
the reason in the file atb_database.txt as mentioned in point 1 above.

2.2. The command:!badd <nick> <host> [id] [reason] can be edited in the following order to make it easier to remember:!badd <nick> <host defautl *!*@ Host> [reason] [id]. Example:!badd BadNick *!*@10.11.12.13 You are badchatter not welcome here [id: 9999]

2.3. Command:!bdel <nick|mask|id> <=== When typing 1 of these 3, MyBot will automatically delete all information about nick|mask|id in the file atb_database.txt. And the next time that Nick or Mask enters the room, he/she will not be kicked/banned again.

2.4. Commands:!bfind and !blist I like and have no idea about this command. I like it very much.

2.5. In your example image, I see that the reason kick and id kick are not the same. I want the following kicks to have the reason and id as the first time I was kicked/ban.

https://i.ibb.co/3SwWTcs/Akick-Temp-Ban.png

Hope you research and code perfectly according to my opinion above. I sincerely thank you and wish you good health, happiness and peace.

P/S: THIS IS MY TEST ON YOUR CODE: IT WRONG
I use command: Add user to database: !badd <nick> <host> [id] [reason] ==> !badd nicktest *!*@42.118.MLUE.VR6V 9876 Testing for Epic code

Here is the result:

[20:22:57] * nicktest (DVQ@216.244.ULQT.38V9) joins #lobby
[20:22:59] * MyBot sets mode: +b *!*@216.244.ULQT.38V9
[20:22:59] * nicktest was kicked from #lobby by MyBot ([Banned] (reason: [Banned] (reason: You are no longer welcome here) [id:9876];nicktest;*!*@42.118.MLUE.VR6V;#test;Testing for Epic code)

ANTHER TEST: WITH COMMAND: !b <nick> [reason]
The result:
[20:30:49] <@ChanGuard> !b nickVSA Testing for Epic code script
[20:30:50] * Kendy sets mode: +b *!*@216.244.ULQT.38V9
[20:30:50] * nickVSA was kicked from #test by Kendy (😈 Testing for Epic code script [id:VA45793])
[20:30:57] * ChanGuard sets mode: +l 7
[20:31:22] * Kendy sets mode: -b *!*@216.244.ULQT.38V9
[20:31:33] * nickVSA (DVQ@216.244.ULQT.38V9) joins #test
[20:31:34] * Kendy sets mode: +b *!*@216.244.ULQT.38V9
[20:31:34] * nickVSA was kicked from #test by Kendy ([Banned] (reason: [Banned] (reason: You are no longer welcome here) [id:VA45793];nickVSA;*!*@216.244.ULQT.38V9;#test;😈 Testing for Epic code script)

Last edited by Robert; 08/05/21 01:33 PM.
Re: How to kick with older reason? Help me pls [Re: Robert] #268828 08/05/21 01:22 PM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
Quote
1. I have 2 text files:
+ (1) atb_reason.txt (in this file there are about 10 reasons kick from reason1 to reason10 I have preset, one reason per line);
+ (2) atb_database.txt (in this file will save the data about [id kicknumber],NickNameOfKick,AddressIP/HOST,ReasonKick), if any NickName or AddressIp/HOST is in there, entering the room will be banned and kicked with ReasonKick and this [id: kicknumber]. I mean when you kick and ban with 1 id and 1 reason kick, the next time MyBot will kicked and banned with the correct id and reason kick before.

Quote
2.1. Command:!b <nick> [reason] <== I want this command when there is no reason, MyBot will automatically random reason from atb_reason.txt. If there is reason, MyBot will save
the reason in the file atb_database.txt as mentioned in point 1 above.

As far as I understand correctly the translation of what you have written, this command should work in the latest version of the script exactly as you want.

For example, you enter the command on the #test channel: "!b troll You are not welcome here"
– writing a row in the database will look like this: "[id:XW93884];troll;*!*@OKCHI.VPXW7.JMXH6.HEQ79;#test;🚩 You are not welcome here".

You can leave out the reason, and then it will be taken from the file "atb_reason.txt" in random order. Let me remind you that all the parameters indicated in the example in square brackets "[]" are optional, but can be used as an additional parameter. For example: "!b <nick> [reason]" or "!b <nick>".

Quote
2.2. The command:! Badd <nick> <host> [id] [reason] can be edited in the following order to make it easier to remember:! Badd <nick> <host defautl *! * @ Host> [reason] [id ]. Example:! Badd BadNick *!*@10.11.12.13 You are badchatter not welcome here [id: 9999]

Placing the "[reason]" parameter at the very end is more logical, because the sentence with the reason for the kick can be quite long, consisting of several words separated by a space. Otherwise, it will create confusion in the sequence of parameters while typing the command and will have a negative impact on the correct operation of the script. Therefore, it would be a mistake to swap these parameters.

Quote
2.3. Command:!bdel <nick|mask|id> <=== When typing 1 of these 3, MyBot will automatically delete all information about nick|mask|id in the file atb_database.txt. And the next time that Nick or Mask enters the room, he/she will not be kicked/banned again.

I was thinking about the possibility of using the ordinal of the record that is in the database, but this contradicts the fact that the identification numbers can also have numeric values and then this can lead to an erroneous selection of the row to delete, so this is will work better in a format that was presented in the description for the script: "!bdel <nick|host|id>"

Quote
2.5. In your example image, I see that the reason kick and id kick are not the same. I want the following kicks to have the reason and id as the first time I was kicked/ban.

The fact is that I deliberately used different nicknames for the example, and if you look more closely, each nickname corresponds to a different line in the database list. This can be tracked by the ban ID number.
The user with the nickname "bizze" corresponds to the 5th line in the database with the identifier "[id:EZ82031]", since the search was carried out by his nickname.
Then he changed his nickname to "troll" and join to this channel again, but now his nickname was found in the database in line number 1 with the identifier "[id:XW93884]".

Line 5: [id:EZ82031];bizze;*!*@A522A.U2RLR.UQ1SP.G5EG5;#test;✞ The Operator is always right
Line 1: [id:XW93884];troll;*!*@OKCHI.VPXW7.JMXH6.HEQ79;#test;πŸ”¨ Get out of here away!

In this example, the database contains only these nicknames, but there is no entry with a similar host. So the script will search for the incoming user according to the data that is in the database and, if found, will return the data of the line in which the user entering the channel was found.




πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Robert] #268829 08/05/21 01:50 PM
Joined: Jan 2012
Posts: 122
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 122
Quote
P/S: THIS IS MY TEST ON YOUR CODE: IT WRONG
I use command: Add user to database: !badd <nick> <host> [id] [reason] ==> !badd nicktest *!*@42.118.MLUE.VR6V 9876 Testing for Epic code

Here is the result:

[20:22:57] * nicktest (DVQ@216.244.ULQT.38V9) joins #lobby
[20:22:59] * MyBot sets mode: +b *!*@216.244.ULQT.38V9
[20:22:59] * nicktest was kicked from #lobby by MyBot ([Banned] (reason: [Banned] (reason: You are no longer welcome here) [id:9876];nicktest;*!*@42.118.MLUE.VR6V;#test;Testing for Epic code)

ANTHER TEST: WITH COMMAND: !b <nick> [reason]
The result:
[20:30:49] <@ChanGuard> !b nickVSA Testing for Epic code script
[20:30:50] * Kendy sets mode: +b *!*@216.244.ULQT.38V9
[20:30:50] * nickVSA was kicked from #test by Kendy (😈 Testing for Epic code script [id:VA45793])
[20:30:57] * ChanGuard sets mode: +l 7
[20:31:22] * Kendy sets mode: -b *!*@216.244.ULQT.38V9
[20:31:33] * nickVSA (DVQ@216.244.ULQT.38V9) joins #test
[20:31:34] * Kendy sets mode: +b *!*@216.244.ULQT.38V9
[20:31:34] * nickVSA was kicked from #test by Kendy ([Banned] (reason: [Banned] (reason: You are no longer welcome here) [id:VA45793];nickVSA;*!*@216.244.ULQT.38V9;#test;😈 Testing for Epic code script)


Tell me, did you conduct this testing using the default code in the form in which I originally presented it, or have you tested after you made some of your own changes in the code that could cause similar errors in its work?


πŸ…ΈπŸ†πŸ…² - 𝔦'𝔱𝔰 𝔸 π•‚π–ŽΙ΄π™™ ᴏ𝙛 π•„π™–π–Œπ™žπ™˜
Re: How to kick with older reason? Help me pls [Re: Epic] #268830 08/05/21 02:01 PM
Joined: Mar 2021
Posts: 21
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 21
Originally Posted by Epic
[quote]
Tell me, did you conduct this testing using the default code in the form in which I originally presented it, or have you tested after you made some of your own changes in the code that could cause similar errors in its work?


Answer: I change this 2 lines only:
%atb_pathreason = $mircdir $+ atb_reason.txt <=== change $scriptdir TO $mircdir
%atb_pathdb = $mircdir $+ atb_database.txt <=== change $scriptdir TO $mircdir

Page 1 of 2 1 2