This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Warn Action

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Warn Action

Post by MrBeta »

Hi, I was looking for a simple tcl that warn the user not to use any action /me in the channel

Thanks in advance :wink:
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: Warn Action

Post by willyw »

MrBeta wrote:Hi, I was looking for a simple tcl that warn the user not to use any action /me in the channel
And what will trigger this warning?

In other words - do you want a scheduled announcement? Like four times per day, or something?

Or - do you want bot to react if someone actually does it?
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Post by MrBeta »

A simple warning not to use actions of any kind.
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Experiment with this

It does both.

If you don't want both, simply delete the part you don't want. Or, comment it out.



Code: Select all

# July 23, 2019
# http://forum.egghelp.org/viewtopic.php?p=107714#107714
#
#

###
# This section will cause bot to react to /me in channel
# You must edit it.  Substitute your channel name for   #your_chan_here
#
###
bind ctcp - "ACTION" saw_me_in_chan


proc saw_me_in_chan {nick uhost handle dest keyword text} {
        putserv "privmsg #your_chan_here :Hey $nick !   No channel wide CTCP's in this channel,  ok?"
}
###

###
###

###
# This section will cause bot to do an announcement in the channel, on a schedule.
# You must edit it.
# First, visit:  https://crontab.guru/  if you are not already familiar with how to configure the 
# timing of crontab.  It will help.
# Edit the     bind cron     line.  The part that is currently,  "* * * * *"  must be edited.
# As it is now, it will announce every minute.  
#
# Next, substitute your channel name for   #your_chan_here
#

bind cron - "* * * * *" announce_ctcp_warning


proc announce_ctcp_warning {min hour day month weekday} {
        putserv "privmsg #your_chan_here :No channel CTCP's in this channel, please"
}

###
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Tip:
If you edit a bind line after it has been loaded, and rehash bot, you could easily get unexpected results.

The simply solution is: Don't rehash. Do .restart .
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Post by MrBeta »

Thank you willyw, it works very well.
Maybe there may be the problem for those who ignore the message, leading the bot to make a flood of repetitions, a kick after 2 warnings could be a future solution, as well as exempt from recalls other bots and operators, but for the moment thank you for the help :wink:
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

MrBeta wrote: ...
Maybe there may be the problem for those who ignore the message, leading the bot to make a flood of repetitions, ...
Correct.
... a kick after 2 warnings could be a future solution, as well as exempt from recalls other bots and operators,...
Check out AllProtection script. Links to its location can be found in posts by Sir_Fz or Opposing, here: http://forum.egghelp.org/viewtopic.php? ... start=1335

It has a LOT of capabilities, and I think that watching for ctcp is one of them. You'd have to read to be sure though.
If so, you could use this script, and just turn off everything that you don't want. That's what I do... I only have 3 or 4 things enabled.
It does have config options to not punish ops, voices, +f , etc.
And it can do escalation : 1st, warn - 2nd kick - 3rd ban , and this is configurable too.

but for the moment thank you for the help :wink:
You are welcome.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Post by MrBeta »

From what I know and see AllProtection has a protection for text floods (action or msg), but not for individual diversified actions.
I always prefer single tcl for specific uses by splitting them into bots.
Thank you again
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Post by MrBeta »

I found this tcl, I ask if it is possible to combine it with the one proposed in this thread, that is 2 warning and a kickban to the 3 action

Code: Select all

################################################################################
################################################################################
## INITIAL INFO ################################################################
putlog "...Initialyse action flood protection. Please wait."               
################################################################################
##### This script made by toHands.org work for #nouveau-brunswick on Efnet #####
#####                                                                      #####
#####                      CREATED BY AcADIeN                              #####
################################################################################
## VARIABLE  ###################################################################
set count 2                                                                
set seconds 1200                                                             
set allow ""                                                               
set channels "#chann"                                                       
## INFO ########################################################################
putlog "...Loaded protection ($channels) action permission ($count action in $seconds secs)"
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
##    DO NOT EDIT AFTER THIS LINE    ###########################################
################################################################################
################################################################################
##          START SCRIPT          ##############################################


# BIND FOR ALL ACTION
bind ctcp - ACTION floodprot

# PROC FLOODPROT TO PROTECT AGAINST LAMER
proc floodprot { nick uhost hand chan key arg } {
  global botnick livesaver actionflood allow channels seconds count
  if {$nick == $botnick} {return 0}
  if {[lsearch -exact $channels $chan] == -1} {return 0}
  if {[isop $nick $chan]} {return 0}
  lappend livesaver($uhost:$chan) 1
  utimer $seconds "expire livesaver($uhost:$chan)"
  if {[llength $livesaver($uhost:$chan)] >= $count} {
    putserv "KICK $chan $nick :!"
  }
}
# PROC EXPIRE TO REMOVE A LAMER IN THE LIST
proc expire var_exp {
  upvar $var_exp var_pointer
  if {[llength $var_pointer] > 1} {
    set var_pointer [lrange $var_pointer 1 end]
  } else {
    unset var_pointer
  }
}


##          END SCRIPT          ################################################
################################################################################
## LOADED ######################################################################
putlog "Loaded Lamer's action flood protection by toHands.org"             
################################################################################
################################################################################
################################################################################
################################################################################
##                      Copyright 2004 by toHands.org                     ######
################################################################################
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

You could try my warning code from this post

http://forum.egghelp.org/viewtopic.php?t=20917

Allprotection's warning system is more advanced, while mine is much more simple :lol:

Code: Select all

Code:

#Badwords
set swearwords {
"*bad*"
}

#Time until reset warnings

set brd "30"

#max warning

set maxwarning "5"

###########Code############
setudef flag ctswear

bind pubm - * ctswear:pub

proc ctswear:pub {nick host hand chan text} {
global swearwords brd maxwarning warn
if {[channel get $chan ctswear]} {
   foreach badword $swearwords {
    if {[string match -nocase $badword $text]} {
incr warn($host) +1
if {![$warn($host) == $maxwarning]} {
putserv "NOTICE $nick :Warning! Do not Swear on $chan, cease immediately or else"
utimer $brd {incr warn($host) -1 }
} else {
putserv "kick $nick $chan Kickbanned from $chan : Reason: Use of swear word $badword"
set warn($host) "0"
    }
   }
  }
 }
}
Thats a bad word script with the warning system, but it has the same base :wink:
Last edited by ComputerTech on Wed Jun 09, 2021 11:39 am, edited 2 times in total.
ComputerTech
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

ComputerTech
your code does not work generates this error,,, in partyline

Code: Select all

[00:22:35] Tcl error [ctswear:pub]: invalid command name "1"
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
MrBeta
Voice
Posts: 35
Joined: Sat Dec 28, 2013 2:16 pm
Contact:

Post by MrBeta »

Simplicity is sometimes better Computertech :wink:
I ask you if it is possible to set a ban after 4 warnings
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Code: Select all

# Set max warnings before Punishment

set warn(max) "4"

# Set X time before timer undo's warning amount (in seconds)

set warn(reset) "60"

# Set Kick Reason

set warn(reason) "Abusage of /me"


######################
bind CTCP - ACTION action:avoid

proc action:avoid {nick host hand chan key text} {
global warn
if {[isbotnick $nick]} return
if {[matchattr $hand "ofmn|ofmm"]} return
if {[isop $nick $chan]} return}
incr warn($host) 1
if {$warn($host) > $warn(max)} {
putquick "MODE $chan +b $host"
putquick "KICK $chan $nick $warn(reason)"
set warn($host) "0"
} else {
putserv "PRIVMSG $chan :Warning $warn($host)"
utimer $warn(reset) {incr warn($host) -1 }
  }
}
Untested

EDIT Updated (thanks to caesar)
Last edited by ComputerTech on Tue Mar 09, 2021 9:20 am, edited 1 time in total.
ComputerTech
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

if {$nick == $::botnick} {return 0
} elseif {[isop $nick $chan]} {return 0
} elseif {[matchattr [nick2hand $nick] ofmn|ofmm ]} {return 0} 
could be made nicer like this:

Code: Select all

if {[isbotnick $nick]} return
if {[matchattr $hand "ofmn|ofmm"]} return
if {[isop $nick $chan]} return
Notice the use of isbotnick function and dropping the nick2hand since the user triggering the action:avoid function has it's user handle defined in the hand variable.

The warn(reason) variable isn't defined anywhere.
Once the game is over, the king and the pawn go back in the same box.
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

oh true caesar, thanks for pointing that out :wink:

I'll fix the above post with your suggestions

And yeah i was working all day and was in a hurry, so I didn't have a lot of time to do it :)
ComputerTech
Post Reply