Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace eval oper::join {
- variable oj;
- # oper_join.tcl --
- #
- ### Version:
- # 29.01.2024
- #
- ### Copyright:
- # CIRCLED C WITH OVERLAID BACKSLASH (c) 2023-2024 X-Anonymous-Y
- #
- ## Code sections copied and, if necessary, adapted to my wishes.
- # (c) BLaCkShaDoW
- #
- ### License:
- # public domain (PD)
- #
- ### Contact:
- # irc.kn-v2.com #Eggdrop
- #
- ### Help:
- # Channel: .ojoin help
- #
- ### Usage:
- # To enable or disable oper join
- # DCC: .chanset #channel +ojoin/-ojoin
- # Channel: .ojoin set on/off
- #
- ### ToDo:
- # Add - .commands on dcc and private
- # Add - Channel (+q) owner allways has access - on: --> Bot (+n) owner and channel (+o) operator allways has access
- # Add - <protect> and <owner> - on: --> Available channel access options at the moment: <op>, <halfop> and <voice>
- #
- ### Changes:
- # 29.01.2024 (New feature) Added .ojoin (#channel) (X-Anonymous-Y)
- # 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 oj; 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)
- # 14.01.2024 (New feature) Added pub .ojoin set <setting> support for channel (X-Anonymous-Y)
- # 13.01.2024 (New feature) Added help, version output and ctcp version reply (X-Anonymous-Y)
- # 11.01.2024 (New feature) Added access check (for bot flags and channel access) for commands (X-Anonymous-Y)
- # 10.01.2024 (New feature) Copied and added multi language from BLaCkShaDoW for outputs (X-Anonymous-Y)
- # 01.01.2024 (Code cleaned) The code has been cleaned according to all possible best practices (X-Anonymous-Y)
- # 29.12.2023 (New feature) Added channel specific settings (X-Anonymous-Y)
- # 28.12.2023 (New feature) Added multi channel support (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 character you want to use for commands here.
- # Format: "character"
- # Examples: ".", "!", "^" ...
- set oj(command:character) "."
- # Set here which command word you want to use.
- # Format: "word"
- # Examples: "oper_join", "ojoin", "oj" ...
- set oj(command:word) "ojoin"
- # Set the default access here.
- # These are the accesses required to enable/disable or change script settings.
- # Bot (+n) owner and channel (+o) operator allways has access
- # Format: "<channel_access_name> <+/-global_flags(|+/-channel_flags #channel)>"
- # Examples: "halfop +mo|+mo #channel", "voice +mo|-", "op +o|-fm #chanel" ...
- # "0 0" To allow everyone to use the commands. [I recommend not set this to "0 0"! But you can set it to "op 0" or "0 +n", for example]
- #
- # You can find all possible (Eggdrop) user flags here https://docs.eggheads.org/using/users.html
- # Available channel access options at the moment: op, halfop and voice
- #
- # Usage: To change the access
- # DCC: .chanset #channel ojoin-access halfop +o|-fm
- # Channel: .ojoin set access halfop +o|-fm
- set oj(access) "0 +n|+n"
- # Set the default language here.
- # Format: "language"
- # Available options: "en", English
- # "de", Deutsch
- #
- # Usage: To change the language
- # DCC: .chanset #channel ojoin-language de
- # Channel: .ojoin set language de
- set oj(language) "en"
- # Set here whether the replies in the channels should be sent in color by default.
- # Format: "word"
- # Available options: "on", "off"
- #
- # Usage: To enable or disable output color
- # DCC: .chanset #channel ojoin-output_color off
- # Channel: .ojoin set output color off
- set oj(output:color) "on"
- # Set here whether the replies in the channels should be sent in length by default.
- # Format: "word"
- # Available options: "default", "long", "short"
- #
- # Usage: To change the output length
- # DCC: .chanset #channel ojoin-output_length short
- # Channel: .ojoin set output length short
- set oj(output:length) "long"
- #
- #
- ### 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 oj(logo:default) "\002\[Oper Join\]\002"
- set oj(logo:color) "\002\[Oper Join\]\002"
- set oj(logo:putlog) "\002*** \[Oper Join\] ***\002"
- set oj(title:default) "\002\[Oper Join\]\002"
- set oj(title:color) "\002\[Oper Join\]\002"
- set oj(title:putlog) "\002*** \[Oper Join\] ***\002"
- ##
- # Setudef
- ##
- # [setudef] :
- setudef flag ojoin
- setudef str ojoin-access
- setudef str ojoin-language
- setudef str ojoin-output_color
- setudef str ojoin-output_length
- ##
- # Un/Binds | Init | Channel settings
- ##
- # [bind:evnt] :
- bind evnt - loaded ${nsc}::init
- bind evnt - prerehash ${nsc}::unbind:bindings
- bind evnt - prerestart ${nsc}::unbind:bindings
- bind evnt - rehash ${nsc}::init
- # [init] :
- proc init {args} {
- variable nsc;
- variable oj;
- foreach chan [channels] {
- if {[info exists ${nsc}::oj(access)] && ([string trim $oj(access)] eq "")} {
- putlog "$oj(title:putlog) \[Error\] Please check \002oper_join.tcl\002 --> \002set oj(access) \"$oj(access)\"\002"
- return
- } else {
- if {([channel get $chan ojoin-access] eq "")} {
- channel set $chan ojoin-access $oj(access)
- }
- }
- if {[info exists ${nsc}::oj(language)] && ([string trim $oj(language)] eq "")} {
- putlog "$oj(title:putlog) \[Error\] Please check \002oper_join.tcl\002 --> \002set oj(language) \"$oj(language)\"\002"
- return
- } else {
- if {([channel get $chan ojoin-language] eq "")} {
- channel set $chan ojoin-language $oj(language)
- }
- }
- if {[info exists ${nsc}::oj(output:color)] && ([string trim $oj(output:color)] eq "")} {
- putlog "$oj(title:putlog) \[Error\] Please check \002oper_join.tcl\002 --> \002set oj(output:color) \"$oj(output:color)\"\002"
- return
- } else {
- if {([channel get $chan ojoin-output_color] eq "")} {
- channel set $chan ojoin-output_color $oj(output:color)
- }
- }
- if {[info exists ${nsc}::oj(output:length)] && ([string trim $oj(output:length)] eq "")} {
- putlog "$oj(title:putlog) \[Error\] Please check \002oper_join.tcl\002 --> \002set oj(output:length) \"$oj(output:length)\"\002"
- return
- } else {
- if {([channel get $chan ojoin-output_length] eq "")} {
- channel set $chan ojoin-output_length $oj(output:length)
- }
- }
- }
- #global botnick
- #bind pub -|- ${botnick} ${nsc}::pub:commands
- bind pub -|- $oj(command:character)$oj(command:word) ${nsc}::pub:commands
- bind join -|- * ${nsc}::add:channel:settings:on:bot:join
- bind join -|- * ${nsc}::oper:join
- bind ctcp -|- VERSION ${nsc}::version:reply
- }
- # [unbind:bindings] :
- proc unbind:bindings {args} {
- variable nsc;
- variable oj;
- #global botnick
- #unbind pub -|- ${botnick} ${nsc}::pub:commands
- unbind pub -|- $oj(command:character)$oj(command:word) ${nsc}::pub:commands
- unbind join -|- * ${nsc}::add:channel:settings:on:bot:join
- unbind join -|- * ${nsc}::oper:join
- unbind ctcp -|- VERSION ${nsc}::version:reply
- }
- # [add:channel:settings:on:bot:join] :
- proc add:channel:settings:on:bot:join {nick uhost hand chan} {
- variable oj;
- if {![isbotnick $nick]} {
- return
- } else {
- if {([channel get $chan ojoin-access] eq "")} {
- channel set $chan ojoin-access $oj(access)
- }
- if {([channel get $chan ojoin-language] eq "")} {
- channel set $chan ojoin-language $oj(language)
- }
- if {([channel get $chan ojoin-output_color] eq "")} {
- channel set $chan ojoin-output_color $oj(output:color)
- }
- if {([channel get $chan ojoin-output_length] eq "")} {
- channel set $chan ojoin-output_length $oj(output:length)
- }
- }
- }
- ##
- # Script information
- ##
- # [script:variables] :
- set oj(tcl:name) "oper_join"
- set oj(tcl:project:name) "ojoin"
- set oj(tcl:author) "X-Anonymous-Y"
- set oj(tcl:contact) "irc.kn-v2.com #Eggdrop"
- set oj(tcl:copyright) "©"
- set oj(tcl:year) "2023-2024"
- set oj(tcl:version) "29.01.2024"
- set oj(tcl:website) "https://pastebin.com/nbhTVsRb"
- ##
- # Commands
- ##
- # [pub:commands] :
- proc pub:commands {nick uhost hand chan arg} {
- variable nsc;
- variable oj;
- if {([lindex $arg 0] eq "$oj(command:word)")} {
- set arg [join [lrange [split $arg] 1 end]]
- } else {
- set arg [join [lrange [split $arg] 0 end]]
- }
- if {[${nsc}::check:access 0 $hand $chan flags 0] || [${nsc}::check:access $nick 0 $chan channel_access 0] || [matchattr $hand "+n|+n"] || [isop $nick $chan]} {
- if {[lindex $arg 0] eq "help"} {
- ${nsc}::pub:help $nick $uhost $hand $chan $arg
- return
- } elseif {[lindex $arg 0] eq "set"} {
- ${nsc}::pub:set $nick $uhost $hand $chan $arg
- return
- } elseif {[lindex $arg 0] eq "version"} {
- ${nsc}::pub:version $nick $uhost $hand $chan $arg
- return
- } elseif {[lindex $arg 0] eq "stop"} {
- ${nsc}::pub:stop:oper:join $nick $chan $arg
- return
- } else {
- ${nsc}::pub:oper:join $nick $chan $arg
- return
- }
- } else {
- return
- }
- }
- # [pub:help] :
- proc pub:help {nick uhost hand chan arg} {
- variable nsc;
- variable oj;
- set trigger $oj(command:character)$oj(command:word)
- set arg [join [lrange [split $arg] 1 end]]
- set color [channel get $chan ojoin-output_color]
- set length [channel get $chan ojoin-output_length]
- if {[${nsc}::check:access 0 $hand $chan flags 0] || [${nsc}::check:access $nick 0 $chan channel_access 0] || [matchattr $hand "+n|+n"] || [isop $nick $chan]} {
- if {[channel get $chan ojoin]} {
- if {([lindex $arg 0] eq "")} {
- ${nsc}::send:output $nick $chan notice slow help:optional $color $length none
- ${nsc}::send:output $nick $chan notice slow help:help:nickname $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:help:set $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:help:set:examples $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:help:oper:join $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:version:nickname $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help from $nick ($uhost) on $chan"
- } elseif {([lindex $arg 0] eq "set")} {
- if {([lindex $arg 1] eq "language")} {
- ${nsc}::send:output $nick $chan notice slow help:set:available:languages $color $length none
- ${nsc}::send:output $nick $chan notice slow help:set:language:en:de $color $length none
- #putlog "$oj(title:putlog) \[Info\] help set language from $nick ($uhost) on $chan"
- } else {
- ${nsc}::send:output $nick $chan notice slow help:set:required $color $length none
- ${nsc}::send:output $nick $chan notice slow help:set:off $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:set:access $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:set:language $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:set:output:color $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:set:output:length $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help set from $nick ($uhost) on $chan"
- }
- } else {
- if {[onchan [lindex $arg 0] $chan]} {
- if {[${nsc}::check:access 0 0 $chan channel_access [lindex $arg 0]]} {
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:full $color $length none
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:help:nickname $color $length $trigger
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:help:set $color $length $trigger
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:help:set:examples $color $length $trigger
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:help:oper:join $color $length $trigger
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:version:nickname $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help for VIP [lindex $arg 0] from $nick ($uhost) on $chan"
- } else {
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help $color $length none
- ${nsc}::send:output [lindex $arg 0] $chan notice slow help:version $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help for [lindex $arg 0] from $nick ($uhost) on $chan"
- }
- } else {
- ${nsc}::send:output $nick $chan notice slow error:no:nick $color $length [list [lindex $arg 0] $chan]
- }
- }
- } else {
- ${nsc}::send:output $nick $chan notice slow help:optional $color $length none
- ${nsc}::send:output $nick $chan notice slow help:set:on $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:version:nickname $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help from $nick ($uhost) on $chan"
- }
- } else {
- if {[channel get $chan ojoin]} {
- if {([lindex $arg 0] eq "")} {
- ${nsc}::send:output $nick $chan notice slow help $color $length none
- ${nsc}::send:output $nick $chan notice slow help:version $color $length $trigger
- #putlog "$oj(title:putlog) \[Info\] help from $nick ($uhost) on $chan"
- }
- }
- }
- }
- # [pub:set] :
- proc pub:set {nick uhost hand chan arg} {
- global botnick
- variable nsc;
- variable oj;
- set trigger $oj(command:character)$oj(command:word)
- set arg [join [lrange [split $arg] 1 end]]
- set color [channel get $chan ojoin-output_color]
- set length [channel get $chan ojoin-output_length]
- if {[channel get $chan ojoin]} {
- if {([lindex $arg 0] eq "off")} {
- channel set $chan -ojoin
- putquick "SAMODE $chan -Yo ${botnick} ${botnick}"
- ${nsc}::send:output $nick $chan notice slow info:is:now:arg $color $length [lindex $arg 0]
- putlog "$oj(title:putlog) \[Info\] set off from $nick ($uhost) on $chan"
- } elseif {([lindex $arg 0] eq "access")} {
- if {([lindex $arg 1] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:set:access $color $length $trigger
- } else {
- if {([lindex $arg 2] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:set:access $color $length $trigger
- } else {
- channel set $chan ojoin-access [list [lindex $arg 1] [lindex $arg 2]]
- ${nsc}::send:output $nick $chan notice slow info:set:access $color $length [list [lindex $arg 1] [lindex $arg 2]]
- putlog "$oj(title:putlog) \[Info\] set access [lindex $arg 1] [lindex $arg 2] from $nick ($uhost) on $chan"
- }
- }
- } elseif {([lindex $arg 0] eq "language")} {
- if {([lindex $arg 1] eq "en") || ([lindex $arg 1] eq "english") || ([lindex $arg 1] eq "de") || ([lindex $arg 1] eq "german")} {
- channel set $chan ojoin-language [lindex $arg 1]
- ${nsc}::send:output $nick $chan notice slow info:set:language $color $length [lindex $arg 1]
- putlog "$oj(title:putlog) \[Info\] set language [lindex $arg 1] from $nick ($uhost) on $chan"
- } elseif {([lindex $arg 1] ne "en") && ([lindex $arg 1] ne "english") && ([lindex $arg 1] ne "de") && ([lindex $arg 1] ne "german") || ([lindex $arg 1] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:set:language $color $length $trigger
- ${nsc}::send:output $nick $chan notice slow help:set:required $color $length none
- ${nsc}::send:output $nick $chan notice slow help:set:available:languages $color $length none
- ${nsc}::send:output $nick $chan notice slow help:set:language:en:de $color $length none
- #putlog "$oj(title:putlog) \[Info\] set language [lindex $arg 1 end] from $nick ($uhost) on $chan"
- }
- } elseif {([lindex $arg 0] eq "output")} {
- if {([lindex $arg 1] eq "color")} {
- if {([lindex $arg 2] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:set:output:color $color $length $trigger
- } else {
- channel set $chan ojoin-output_color [lindex $arg 2]
- ${nsc}::send:output $nick $chan notice slow info:set:output:color $color $length [lindex $arg 2]
- putlog "$oj(title:putlog) \[Info\] set output color [lindex $arg 2] from $nick ($uhost) on $chan"
- }
- } elseif {([lindex $arg 1] eq "length")} {
- if {([lindex $arg 2] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:set:output:length $color $length $trigger
- } else {
- channel set $chan ojoin-output_length [lindex $arg 2]
- ${nsc}::send:output $nick $chan notice slow info:set:output:length $color $length [lindex $arg 2]
- putlog "$oj(title:putlog) \[Info\] set output length [lindex $arg 2] from $nick ($uhost) on $chan"
- }
- }
- } elseif {([lindex $arg 0] eq "")} {
- ${nsc}::send:output $nick $chan notice slow error:help:set $color $length $trigger
- }
- } else {
- if {([lindex $arg 0] eq "on")} {
- channel set $chan +ojoin
- putquick "OJOIN $chan"
- ${nsc}::send:output $nick $chan notice slow info:is:now:arg $color $length [lindex $arg 0]
- putlog "$oj(title:putlog) \[Info\] set on from $nick ($uhost) on $chan"
- } else {
- ${nsc}::send:output $nick $chan notice slow error:is:off $color $length $trigger
- }
- }
- }
- # [pub:version] :
- proc pub:version {nick uhost hand chan arg} {
- variable nsc;
- variable oj;
- set arg [join [lrange [split $arg] 1 end]]
- set color [channel get $chan ojoin-output_color]
- set length [channel get $chan ojoin-output_length]
- if {[${nsc}::check:access 0 $hand $chan flags 0] || [${nsc}::check:access $nick 0 $chan channel_access 0] || [matchattr $hand "+n|+n"] || [isop $nick $chan]} {
- if {[channel get $chan ojoin]} {
- if {([lindex $arg 0] eq "")} {
- ${nsc}::send:output $nick $chan notice slow info:version:arg $color $length [list $oj(tcl:name) $oj(tcl:project:name) $oj(tcl:version) $oj(tcl:copyright) $oj(tcl:year) $oj(tcl:author) $oj(tcl:contact) $oj(tcl:website) on]
- #putlog "$oj(title:putlog) \[Info\] version from $nick ($uhost) on $chan"
- } else {
- if {[onchan [lindex $arg 0] $chan]} {
- ${nsc}::send:output [lindex $arg 0] $chan notice slow info:version:arg $color $length [list $oj(tcl:name) $oj(tcl:project:name) $oj(tcl:version) $oj(tcl:copyright) $oj(tcl:year) $oj(tcl:author) $oj(tcl:contact) $oj(tcl:website) on]
- #putlog "$oj(title:putlog) \[Info\] version [lindex $arg 0] from $nick ($uhost) on $chan"
- } else {
- ${nsc}::send:output $nick $chan notice slow error:no:nick $color $length [list [lindex $arg 0] $chan]
- }
- }
- } else {
- if {([lindex $arg 0] eq "")} {
- ${nsc}::send:output $nick $chan notice slow info:version:arg $color $length [list $oj(tcl:name) $oj(tcl:project:name) $oj(tcl:version) $oj(tcl:copyright) $oj(tcl:year) $oj(tcl:author) $oj(tcl:contact) $oj(tcl:website) off]
- #putlog "$oj(title:putlog) \[Info\] version from $nick ($uhost) on $chan"
- } else {
- if {[onchan [lindex $arg 0] $chan]} {
- ${nsc}::send:output [lindex $arg 0] $chan notice slow info:version:arg $color $length [list $oj(tcl:name) $oj(tcl:project:name) $oj(tcl:version) $oj(tcl:copyright) $oj(tcl:year) $oj(tcl:author) $oj(tcl:contact) $oj(tcl:website) off]
- #putlog "$oj(title:putlog) \[Info\] version [lindex $arg 0] from $nick ($uhost) on $chan"
- } else {
- ${nsc}::send:output $nick $chan notice slow error:no:nick $color $length [list [lindex $arg 0] $chan]
- }
- }
- }
- } else {
- if {[channel get $chan ojoin]} {
- ${nsc}::send:output $nick $chan notice slow info:version:arg $color $length [list $oj(tcl:name) $oj(tcl:project:name) $oj(tcl:version) $oj(tcl:copyright) $oj(tcl:year) $oj(tcl:author) $oj(tcl:contact) $oj(tcl:website) off]
- #putlog "$oj(title:putlog) \[Info\] version from $nick ($uhost) on $chan"
- }
- }
- }
- # [pub:oper:join] :
- proc pub:oper:join {nick chan arg} {
- variable nsc;
- set color [channel get $chan ojoin-output_color]
- set length [channel get $chan ojoin-output_length]
- if {($arg eq "")} {
- set chan $chan
- } else {
- set chan $arg
- }
- if {[validchan $chan]} {
- if {[botonchan $chan]} {
- putquick "OJOIN $chan"
- } else {
- ${nsc}::send:output $nick $chan notice slow error:not:on:chan $color $length $chan
- }
- } else {
- ${nsc}::send:output $nick $chan notice slow error:chan:not:valid $color $length $chan
- }
- }
- # [pub:stop:oper:join] :
- proc pub:stop:oper:join {nick chan arg} {
- global botnick
- variable nsc;
- set arg [join [lrange [split $arg] 1 end]]
- set color [channel get $chan ojoin-output_color]
- set length [channel get $chan ojoin-output_length]
- if {($arg eq "")} {
- set chan $chan
- } else {
- set chan $arg
- }
- if {[validchan $chan]} {
- if {[botonchan $chan]} {
- putquick "SAMODE $chan -Y ${botnick}"
- } else {
- ${nsc}::send:output $nick $chan notice slow error:not:on:chan $color $length $chan
- }
- } else {
- ${nsc}::send:output $nick $chan notice slow error:chan:not:valid $color $length $chan
- }
- }
- ##
- # Actions
- ##
- # [oper:join] :
- proc oper:join {nick uhost hand chan} {
- if {[isbotnick $nick]} {
- if {[channel get $chan ojoin]} {
- putquick "ojoin $chan"
- putlog "$oj(title:putlog) \[Info\] Using oper join on $chan"
- }
- }
- }
- ##
- # Access
- ##
- # [check:access] : for nick or arg
- proc check:access {nick hand chan type arg} {
- if {([channel get $chan ojoin-access] eq "0 0")} {
- return 1
- }
- set get_channel_access [lindex [channel get $chan ojoin-access] 0]
- set get_user_flags [lindex [channel get $chan ojoin-access] 1 end]
- if {($type eq "flags")} {
- if {($get_user_flags ne "0")} {
- if {($hand eq "0")} {
- return 0
- } elseif {($hand eq "\*")} {
- return 0
- } else {
- set hand $hand
- }
- if {[matchattr $hand $get_user_flags]} {
- return 1
- } else {
- return 0
- }
- } else {
- return 0
- }
- } elseif {($type eq "channel_access")} {
- if {($get_channel_access ne "0")} {
- if {($nick ne "0")} {
- set user $nick
- }
- if {($arg ne "0")} {
- set user $arg
- }
- if {($chan ne "0")} {
- set chan $chan
- }
- if {($get_channel_access eq "op") || ($get_channel_access eq "halfop") || ($get_channel_access eq "voice")} {
- if {[is$get_channel_access $user $chan]} {
- return 1
- } else {
- return 0
- }
- }
- } else {
- return 0
- }
- }
- }
- ##
- # Output
- ##
- # [send:output] : notice nick | message chan
- proc send:output {nick chan type speed line color length args} {
- variable nsc;
- variable oj;
- set inc 0
- foreach s [join $args] {
- set inc [expr $inc + 1]
- set replace(%msg.$inc%) $s
- }
- set get_language [${nsc}::get:language $chan $line]
- if {($type eq "notice")} {
- if {($color eq "on")} {
- if {$length eq "long"} {
- set extended_line "$line:color:long"
- } elseif {($length eq "short")} {
- set extended_line "$line:color:short"
- } else {
- set extended_line "$line:color"
- }
- } elseif {($color eq "off")} {
- if {$length eq "long"} {
- set extended_line "$line:long"
- } elseif {($length eq "short")} {
- set extended_line "$line:short"
- } else {
- set extended_line "$line"
- }
- }
- if {[info exists ${nsc}::oj($get_language:${extended_line})]} {
- set reply [string map [array get replace] $oj($get_language:${extended_line})]
- } else {
- #putlog "$oj(title:putlog) \[Error\] oj($get_language:${extended_line}) does not exist! using oj($get_language:$line) insted"
- set reply [string map [array get replace] $oj($get_language:$line)]
- }
- if {($speed eq "fast")} {
- putquick "NOTICE $nick :$reply"
- } elseif {($speed eq "normal")} {
- putserv "NOTICE $nick :$reply"
- } else {
- puthelp "NOTICE $nick :$reply"
- }
- } elseif {($type eq "message")} {
- if {($color eq "on")} {
- if {$length eq "long"} {
- set extended_line "$line:color:long"
- } elseif {($length eq "short")} {
- set extended_line "$line:color:short"
- } else {
- set extended_line "$line:color"
- }
- } elseif {($color eq "off")} {
- if {$length eq "long"} {
- set extended_line "$line:long"
- } elseif {($length eq "short")} {
- set extended_line "$line:short"
- } else {
- set extended_line "$line"
- }
- }
- if {[info exists ${nsc}::oj($get_language:${extended_line})]} {
- set reply [string map [array get replace] $oj($get_language:${extended_line})]
- } else {
- #putlog "$oj(title:putlog) \[Error\] $oj($get_language:${extended_line}) does not exist! using $oj($get_language:$line) insted"
- set reply [string map [array get replace] $oj($get_language:$line)]
- }
- if {($speed eq "fast")} {
- if {($nick == 0)} {
- putquick "PRIVMSG $chan :$reply"
- } else {
- putquick "PRIVMSG $nick :$reply"
- }
- } elseif {($speed eq "normal")} {
- if {($nick == 0)} {
- putserv "PRIVMSG $chan :$reply"
- } else {
- putserv "PRIVMSG $nick :$reply"
- }
- } else {
- if {($nick == 0)} {
- puthelp "PRIVMSG $chan :$reply"
- } else {
- puthelp "PRIVMSG $nick :$reply"
- }
- }
- }
- }
- ##
- # Languages
- ##
- # [get:language] :
- proc get:language {chan line} {
- variable nsc;
- set get_language [string tolower [channel get $chan ojoin-language]]
- if {($get_language eq "")} {
- set language en
- } else {
- if {($get_language eq "en") || ($get_language eq "english")} {
- set get_language "en"
- } elseif {($get_language eq"de") || ($get_language eq "german")} {
- set get_language "de"
- } else {
- set get_language "en"
- }
- if {[info exists ${nsc}::oj($get_language:$line)]} {
- set language $get_language
- } else {
- set language en
- }
- }
- return [string tolower $language]
- }
- ##
- # English
- ##
- # [error:lines] :
- set oj(en:error:is:off) "$oj(title:default) is \002Off\002! Please use \002%msg.1% set on\002"
- set oj(en:error:no:nick) "$oj(title:default) \[Error\] \002%msg.1%\002 is not on \002%msg.2%\002"
- set oj(en:error:chan:not:valid) "$oj(title:default) \[Error\] \002%msg.1%\002 is not a valid channel"
- set oj(en:error:not:on:chan) "$oj(title:default) \[Error\] Im not on \002%msg.1%\002"
- set oj(en:error:help) "$oj(title:default) \[Error\] Please use %msg.1% \002help\002"
- set oj(en:error:set:access) "$oj(title:default) \[Error\] Please use %msg.1% set access <\002channel_access\002> <\002flags\002>"
- set oj(en:error:set:language) "$oj(title:default) \[Error\] Please use %msg.1% set language <\002language\002>"
- set oj(en:error:set:output:color) "$oj(title:default) \[Error\] Please use %msg.1% set output color <\002on/off\002>"
- set oj(en:error:set:output:length) "$oj(title:default) \[Error\] Please use %msg.1% set output length <\002default/long/short\002>"
- # [info:lines] :
- set oj(en:info:coming:soon) "$oj(title:default) \[Info\] \002Coming soon.\002"
- set oj(en:info:already:off) "$oj(title:default) Is already \002off\002."
- set oj(en:info:already:on) "$oj(title:default) Is already \002on\002."
- set oj(en:info:no:permission:command) "$oj(title:default) \[No Permission\] \002%msg.1%\002: you can not use this command!"
- set oj(en:info:is:now:arg) "$oj(title:default) Is now \002%msg.1%\002."
- set oj(en:info:set:access) "$oj(title:default) Access has been changed to \002%msg.1%\002 \002%msg.2%\002."
- set oj(en:info:set:language) "$oj(title:default) Language has been changed to \002%msg.1%\002."
- set oj(en:info:set:output:color) "$oj(title:default) Output color has been changed to \002%msg.1%\002."
- set oj(en:info:set:output:length) "$oj(title:default) Output length has been changed to \002%msg.1%\002."
- set oj(en:info:version:arg) "$oj(title:default) Name: \002%msg.1%\002 \| Projectname: \002%msg.2%\002 \| Version: \002%msg.3%\002 \| Copyright: \002%msg.4%\002 - \002%msg.5%\002 by \002%msg.6%\002 \| Contact: \002%msg.7%\002 \| Homepage: \037\002%msg.8%\002\037 (Status: \002%msg.9%\002)"
- # [help:lines] :
- set oj(en:help) "$oj(title:default) Help:"
- set oj(en:help:optional) "$oj(title:default) Help: The entrie in the (\002placeholder\002) brackets is optional"
- set oj(en:help:required) "$oj(title:default) Help: The entrie in the <\002placeholder\002> brackets is required."
- set oj(en:help:full) "$oj(title:default) Help: The entrie in the (\002placeholder\002) brackets is optional, and the entrie in the <\002placeholder\002> brackets is required."
- set oj(en:help:help:nickname) "%msg.1% help (nickname)"
- set oj(en:help:help:set) "%msg.1% help set"
- set oj(en:help:help:set:examples) "%msg.1% help set examples"
- set oj(en:help:help:oper:join) "%msg.1% (#channel)"
- set oj(en:help:version) "%msg.1% version"
- set oj(en:help:version:nickname) "%msg.1% version (nickname)"
- # [help:set:lines] :
- set oj(en:help:set) "$oj(title:default) Help set:"
- set oj(en:help:set:optional) "$oj(title:default) Help set: The entrie in the (\002placeholder\002) brackets is optional"
- set oj(en:help:set:required) "$oj(title:default) Help set: The entrie in the <\002placeholder\002> brackets is required."
- set oj(en:help:set:full) "$oj(title:default) Help set: The entrie in the (\002placeholder\002) brackets is optional, and the entrie in the <\002placeholder\002> brackets is required."
- set oj(en:help:set:available:languages) "$oj(title:default) Available languages:"
- set oj(en:help:set:language:en:de) "\002en\002, \002de\002"
- set oj(en:help:set:on) "%msg.1% set <on>"
- set oj(en:help:set:off) "%msg.1% set <off>"
- set oj(en:help:set:on:off) "%msg.1% set <on/off>"
- set oj(en:help:set:access) "%msg.1% set access <access_name> <flags>"
- set oj(en:help:set:language) "%msg.1% set language <language>"
- set oj(en:help:set:output:color) "%msg.1% set output color <on/off>"
- set oj(en:help:set:output:length) "%msg.1% set output length <default/long/short>"
- # [various:lines] :
- ##
- # Deutsch
- ##
- # [error:lines] :
- # [info:lines] :
- # [help:lines] :
- # [help:set:lines] :
- # [various:lines] :
- ##
- # CTCP
- ##
- # [version:reply] :
- proc version:reply {nick uhost hand dest key arg} {
- variable oj;
- puthelp "NOTICE $nick :VERSION $oj(logo:default) Name: \002$oj(tcl:name)\002 \| Projectname: \002$oj(tcl:project:name)\002 \| Version: \002$oj(tcl:version)\002 \| \002$oj(tcl:copyright)\002 \002$oj(tcl:year)\002 by \002$oj(tcl:author)\002 \| Contact: \002$oj(tcl:contact)\002 \| Website: \037\002$oj(tcl:website)\002\037"
- #putlog "$oj(title:putlog) \[Info\] CTCP version from $nick ($uhost)"
- return
- }
- }
- putlog "$oper::join::oj(title:putlog) Name: \002$oper::join::oj(tcl:name)\002 \| Projectname: \002$oper::join::oj(tcl:project:name)\002 \| Version: \002$oper::join::oj(tcl:version)\002 \| \002Loaded\002."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement