Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is the voting module duplicated from Impious
- #
- ## basic Configuration
- # Command prefixes
- set vote_config(cmd_prefix) "@"
- # Which channel should this run in
- set vote_config(channel) "#subreddit"
- # Who should this bot send votes to?
- # Separate nicks with a , no spaces
- set vote_config(notify) "poutine"
- # Path to the citizens file
- set vote_config(citizens_file) "text/freecitizens.txt"
- # Path to log file
- set vote_config(log_file) "text/vote-log.txt"
- # Integrate trivia ?
- set vote_config(regulate_trivia) 0
- ## vote throttling
- # Throttling mode 0 = off, 1 = user, 2 = channel
- set vote_config(throttle_mode) 2
- # How long in seconds to wait until a user/channel can call for
- # another kick vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_kick) 0
- # How long in seconds to wait until a user/channel can call for
- # another ban vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_ban) 0
- # How long in seconds to wait until a user/channel can call for
- # another elect vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_elect) 600
- # How long in seconds to wait until a user/channel can call for
- # another impeach vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_impeach) 600
- # How long in seconds to wait until a user/channel can call for
- # another topic vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_topic) 100
- # How long in seconds to wait until a user/channel can call for
- # another ban vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_ban) 600
- # How long in seconds to wait until a user/channel can call for
- # another kick vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_kick) 600
- # How long in seconds to wait until a user/channel can call for
- # another invite vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_invite) 600
- # How long in seconds to wait until a user/channel can call for
- # another censure vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_censure) 600
- # How long in seconds to wait until a user/channel can call for
- # another trivia on/off vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_trivia) 600
- # How long in seconds to wait until a user/channel can call for
- # another frenzy on/off vote
- # 10 minutes = 600 seconds
- set vote_config(throttle_frenzy) 600
- ## Crap settings
- # Allow invalid targets to be elected?
- set vote_config(allow_absent_election) 1
- ## Advanced Bans
- # Advanced bans
- # NON-FUNCTIONAL
- # Advanced bans are bans for a specified amount of time
- # its inclusion in the !ban trigger is optional
- # You need to setup times for bans, and a default ban time
- # You can ignore this if disabled. set this to 0 to disable.
- set vote_config(advanced_bans) 0
- # Time limits in seconds for bans
- # 10 minutes, 30 minutes, 1 hour, 6 hours, 1 day
- set vote_config(advanced_ban_times) "600 1800 3600 21600 86400"
- set vote_config(advanced_ban_vote_start) 3
- set vote_config(advanced_ban_vote_increment) 1
- set vote_config(advanced_ban_default_time) "600"
- ## Basic Vote Counts
- # Each setting is self explanatory, vote counts for each punishment
- set vote_config(count_impeach) 6
- set vote_config(count_elect) 3
- set vote_config(cit_count_ban) 4
- set vote_config(count_ban) 3
- set vote_config(count_topic) 2
- set vote_config(count_trivia) 3
- set vote_config(cit_count_kick) 3
- set vote_config(count_kick) 2
- set vote_config(count_invite) 3
- set vote_config(cit_count_invite) 3
- set vote_config(cit_count_topic) 3
- set vote_config(cit_count_censure) 3
- set vote_config(cit_count_trivia) 3
- set vote_config(cit_count_frenzy) 3
- set vote_config(cit_count_trivia) 3
- set vote_config(topic_vote_time) 60
- set vote_config(invite_vote_time) 60
- set vote_config(elect_vote_time) 60
- set vote_config(ban_vote_time) 60
- set vote_config(kick_vote_time) 60
- set vote_config(impeach_vote_time) 60
- set vote_config(trivia_vote_time) 60
- ## COLOR/CONTROL CODES
- set vote_config(code1) "\0035"
- set vote_config(code2) "\00314"
- #### INITIALIZATION ####
- # This shouldn't be messed with
- set vote_config(impeach_last_time) 0
- set vote_config(ban_last_time) 0
- set vote_config(elect_last_time) 0
- set vote_config(kick_last_time) 0
- set vote_config(topic_last_time) 0
- set vote_config(trivia_last_time) 0
- set vote_config(invite_last_time) 0
- set vote_config(voteyescount) 0
- set vote_config(votenocount) 0
- # pending votes
- set vote_config(pvoteyescount) 0
- set vote_config(pvotenocount) 0
- # pending votes waiting for results
- set vote_config(pvotewait) 0
- set vote_config(invote) 0
- set vote_config(vote_type) "ban"
- set vote_config(vote_victim) "poutine"
- set vote_config(vote_victim_mask) ""
- set vote_config(vote_text) ""
- set vote_config(vote_timer) 0
- set vote_config(votes) ""
- bind pub - "$vote_config(cmd_prefix)confirm" impious:confirm
- bind pub - "$vote_config(cmd_prefix)ban" impious:vote_ban
- bind pub - "$vote_config(cmd_prefix)invite" impious:vote_invite
- bind pub - "$vote_config(cmd_prefix)crucify" impious:vote_ban
- bind pub - "$vote_config(cmd_prefix)elect" impious:vote_elect
- bind pub - "$vote_config(cmd_prefix)impeach" impious:vote_impeach
- bind pub - "$vote_config(cmd_prefix)kick" impious:vote_kick
- #bind pub - "$vote_config(cmd_prefix)voice" impious:vote_voice
- #bind pub - "$vote_config(cmd_prefix)devoice" impious:vote_devoice
- #bind pub - "$vote_config(cmd_prefix)censure" impious:vote_devoice
- bind pub - "$vote_config(cmd_prefix)citizens" impious:citizens
- bind pub I "$vote_config(cmd_prefix)addcit" impious:addcit
- bind pub - "$vote_config(cmd_prefix)topic" impious:vote_topic
- bind pub - "$vote_config(cmd_prefix)trivia" impious:vote_trivia
- bind join - "$vote_config(channel) *" impious:deauth_join
- bind nick - "$vote_config(channel) *" impious:deauth_nick
- #bind mode - "-v" impious:no_bitch
- #bind mode - "+v" impious:no_bitch
- # >> :calvino.freenode.net 330 poutine tswift tswift :is logged in as */
- bind raw - "311" impious:start_whois
- #bind raw - "307" impious:verify_cit
- bind raw - "318" impious:not_identified
- bind raw - "330" impious:freenode_identified_alias
- proc impious:vote_invite { nick uhost hand channel arg } {
- impious:start_vote "invite" $nick [lindex $arg 0] [lrange $arg 1 end]
- }
- proc impious:vote_impeach { nick uhost hand channel arg } {
- impious:start_vote "impeach" $nick [lindex $arg 0] [lrange $arg 1 end]
- }
- proc impious:vote_elect { nick uhost hand channel arg } {
- impious:start_vote "elect" $nick [lindex $arg 0] [lrange $arg 1 end]
- }
- proc impious:vote_trivia { nick uhost hand channel arg } {
- impious:start_vote "trivia" $nick "null" $arg
- }
- proc impious:vote_topic { nick uhost hand channel arg } {
- impious:start_vote "topic" $nick "null" $arg
- }
- proc impious:vote_kick { nick uhost hand channel arg } {
- global botnick
- if {[lindex $arg 0] == $botnick} {
- puthelp "PRIVMSG $channel :Homey don't play that"
- return
- }
- impious:start_vote "kick" $nick [lindex $arg 0] [lrange $arg 1 end]
- }
- proc impious:vote_ban { nick uhost hand channel arg } {
- impious:start_vote "ban" $nick [lindex $arg 0] [lrange $arg 1 end]
- }
- proc impious:no_bitch { nick uhost hand channel change target } {
- global vote_config botnick
- if {$nick == $botnick} {
- return
- }
- check_cit [string tolower $target]
- }
- proc impious:quickaddcit { victim } {
- global vote_config
- set victim [string tolower [lindex $victim 0]]
- lappend vote_config(citizens) $victim
- save_citizens
- }
- proc impious:addcit { nick uhost hand channel arg } {
- global vote_config
- set victim [string tolower [lindex $arg 0]]
- if {$vote_config(allow_absent_election) != 1} {
- if {![onchan $victim $channel]} {
- puthelp "PRIVMSG $channel :$vote_config(code2)${victim} $vote_config(code1)is not on this channel."
- return
- }
- }
- lappend vote_config(citizens) $victim
- save_citizens
- puthelp "PRIVMSG $channel :$vote_config(code2)${victim} $vote_config(code1)has been added to the citizens list."
- }
- proc impious:citizens { nick uhost hand channel arg } {
- global vote_config outlist
- set outlist ""
- foreach {citizen} $vote_config(citizens) {
- if {[onchan $citizen $channel]} {
- lappend outlist $citizen
- }
- }
- set noncit ""
- foreach {person} [chanlist $channel] {
- if {[lsearch $vote_config(citizens) [string tolower $person]] == -1} {
- lappend noncit $person
- }
- }
- set citizen_count [llength $outlist]
- set noncitizen_count [llength $noncit]
- puthelp "PRIVMSG $channel :$vote_config(code1) Citizens $vote_config(code2) $citizen_count $vote_config(code1) Noncitizens $vote_config(code2) $noncitizen_count $vote_config(code1) ( $noncit )"
- }
- proc impious:deauth_join { nick uhost hand channel } {
- global vote_config
- set vote_config(${nick}_auth) 0
- putserv "whois $nick"
- }
- proc impious:deauth_nick { nick uhost hand channel newnick } {
- global vote_config
- set vote_config(${newnick}_auth) 0
- putserv "whois $nick"
- }
- proc vote:pubyes { nick uhost hand channel arg } {
- global vote_config
- set cit [check_cit $nick]
- if {$cit == -1} {
- puthelp "PRIVMSG $nick :You're not a citizen. If you believe this to be an error, make sure you're identified to your nickname."
- return
- } elseif {$cit == 0} {
- # Citizen is pending, set what it should do when decided
- set vote_config(${nick}_onverify) "vote:pubyes \{$nick\} \{\} \{\} \{$vote_config(channel)\} \{\}"
- return
- }
- if {[lsearch $vote_config(votes) "$nick*"] == -1} {
- lappend vote_config(votes) "$nick 1"
- incr vote_config(voteyescount)
- puthelp "PRIVMSG $channel :$nick, You have successfully voted YES."
- # puthelp "PRIVMSG $channel :$nick, Your voting eligibility has been confirmed as $nick addr: [getchanhost $nick] ip: 00.00.00.00 Votes: 1. Your vote has been recorded as YES."
- }
- }
- proc vote:pubno { nick uhost hand channel arg } {
- global vote_config
- set cit [check_cit $nick]
- if {$cit == -1} {
- puthelp "PRIVMSG $nick :You're not a citizen. If you believe this to be an error, make sure you're identified to your nickname."
- return
- } elseif {$cit == 0} {
- # Citizen is pending, set what it should do when decided
- set vote_config(${nick}_onverify) "vote:pubno \{$nick\} \{\} \{\} \{$channel\} \{\}"
- return
- }
- if {[lsearch $vote_config(votes) "$nick*"] == -1} {
- lappend vote_config(votes) "$nick 0"
- incr vote_config(votenocount)
- puthelp "PRIVMSG $channel :$nick, You have successfully voted NO."
- }
- }
- proc vote:yes { nick uhost hand arg } {
- global vote_config
- if {![onchan $nick $vote_config(channel)]} {
- puthelp "PRIVMSG $nick :Fixed this bug, nice try though"
- return
- }
- set cit [check_cit $nick]
- if {$cit == -1} {
- puthelp "PRIVMSG $nick :You're not a citizen. If you believe this to be an error, make sure you're identified to your nickname."
- return
- } elseif {$cit == 0} {
- # Citizen is pending, set what it should do when decided
- set vote_config(${nick}_onverify) "vote:yes \{$nick\} \{\} \{\} \{$vote_config(channel)\} \{\}"
- return
- }
- if {[lsearch $vote_config(votes) "$nick*"] == -1} {
- lappend vote_config(votes) "$nick 1"
- incr vote_config(voteyescount)
- puthelp "PRIVMSG $nick :You have successfully voted YES."
- }
- }
- proc vote:no { nick uhost hand arg } {
- global vote_config
- if {![onchan $nick $vote_config(channel)]} {
- puthelp "PRIVMSG $nick :Fixed this bug, nice try though"
- return
- }
- set cit [check_cit $nick]
- if {$cit == -1} {
- puthelp "PRIVMSG $nick :You're not a citizen. If you believe this to be an error, make sure you're identified to your nickname."
- return
- } elseif {$cit == 0} {
- # Citizen is pending, set what it should do when decided
- set vote_config(${nick}_onverify) "vote:no \{$nick\} \{\} \{\} \{$channel\} \{\}"
- return
- }
- if {[lsearch $vote_config(votes) "$nick*"] == -1} {
- lappend vote_config(votes) "$nick 0"
- incr vote_config(votenocount)
- puthelp "PRIVMSG $nick :You have successfully voted NO."
- }
- }
- # Boilerplate shit
- #
- proc impious:gen_std_fail_notify_msg { initiator type target passed vote_req } {
- global vote_config botnick
- set notifymsg "$vote_config(code1)The vote to $type $vote_config(code2)$target $vote_config(code1) has FAILED. ($vote_config(voteyescount) Yes votes, $vote_config(votenocount) No votes. $vote_req Yes votes required)."
- return $notifymsg
- }
- proc impious:gen_std_success_notify_msg { initiator type target passed vote_req } {
- global vote_config botnick
- set notifymsg "$vote_config(code1)The vote to $type $vote_config(code2)$target $vote_config(code1) has PASSED. ($vote_config(voteyescount) Yes votes, $vote_config(votenocount) No votes. $vote_req Yes votes required)."
- return $notifymsg
- }
- proc impious:gen_std_notify_msg { type initiator target arg } {
- global vote_config botnick
- if {[string length $target] == 0} {
- set notifymsg "$vote_config(code1)$initiator has called for a vote to turn on $type. You have one minute to vote by messaging $botnick with a $vote_config(code2)YES or NO."
- } elseif {[llength $target] > 0 && [string length $target] > 0} {
- set notifymsg "$vote_config(code1)$initiator has called for a vote to $type $target. Stated reason: $vote_config(code2)$arg . $vote_config(code1)You have one minute to vote by messaging $botnick with a $vote_config(code2)YES or NO."
- }
- return $notifymsg
- }
- # This function determines whether a target is a person, hostmask, or nick
- proc impious:determine_target_host { target } {
- global vote_config botnick
- if {[onchan $target $vote_config(channel)]} {
- return [maskhost [getchanhost $target $vote_config(channel)]]
- } elseif {[string first "@" $target] == -1} {
- return "$target!*@*"
- } else {
- return $target
- }
- }
- proc impious:end_vote { initiator type target targethost arg } {
- global vote_config botnick
- unbind pub - "yes" vote:pubyes
- unbind pub - "no" vote:pubno
- unbind msg - "yes" vote:yes
- unbind msg - "no" vote:no
- set vote_config(invote) 0
- # Check vote count
- set vote_req $vote_config(count_${type})
- set passed "no"
- # Check vote is above count
- if {$vote_config(voteyescount) >= $vote_req} {
- # Check yes > no
- if {$vote_config(votenocount) < $vote_config(voteyescount)} {
- set passed "yes"
- }
- }
- # Announce Message
- if {$passed == "no"} {
- switch $type {
- "ban" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "unban" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "invite" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "elect" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "impeach" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "trivia" {
- set notifymsg [impious:gen_std_fail_feature_msg $initiator $type $target $passed $vote_req]
- }
- "kick" {
- set notifymsg [impious:gen_std_fail_notify_msg $initiator $type $target $passed $vote_req]
- }
- "topic" {
- set notifymsg "Yo this shitbrain $initiator called for a vote to set the topic to ($arg). And that shit done failed, required $vote_req and done got $vote_config(voteyescount) Yes votes, $vote_config(votenocount) No votes). Fuck y'all."
- }
- }
- puthelp "PRIVMSG $vote_config(channel) :$notifymsg"
- return;
- }
- # Perform action
- if {$passed == "yes"} {
- switch $type {
- "ban" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- # newchanban $vote_config(channel) $targethost $botnick $arg 3600
- puthelp "mode $vote_config(channel) +b $targethost";
- timer 3600 "puthelp \"MODE $vote_config(channel) -b $targethost\""
- }
- "unban" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- puthelp "mode $vote_config(channel) -b $targethost";
- #killchanban $vote_config(channel) $targethost
- }
- "invite" {
- newchaninvite $vote_config(channel) $target $botnick "$initiator"
- }
- "elect" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- impious:quickaddcit $target
- }
- "impeach" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- }
- "trivia" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- }
- "kick" {
- set notifymsg [impious:gen_std_success_notify_msg $initiator $type $target $passed $vote_req]
- puthelp "mode $vote_config(channel) +b $targethost";
- utimer 1 "puthelp \"MODE $vote_config(channel) -b $targethost\""
- #newchanban $vote_config(channel) $targethost $botnick $arg 1
- #utimer 3 "killchanban $vote_config(channel) $targethost"
- }
- "topic" {
- set notifymsg "that shit done passed"
- puthelp "TOPIC $vote_config(channel) :$arg \[$initiator\]"
- }
- }
- puthelp "PRIVMSG $vote_config(channel) :$notifymsg"
- return;
- }
- }
- proc impious:start_vote { type initiator target arg } {
- global vote_config botnick
- if {$vote_config(invote) == 1} {
- puthelp "PRIVMSG $vote_config(channel) :we're already in a vote dumbass"
- return
- }
- set vote_config(invote) 1
- set initiator [string tolower $initiator]
- # Check if this person is a citizen, may need to defer call until later
- set cit [check_cit $initiator]
- # -1 == Definitely not a citizen
- if {$cit == -1} {
- return
- } elseif {$cit == 0} {
- # Citizen check is pending, set what it should do when decided
- set vote_config(${initiator}_onverify) "impious:start_vote \{$type\} \{$initiator\} \{$target\} \{$arg\}"
- return
- }
- # If we're at this point, they're definitely a citizen, check secondary requirements
- # Building of notification message
- set notifymsg ""
- set targethost ""
- switch $type {
- "ban" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- set targethost [impious:determine_target_host $target]
- }
- "invite" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- }
- "unban" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- set targethost [impious:determine_target_host $target]
- }
- "elect" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- }
- "impeach" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- }
- "trivia" {
- set notifymsg [impious:gen_std_feature_msg $type $initiator $target $arg]
- }
- "kick" {
- set notifymsg [impious:gen_std_notify_msg $type $initiator $target $arg]
- set targethost [impious:determine_target_host $target]
- }
- "topic" {
- set notifymsg "Yo this shitbrain $initiator called for a vote to set the topic to ($arg) message me YES or NO to agree or disagree with that shit respectively, yo."
- }
- }
- # Throttling
- # If throttling is turned on
- if {$vote_config(throttle_mode) > 0} {
- # If the channel has a throttle time defined
- if {[info exists vote_config(throttle_${type})]} {
- if {![info exists vote_config(${type}_last_time)]} { set vote_config(${type}_last_time) 0 }
- if {[expr [unixtime] - $vote_config(${type}_last_time)] < $vote_config(throttle_${type})} {
- set secs [expr $vote_config(throttle_${type}) - ([unixtime] - $vote_config(${type}_last_time))]
- puthelp "PRIVMSG $vote_config(channel) :$vote_config(code1)Sorry... another $type vote will not be allowed for another $secs seconds"
- return;
- }
- }
- # Set the last time so we know when to base next throttling check from
- set vote_config(${type}_last_time) [expr [unixtime] + $vote_config(${type}_vote_time)]
- }
- # Notify the channel
- puthelp "PRIVMSG $vote_config(channel) :$notifymsg"
- # Admin Notification
- foreach admin [split $vote_config(notify) ","] {
- puthelp "PRIVMSG $admin :VOTE CALLED - Initiator: $initiator Type: $type Target: $target Args: $arg"
- }
- # Logging
- set fp [open "text/votelog.txt" "a+"]
- puts $fp "VOTE CALLED - Initiator: $initiator Type: $type Target: $target Args: $arg"
- close $fp
- # Bind yes/no for voting, also reset all vote counts
- bind msg - "yes" vote:yes
- bind msg - "no" vote:no
- bind pub - "yes" vote:pubyes
- bind pub - "no" vote:pubno
- set vote_config(voteyescount) 0
- set vote_config(votenocount) 0
- set vote_config(votes) ""
- # Setting of end timer
- utimer $vote_config(${type}_vote_time) "impious:end_vote \{$initiator\} \{$type\} \{$target\} \{$targethost\} \{$arg\}"
- }
- proc impious:confirm { nick uhost hand channel arg } {
- global vote_config
- if {$vote_config(channel) != $channel} {
- return
- }
- if {[llength $arg] > 0} {
- set victim [string tolower [lindex $arg 0]]
- } else {
- set victim [string tolower $nick]
- }
- set cit [check_cit $victim]
- if {$cit == -1} {
- puthelp "PRIVMSG $channel :$vote_config(code1)$victim is not a registered citizen of this channel."
- return
- } elseif {$cit == 0} {
- set vote_config(${victim}_onverify) "impious:confirm \{$victim\} \{\} \{\} \{$channel\} \{\}"
- return
- } else {
- set vhost [lindex [split [getchanhost $victim $channel] "@"] 1]
- puthelp "PRIVMSG $channel :$vote_config(code1)$victim $channel citizenship = $vote_config(code2)$victim addr: $vhost Votes: 1"
- }
- }
- proc impious:start_whois { from keyword text } {
- global vote_config
- set nick [string tolower [lindex $text 1]]
- set vote_config(${nick}_whois_auth) 0
- }
- proc impious:not_identified { from keyword text } {
- global vote_config
- set nick [string tolower [lindex $text 1]]
- # Check to see if they had a successful ident previously
- if {[info exists vote_config(${nick}_whois_auth)]} {
- if {$vote_config(${nick}_whois_auth) == 1} {
- return
- }
- }
- set key $nick
- append key "_auth"
- set vote_config($key) -1
- if {[info exists vote_config(${nick}_onverify)]} {
- eval "$vote_config(${nick}_onverify)"
- unset vote_config(${nick}_onverify)
- }
- }
- # >> :calvino.freenode.net 330 poutine tswift tswift :is logged in as */
- proc impious:freenode_identified_alias { from keyword text } {
- global vote_config
- set nick [string tolower [lindex $text 1]]
- set altnick [string tolower [lindex $text 2]]
- putlog "altnick is $altnick"
- # Check citizens list
- if {[lsearch $vote_config(citizens) $altnick] != -1 || [lsearch $vote_config(citizens) $nick] != -1} {
- set vote_config(${nick}_auth) 1
- set vote_config(${nick}_whois_auth) 1
- if {[info exists vote_config(${nick}_onverify)]} {
- eval "$vote_config(${nick}_onverify)"
- unset vote_config(${nick}_onverify)
- }
- return
- }
- }
- proc impious:verify_cit { from keyword text } {
- global vote_config
- set nick [string tolower [lindex $text 1]]
- set vote_config(${nick}_auth) 1
- set vote_config(${nick}_whois_auth) 1
- if {[info exists vote_config(${nick}_onverify)]} {
- eval "$vote_config(${nick}_onverify)"
- unset vote_config(${nick}_onverify)
- }
- }
- proc impious:recheck { $victim } {
- global vote_config
- unset vote_config(${victim}_timer)
- set vote_config(${victim}_auth) 0
- }
- proc check_cit { nick } {
- global vote_config
- set victim [string tolower $nick]
- # But they
- # if {[lsearch $vote_config(citizens) $victim] == -1} {
- # if {[isvoice $victim $vote_config(channel)]} {
- # putserv "MODE $vote_config(channel) -v $victim"
- # }
- #
- # return -1;
- # }
- #
- if {![info exists vote_config(${victim}_auth)] || $vote_config(${victim}_auth) == 0} {
- # Cit check pending
- puthelp "WHOIS $victim"
- return 0;
- } else {
- # Definitely not a cit
- if {$vote_config(${victim}_auth) == -1} {
- if {![info exists vote_config(${victim}_timer)]} {
- timer 1 "set vote_config(${victim}_auth) 0"
- }
- return -1
- }
- if {[isvoice $victim $vote_config(channel)] == 0 && [isop $victim $vote_config(channel)] == 0} {
- puthelp "MODE $vote_config(channel) +v $victim"
- }
- return 1;
- }
- }
- proc save_citizens { } {
- global vote_config
- set fd [open $vote_config(citizens_file) "w"]
- foreach {loser} $vote_config(citizens) {
- if {[string length $loser] > 0} {
- puts $fd $loser
- }
- }
- flush $fd
- close $fd
- #puthelp "PRIVMSG $vote_config(channel) :$vote_config(code1)Citizens' file saved"
- }
- proc load_citizens { } {
- global vote_config
- set fd [open $vote_config(citizens_file) "r"]
- set vote_config(citizens) [split [read $fd] "\n"]
- close $fd
- #puthelp "PRIVMSG $vote_config(channel) :$vote_config(code2)Citizens' file loaded"
- }
- proc check_all_cits { } {
- global vote_config
- if {![botonchan $vote_config(channel)]} {
- return
- }
- foreach {loser} $vote_config(citizens) {
- if {[onchan $loser $vote_config(channel)]} {
- check_cit $loser
- }
- }
- timer 1 check_all_cits
- }
- load_citizens
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement