Code: Select all
# March 5, 2012
# http://forum.egghelp.org/viewtopic.php?t=18870
# Be sure that bmotion is loaded before this script.
# This script attempts to set user defined flag +bmotion. If bmotion does not exist first, it is a Bad Thing.
bind raw - invite the341
set oldinvitetime [expr [unixtime] - 60]
set oldchan ""
proc the341 {from key text} {
global botnick oldinvitetime oldchan
set chan [string trimleft [lindex [split $text] 1] :]
set nick [lindex [split $from !] 0]
set invitetime [unixtime]
set diff [expr $invitetime - $oldinvitetime]
if {$diff < 60} {
putserv "privmsg $nick :I was just invited to $oldchan. Please wait [expr 60 - $diff] seconds before inviting me again."
return 0
}
set oldinvitetime $invitetime
set oldchan $chan
channel add $chan
utimer 3 [list do_check $nick $chan]
}
proc do_check {nick chan} {
global botnick
if {[isop $nick $chan] } {
putserv "privmsg $chan :Hi there I'm $botnick. I was invited by $nick. Try +commands for a list of my commands and +opcom for the list of commands who only can be used by an Op."
channel set $chan +bmotion
} else {
putserv "privmsg $chan :I was invited by a non-op. Please try again with an opped Nick."
channel remove $chan
}
}
Wow... I don't even remember doing that.Get_A_Fix wrote:You could play around with something like this and make it do what you need. The fundamentals are there.
lolwillyw wrote:Wow... I don't even remember doing that.
Code: Select all
# noinvite.tcl,v1.0
## SYNTAX: !noinvite on|off
# Set global trigger
set noInvTrig "!"
# Set the time duration (in minutes) for ban here (if 0 is set, this would be permanent)
set timetoban "5"
# Set flags that can enable/disable this procedure (default: globalop|chanmaster)
set noInvFlags o|m
# Set the reasons for no invitations ban
set noInvReason "This channel does not allow invites to bot or public"
# BAN Types are given below;
# 1 - *!*@some.domain.com
# 2 - *!*@*.domain.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.domain.com
# 5 - *!*ident*@some.domain.com
# 6 - *nick*!*@*.domain.com
# 7 - *nick*!*@some.domain.com
# 8 - nick!ident@some.domain.com
# 9 - nick!ident@*.host.com
set bantype 1
## ----- Lets get coding! -----
setudef flag noinvite
proc makeInvTrig {} {
global noInvTrig
return $noInvTrig
}
bind raw - invite check:invite
proc check:invite {from key text} {
global botnick noInvReason timetoban
set nick [lindex [split $from !] 0]
if {[string match "*#*" $text]} {
set chan [lindex [split $text] 1]
set uhost [getchanhost $nick $chan]
if {[validuser [nick2hand $nick]] || [isop $nick $chan]} {return}
set mask [make:banmask $uhost $nick]
newban $mask $botnick $noInvReason $timetoban
}
}
bind pub - ${noInvTrig}noinvite noInv:pub
proc noInv:pub {nick uhost hand chan arg} {
global noInvFlags
if {[matchattr [nick2hand $nick] $noInvFlags $chan]} {
if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [makeInvTrig]noinvite on|off"; return}
if {[lindex [split $arg] 0] == "on"} {
if {[channel get $chan noinvite]} {putquick "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
channel set $chan +noinvite
puthelp "PRIVMSG $chan :Enabled No Invitations for $chan"
return
}
if {[lindex [split $arg] 0] == "off"} {
if {![channel get $chan noinvite]} {putquick "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
channel set $chan -noinvite
puthelp "PRIVMSG $chan :Disabled No Invitations for $chan"
return
}
}
}
proc make:banmask {uhost nick} {
global bantype
switch -- $bantype {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
putlog ".:Loaded:. noinvite.tcl,v1.0 for simo @ egghelp.forums"
hmm, strange, I haven't been able to test it but I was going from willyw's script. It, from past experience, should have worked fine.simo wrote:i get this error :Code: Select all
Tcl error [check:invite]: illegal channel: #jkjs
Well, I was going to use a foreach and check every channel, but I just used a newban call instead. This does the same thing, as long as the bot is @'d. It adds the ban to the internal banlist, so it'll add the ban on any active channel the user joins or is on, until removed.simo wrote: ( it seems to get the channel where its invited to
while it needs to set ban on every channel where bot is opped
and check if the one who sent the invite is in any of those channels and get kicked as well as the ban )
This line:simo wrote:i get this error :
( it seems to get the channel where its invited to
while it needs to set ban on every channel where bot is opped
and check if the one who sent the invite is in any of those channels and get kicked as well as the ban )
Tcl error [check:invite]: illegal channel: #jkjs
Code: Select all
set chan [string trimleft [lindex [split $text] 1] :]
Yes.Get_A_Fix wrote: ...
Well, I was going to use a foreach and check every channel, but I just used a newban call instead. This does the same thing, as long as the bot is @'d. It adds the ban to the internal banlist, so it'll add the ban on any active channel the user joins or is on, until removed.
Code: Select all
# March 14, 2017
# http://forum.egghelp.org/viewtopic.php?p=105901#105901
## Basicly it needs to set ban (if eggdrop is gettin invites for other channels) on all channels the bot is opped and
## also check if the inviter is on channel and kick if so
# Do: .chaninfo #channel
# See: enforcebans
# Experiment with it. Probably needs to be +enforcebans
#####################################
#####################################
bind raw - invite invite_banner
proc invite_banner {from key text} {
global botnick
set nick [lindex [split $from !] 0]
set uhost [lindex [split $from !] 1]
set invited_to_chan [string trimleft [lindex [split $text] 1] :]
putquick "privmsg #helpbottest : "
putquick "privmsg #helpbottest :from is: $from "
putquick "privmsg #helpbottest :nick is: $nick "
putquick "privmsg #helpbottest :uhost is: $uhost "
putquick "privmsg #helpbottest :masked host is: [maskhost $nick!$uhost 2] "
newban [maskhost $nick!$uhost 2] $botnick "global banned for inviting $botnick to $invited_to_chan" 60
}