namespace eval oper::identify { variable oi; # oper_identify.tcl -- # ### Version: # 29.01.2024 # ### Copyright: # CIRCLED C WITH OVERLAID BACKSLASH (c) 2023-2024 X-Anonymous-Y # ### License: # public domain (PD) # ### Contact: # irc.kn-v2.com #Eggdrop # ### Help: # ### Usage: # ### ToDo: # ### Changes: # 29.01.2024 (Bug fix) Fixed some small bugs (X-Anonymous-Y) # 28.01.2024 (Code cleaned) If clauses that are no longer needed have been deleted (X-Anonymous-Y) # 28.01.2024 (New feature) Added regex to check set variables (X-Anonymous-Y) # 25.01.2024 (Code changed) Added variable nsc [namespace current] and variable oi; for global usage. This makes the code a lot smaller and clearer (X-Anonymous-Y) # 22.01.2024 (Code changed) Changed comments and variables (X-Anonymous-Y) # 21.01.2024 (Code cleaned) Cleaned up comments and some code (X-Anonymous-Y) # 20.01.2024 (New feature) User modes change to oi(user:mode) after RAW 381 server notification (X-Anonymous-Y) # 01.01.2024 (Code cleaned) The code has been cleaned according to all possible best practices (X-Anonymous-Y) # 25.11.2016 (Script created) Script functions considered and script created (Diamond85 - my old nick) # # # ### The configuration begins # # ## # Variable settings ## # Set the name you want to use for the operator here. # Format: "name" # Examples: "The-Oper" set oi(name) "The-Oper" # Set the password you want to use for the operator here. # Format: "password" # Examples: "TopSecretOperPassword!" set oi(password) "TopSecretOperPassword!" # Set the network you want to connect to here. # Format: "network" # Examples: "KN-V2-Network" set oi(network) "KN-V2-Network" # Set here the user mods that should be set on the bot after the operator identification. # Format: "+/-user_mode" # Examples: "+B", "+iB-w", "+IBs +cCqQ" ... # Set it to "0" so that no user modes are changed. # # All possible user modes for InspIRCd can be found here: (https://docs.inspircd.org/3/user-modes/) # and server snomasks for InspIRCd user mode (+/-s) here: (https://docs.inspircd.org/3/snomasks/) # # If your bot is used on a different server, first check which user modes the server supports! set oi(user:mode) "+ITW-s" # # ### End of configuration # # ### ### DO NOT EDIT ANYTHING BELOW HERE! UNLESS YOU KNOW WHAT YOU'RE DOING! ### ## # Various variables ## # [various:variables] : variable nsc [namespace current] set oi(logo:default) "\002\[Oper Identify\]\002" set oi(logo:color) "\002\[Oper Identify\]\002" set oi(logo:putlog) "\002*** \[Oper Identify\] ***\002" set oi(title:default) "\002\[Oper Identify\]\002" set oi(title:color) "\002\[Oper Identify\]\002" set oi(title:putlog) "\002*** \[Oper Identify\] ***\002" ## # Un/Binds | Init ## # [bind:evnt] : bind evnt - loaded ${nsc}::init bind evnt - prerehash ${nsc}::unbind:bindings bind evnt - prerestart ${nsc}::unbind:bindings bind evnt - rehash ${nsc}::init bind evnt - init-server ${nsc}::start:oper # [init] : proc init {args} { variable nsc; variable oi; if {[info exists ${nsc}::oi(name)] && ([string trim $oi(name)] eq "")} { putlog "$oi(title:putlog) \[Error\] Please check \002oper_identify.tcl\002 --> \002set oi(name) \"$oi(name)\"\002" return } if {[info exists ${nsc}::oi(password)] && ([string trim $oi(password)] eq "")} { putlog "$oi(title:putlog) \[Error\] Please check \002oper_identify.tcl\002 --> \002set oi(password) \"$oi(password)\"\002" return } if {[info exists ${nsc}::oi(network)] && ([string trim $oi(network)] eq "")} { putlog "$oi(title:putlog) \[Error\] Please check \002oper_identify.tcl\002 --> \002set oi(network) \"$oi(network)\"\002" return } if {[info exists ${nsc}::oi(user:mode)] && ([string trim $oi(user:mode)] eq "") || ([${nsc}::check:regex user:mode:oper $oi(user:mode)])} { putlog "$oi(title:putlog) \[Error\] Please check \002oper_identify.tcl\002 --> \002set oi(user:mode) \"$oi(user:mode)\"\002" return } bind raw - 381 ${nsc}::user:mode bind ctcp -|- VERSION ${nsc}::version:reply } # [unbind:bindings] : proc unbind:bindings {args} { variable nsc; unbind raw - 381 ${nsc}::user:mode unbind ctcp -|- VERSION ${nsc}::version:reply } ## # Script information ## # [script:variables] : set oi(tcl:name) "oper_identify" set oi(tcl:project:name) "oidentify" set oi(tcl:author) "X-Anonymous-Y" set oi(tcl:contact) "irc.kn-v2.com #Eggdrop" set oi(tcl:copyright) "©" set oi(tcl:year) "2023-2024" set oi(tcl:version) "29.01.2024" set oi(tcl:website) "https://pastebin.com/UXdBNmfD" ## # Actions ## # [start:oper] : proc start:oper {type} { variable oi; putquick "OPER $oi(name) $oi(password)" putlog "$oi(title:putlog) \[Info\] Identify as operator with \002$oi(name)\002 on \002$oi(network)\002" return } # [user:modes] : proc user:mode {from keyword args} { variable nsc; variable oi; putlog "$oi(title:putlog) \[Info\] Successfully identified as operator." if {([string trim $oi(user:mode)] == 0)} { return } else { global botnick putquick "MODE $botnick $oi(user:mode)" putlog "$oi(title:putlog) \[Info\] User modes changed to \002$oi(user:mode)\002" return } } # [check:regex] : type arg proc check:regex {type arg} { if {($type eq "user:mode:oper")} { if {[regexp -- {^[+-][ioswBcdDgGHhIkLNORrSTWxz]*(?:([+-][ioswBcdDgGHhIkLNORrSTWxz]*(?:(\s)[+-][aAcCkKoOqQtxXdDfFgGjJlLnNrRvVwW]*(?:([+-][aAcCkKoOqQtxXdDfFgGjJlLnNrRvVwW]*)))*))$} ${arg}]} { return 0 } else { return 1 } } } ## # CTCP ## # [version:reply] : proc version:reply {nick uhost hand dest key arg} { variable oi; puthelp "NOTICE $nick :VERSION $oi(title:default) Name: \002$oi(tcl:name)\002 \| Projectname: \002$oi(tcl:project:name)\002 \| Version: \002$oi(tcl:version)\002 \| \002$oi(tcl:copyright)\002 \002$oi(tcl:year)\002 by \002$oi(tcl:author)\002 \| Contact: \002$oi(tcl:contact)\002 \| Website: \037\002$oi(tcl:website)\002\037" #putlog "$oi(title:putlog) \[Info\] CTCP version from $nick ($uhost)" return } } putlog "$oper::identify::oi(title:putlog) Name: \002$oper::identify::oi(tcl:name)\002 \| Projectname: \002$oper::identify::oi(tcl:project:name)\002 \| Version: \002$oper::identify::oi(tcl:version)\002 \| \002Loaded\002."