egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Warn Action
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Tue Jul 23, 2019 8:29 am    Post subject: Warn Action Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jul 23, 2019 3:00 pm    Post subject: Re: Warn Action Reply with quote

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 !
Back to top
View user's profile Send private message
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Tue Jul 23, 2019 4:28 pm    Post subject: Reply with quote

A simple warning not to use actions of any kind.
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jul 23, 2019 5:15 pm    Post subject: Reply with quote

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:

# 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 !
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jul 23, 2019 5:17 pm    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Wed Jul 24, 2019 3:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Jul 24, 2019 7:47 am    Post subject: Reply with quote

MrBeta wrote:

...
Maybe there may be the problem for those who ignore the message, leading the bot to make a flood of repetitions, ...


Correct.

Quote:

... 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?t=9721&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.


Quote:

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 !
Back to top
View user's profile Send private message
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Wed Jul 24, 2019 11:16 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Thu Feb 25, 2021 5:44 pm    Post subject: Reply with quote

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:

################################################################################
################################################################################
## 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                     ######
################################################################################
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Feb 26, 2021 12:46 pm    Post subject: Reply with quote

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 Laughing
Code:

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
_________________
ComputerTech


Last edited by ComputerTech on Wed Jun 09, 2021 11:39 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sat Feb 27, 2021 12:26 am    Post subject: Reply with quote

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

[00:22:35] Tcl error [ctswear:pub]: invalid command name "1"

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
MrBeta
Voice


Joined: 28 Dec 2013
Posts: 35

PostPosted: Mon Mar 01, 2021 12:44 pm    Post subject: Reply with quote

Simplicity is sometimes better Computertech Wink
I ask you if it is possible to set a ban after 4 warnings
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Mon Mar 08, 2021 8:51 pm    Post subject: Reply with quote

Code:

# 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)
_________________
ComputerTech


Last edited by ComputerTech on Tue Mar 09, 2021 9:20 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Mar 09, 2021 1:47 am    Post subject: Reply with quote

Code:

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:

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.
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Tue Mar 09, 2021 9:16 am    Post subject: Reply with quote

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 Smile
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber