- Home»
- Cod sursa: ercmini.tcl
ercmini.tcl
ercmini.tcl
ERCmini enables an eggdrop 1.3.x bot to manage the following channel operations: Allows people to invite themselves to the channel even though they don't have ops on the bot; Add a user with a channel specific +I and they will be allowed to /msg the bot with whatever the invsw variable is set to. N
| Postat de | Copyright | Categorie | Review user | Vizualizari | Data |
|---|---|---|---|---|---|
| btc | EverRaver | chanops | Cod netestat | 519 | 2023-12-25 08:35:56 |
######################################
### ERCmini - IRC Channel Manager; ###
### by EverRaver on efNet ; ###
### everraver@home.com ; ###
set ERCversion 1.8mini ; ###
### 07/98 - 1/99 ; ###
### for use on eggdrop 1.3.x ; ###
######################################
###########################################################################
#
# ERCmini is an extracted chunk from the full ERC script.
#
# ERCmini enables an eggdrop 1.3.x bot to manage
# the following channel operations:
#
# - Non-op Invite
# Allows people to invite themselves to the channel even though
# they don't have ops on the bot.
#
# Add a user with a channel specific +I and they will be allowed
# to /msg the bot with whatever the invsw variable is set to.
# No password needs to be set. Currently only works on one channel.
#
# - Botnet Dynamic Channel Share
# This is to 'patch' the default behaviour of eggrop which sets
# dynamic channels to -shared on startup which prevents channel
# specific flags from being shared with the other share bots on
# the botnet.
#
# This option will automatically set all of the bot's dynamic channels
# to +shared 1 minute after the bot is started or rehashed.
#
# In DCC, .SHARE will also force all bot channels to +shared.
#
# You must have +t or higher to use this. (.SHARE)
#
# - Nonuser List
# Lists all users online and in a channel the bot is in, that haven't
# been added to the bot's userlist.
#
# In DCC, .NONUSER will list all non-registered users.
#
# You must have +m or higher to use this. (.NONUSER)
#
###########################################################################
###########################################################################
## DEFINITIONS
###########################################################################
## This Nick will be Messaged when someone Not Recognized by the bot
## tries the Invite command.
set warnop "EverRaver"
## Use the Non-op invite routine? 1 for YES - 0 for NO
set invuse 0
## This is the Channel to which the bot will Invite a user.
set invchan "#channel"
## Set this to the Invite Switch to message the bot for invite.
## for example: /msg botnick knockknock
set invsw "knockknock"
## Use the Botnet Channel Share routine? 1 for YES - 0 for NO
## Set this to 1 to set all of the bot channels to +shared
## This will enable the bot to share channel specific flags
## with any channel bot that's linked and sharing user files.
## Dynamically added channels default to -shared on restart and
## the shared status isn't easily changed on the fly.
set shareuse 1
###########################################################################
# # NO NEED TO MODIFY ANYTHING BELOW HERE # #
# # NO NEED TO MODIFY ANYTHING BELOW HERE # #
###########################################################################
## This is the number of Minutes to Wait Before Trigerring the
## botnet channel share routine.
## This gives the bot time to settle in to it's channels on startup.
set sharetime 1
## This is the Tag that will precede text in the Bot's Log
## marking an ERC event.
set ltag "-ERCmini-"
## set invite channel to lower case
set invch "[string tolower $invchan]"
###########################################################################
## NONOP INVITE - er_inv - /MSG <botnick> $invsw
###########################################################################
if {$invuse == 1} {
bind msg -|- [set invsw] er_msg_inv
proc er_msg_inv {nick uhost hand arg} {
global warnop logtag invch invsw
#check privs
append nickhost $nick "!" $uhost
set target [finduser $nickhost]
if {$target == "*"} {
if {[validuser $nick]} {
if {$arg !="" && $arg !="$invch"} {
putserv "PRIVMSG $warnop :$nick tried the $invsw command with '$arg'."
putlog "$logtag: $nick tried the $invsw command with '$arg'."
} {
putserv "PRIVMSG $warnop :$nick tried the $invsw command."
putlog "$logtag: $nick tried the $invsw command."
}
set hosts [getuser $nick hosts]
if {[llength $hosts] == 1} {
putserv "PRIVMSG $warnop :$nick has the following hostmask already:"
} {
putserv "PRIVMSG $warnop :$nick has the following hostmasks already:"
}
foreach host [getuser $nick hosts] {
putserv "PRIVMSG $warnop : $host"
}
putserv "PRIVMSG $warnop :Add .+host $nick *!$uhost"
putserv "PRIVMSG $warnop :or .+host $nick [maskhost $nickhost]"
putlog "$logtag: Add .+host $nick *!$uhost"
putlog "$logtag: or .+host $nick [maskhost $nickhost]"
puthelp "NOTICE $nick :Sorry, Your hostmask is not recognized."
puthelp "NOTICE $nick :Contact $warnop about getting it added. Thanks."
} {
if {$arg !="" && $arg !="$invch"} {
putserv "PRIVMSG $warnop :$nick $uhost tried the $invsw command with '$arg'."
putlog "$logtag: $nick $uhost tried the $invsw command with '$arg'."
} {
putserv "PRIVMSG $warnop :$nick $uhost tried the $invsw command."
putlog "$logtag: $nick $uhost tried the $invsw command."
}
}
return 0
}
if {[matchattr $target |I $invch] == 0} {
putserv "PRIVMSG $warnop :$target tried the $invsw command and is not +I in $invch."
puthelp "NOTICE $nick :Sorry, You haven't been set up for an invite to $invch."
puthelp "NOTICE $nick :Contact $warnop about getting set up. Thanks."
putlog "$logtag: $target tried the $invsw command and is not +I in $invch."
return 0
}
if {[validchan $invch] == 0} {
puthelp "NOTICE $nick :Sorry, I'm not in $invch."
return 0
}
if {[botisop $invch] == 0} {
puthelp "NOTICE $nick :Sorry, I'm not an op in $invch."
return 0
}
if {$target != "*"} {
if {$arg !="" && $arg !="$invch"} {
puthelp "PRIVMSG $nick :$nick you don't have to use '$arg' after $invsw :)"
}
putserv "INVITE $nick :$invch"
putserv "NOTICE $nick :You are invited to join $invch."
putlog "$logtag: $nick $nickhost has been invited to $invch."
}
return 0
}
} {
bind msg -|- [set invsw] er_msg_inv
unbind msg -|- [set invsw] er_msg_inv
}
###########################################################################
## LIST CHANNEL NICK AND HOST OF NONUSERS - er_nonusr - .NONUSER
###########################################################################
bind dcc mt|- nonuser er_dcc_nonusr
proc er_dcc_nonusr {hand idx arg} {
putcmdlog "#$hand# nonuser"
foreach chan [channels] {
foreach guy [chanlist $chan] {
if { [nick2hand $guy $chan] == "*" } {
putdcc $idx "[er_fl $chan 15][er_nmsign $guy $chan][er_fl $guy 12][getchanhost $guy $chan]"
}
}
}
return 0
}
proc er_nmsign {guy chan} {
if {[isop $guy $chan] == 1} {
return "@"
} elseif {[isvoice $guy $chan] == 1} {
return "+"
} else {
return " "
}
}
###########################################################################
## SET DYNAMIC CHANNELS TO SHARED - er_share - .SHARE
###########################################################################
bind dcc t|- share er_dcc_share
proc er_dcc_share { hand idx arg } {
putcmdlog "#$hand# share"
er_share
}
proc er_share { } {
global logtag
set sharenum [lsearch [channel info [lindex [channels] 0]] "-shared"]
if { $sharenum == -1 } {
set sharenum [lsearch [channel info [lindex [channels] 0]] "+shared"]
}
foreach channel [channels] {
if {[lindex [channel info $channel] $sharenum] == "-shared"} {
channel set $channel +shared
}
}
er_kill_share
putlog "$logtag: All Bot channels set to +shared"
}
proc er_kill_share { } {
foreach ttime [timers] {
if {[string compare [lindex $ttime 1] er_share ] == 0} {
killtimer [lindex $ttime 2]
}
}
return 0
}
if {$shareuse == 1} {
timer $sharetime er_share
}
###########################################################################
## MISCELLANEOUS PROCS - MISCELLANEOUS PROCS - MISCELLANEOUS PROCS
###########################################################################
proc u {} {return }; #underline
proc r {} {return }; #reverse
proc b {} {return }; #bold
proc c {} {return }; #color
#to lower
proc er_tlow {txt} {
return [string tolower $txt]
}
#to upper
proc er_tup {txt} {
return [string toupper $txt]
}
#fill spaces right
proc er_fl {txt len} {
while {[string length $txt] < $len} {
append txt " "
}
return $txt
}
#fill characters right
proc er_flc {txt len char} {
while {[string length $txt] < $len} {
append txt $char
}
return $txt
}
#fill spaces left
proc er_flf {txt len} {
while {[string length $txt] < $len} {
set txt " $txt"
}
return $txt
}
###########################################################################
## INTERNAL DEFINITIONS - These need the preceeding procs
###########################################################################
## This beefs up the ltag variable - boldfaces and puts [] around it
if {[info exists logtag] == 1} {
unset logtag
}
append logtag [b]\[$ltag\][b]
###########################################################################
## END END END END END END END END END END END END END END END END END END
###########################################################################
putlog "*** ERCmini by EverRaver loaded. (v.$ERCversion) ***"
if {$invuse == 1} {
putlog "*** Use /msg $botnick $invsw for an invite to $invchan."
}
IRC Snippets