Posted to tcl by brain|3ss at Mon Nov 19 14:56:41 GMT 2007view raw

  1. # $Id: activechatter.tcl, v3.47.b eggdrop-1.6.18 2007/08/07 10:11:56 Exp $
  2.  
  3. # Begin - Active Chatter v3.47.b [activechatter.tcl]
  4. # Build date: 6th August 2007
  5. # Copyright © 1998-2007 awyeah (awesomeawyeah@gmail.com)
  6. # This TCL script is designed to work with eggdrop v1.6.17 or higher
  7.  
  8. #########################################################################
  9. # Active Chatter 3.47.b #
  10. # #
  11. # #
  12. # Author: awyeah 7th August 2007 #
  13. # Email: awesomeawyeah@gmail.com Build version 3.47.b #
  14. #########################################################################
  15. # #
  16. # ########### #
  17. # DESCRIPTION #
  18. # ########### #
  19. # #
  20. # This script voices users who have said a certain number of lines on a #
  21. # channel (Active chatters). Additionally, it devoices users who are #
  22. # idling for more than a certain amount of time on a channel (Unactive #
  23. # chatters). #
  24. # #
  25. #########################################################################
  26. # #
  27. # ############ #
  28. # REQUIREMENTS #
  29. # ############ #
  30. # #
  31. # The following requirements must be taken into consideration before #
  32. # utilizing this script further: #
  33. # #
  34. # (Fields marked with a '*' are compulsory requirements) #
  35. # #
  36. # (*) (1) You must be running EGGDROP v1.6.17 or higher. #
  37. # (*) (2) You must have TCL v8.4 or higher installed on the system. #
  38. # #
  39. # To FIND the TCL VERSION and PATCH LEVEL your shell is running: #
  40. # (1) At your shell prompt type: tclsh #
  41. # (a) If you have several different versions of tcl installed #
  42. # on the system, pick the latest version. E.g: tclsh8.3, #
  43. # tclsh8.4 which is installed from the given list. #
  44. # (i) At shell prompt type: tclsh8.4 (and go to step 2) #
  45. # (b) If you have only one version, pick that one or continue #
  46. # with 'tclsh' only if it doesn't say to use another name. #
  47. # (2) To find your tcl version type: info tclversion #
  48. # (3) To exit tclsh, type: exit #
  49. # #
  50. #########################################################################
  51. # #
  52. # ############ #
  53. # INSTALLATION #
  54. # ############ #
  55. # #
  56. # This quick installation tutorial consists of 4 steps. Please follow #
  57. # all steps correctly in order to setup your script. #
  58. # #
  59. # (1) Upload the file activechatter.tcl in your eggdrop '/scripts' #
  60. # folder along with your other scripts. #
  61. # #
  62. # (2) OPEN your eggdrops configuration (.conf) file and add a link at #
  63. # the bottom of the configuration file to the path of drone nick #
  64. # remover script, it would be: #
  65. # #
  66. # source scripts/activechatter.tcl #
  67. # #
  68. # #
  69. # (3) SAVE your bots configuration file. #
  70. # #
  71. # (4) REHASH and RESTART your bot. #
  72. # #
  73. #########################################################################
  74. # #
  75. # ######## #
  76. # VERSIONS #
  77. # ######## #
  78. # #
  79. # v3.47.b - First public release. #
  80. # (07/08/07) #
  81. # #
  82. #########################################################################
  83. # #
  84. # ######## #
  85. # CONTACTS #
  86. # ######## #
  87. # #
  88. # (*) For any suggestions, comments, questions or bugs reports, feel #
  89. # free to email me at: #
  90. # #
  91. # awesomeawyeah@gmail.com #
  92. # #
  93. # #
  94. # (*) You can also contact me on MSN Messenger - my messenger ID is: #
  95. # #
  96. # awyeah@awyeah.org #
  97. # #
  98. # #
  99. # (*) You can also catch me on The DALnet Network: #
  100. # #
  101. # /server irc.dal.net:6667, Nick: awyeah #
  102. # Channels: #awyeah, #eggdrops #
  103. # #
  104. #########################################################################
  105. # #
  106. # ######### #
  107. # COPYRIGHT #
  108. # ######### #
  109. # #
  110. # This program is a free software; you can distribute it under the #
  111. # terms of the GNU General Public License under Section 1 as published #
  112. # by the Free Software Foundation; either version 2 of the license, or #
  113. # (at your option) any later version. #
  114. # #
  115. # This program is distributed in the hope that it will be useful, #
  116. # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  117. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  118. # GNU General Public License for more details. #
  119. # #
  120. # WARNING: #
  121. # This program is protected by copyright law and international #
  122. # treaties. Unauthorized reproduction of this program, or any portion #
  123. # of it, may result in severe civil penalties and will be prosecuted to #
  124. # the maximum extent possible under the law. #
  125. # #
  126. #########################################################################
  127. # #
  128. # ######### #
  129. # DOWNLOADS #
  130. # ######### #
  131. # #
  132. # Latest versions of this script can be found on the TCL archives of #
  133. # the following websites: #
  134. # #
  135. # 1) http://www.egghelp.org/ #
  136. # 2) http://www.tclscript.com/ #
  137. # 3) http://channels.dal.net/awyeah/scripts/ #
  138. # #
  139. #########################################################################
  140.  
  141.  
  142. ##############################################
  143. ### Start configuring variables from here! ###
  144. ##############################################
  145.  
  146. #Set the channels you would like this script to work on.
  147. #USAGE: [1/2] (1=User defined channels, 2=All channels the bot is on)
  148. set autovoice(chantype) "1"
  149.  
  150.  
  151. ### SET THIS ONLY IF YOU HAVE SET THE PREVIOUS SETTING TO '1' ###
  152. #Set the channels below (each separated by a space) on which this script would work.
  153. #USAGE: set clonescan(channels) "#channel1 #channel2 #mychannel"
  154. set autovoice(chans) "#room"
  155.  
  156.  
  157. #Set the 'number of lines' here after which a user will be voiced for being
  158. #an ACTIVE CHATTER. Only channel messages will be counted for activity.
  159. set autovoice(lines) "2"
  160.  
  161.  
  162. #Set the time here in 'minutes' after which you would like to devoice idlers (UNACTIVE
  163. #CHATTERs). Users idling for more than this number of minute(s) will be devoiced.
  164. ######################################################################################
  165. #If you wish yo disable this setting, set it to: "0"
  166. #USAGE: Any numerical integer value.
  167. set autovoice(dvtime) "5"
  168.  
  169.  
  170. ### SET THIS ONLY IF YOU HAVE ENABLED (UNACTIVE CHATTER) DEVOICING FOR IDLERS ###
  171. #Set the time here in 'minutes' after which you would continuously like to check
  172. #channel voices for idling. It is better to set this value low for good accuracy.
  173. #USAGE: Any numerical integer value.
  174. set autovoice(dvcheck) "2"
  175.  
  176.  
  177. ### ACTIVE-CHATTER (VOICE) EXEMPT NICKS ###
  178. #Set the list of nicks here which you would like to be exempted from being
  179. #autovoiced by the script. Place separate each entry by placing it in a new line.
  180. ##################################################################################
  181. #If you do not have any nick to exempt, then: set autovoice(avexempt) {}
  182. set autovoice(avexempt) {
  183. nick1
  184. nick2
  185. nick3
  186. }
  187.  
  188.  
  189. ### UNACTIVE-CHATTER (DEVOICE) EXEMPT NICKS ###
  190. #Set the list of nicks here which you would like to be exempted from being
  191. #devoiced by the script. Place separate each entry by placing it in a new line.
  192. ################################################################################
  193. #If you do not have any nick to exempt, then: set autovoice(dvexempt) {}
  194. set autovoice(dvexempt) {
  195. nick1
  196. nick2
  197. nick3
  198. }
  199.  
  200.  
  201. #############################################################
  202. ### Congratulations! Script configuration is now complete ###
  203. #############################################################
  204.  
  205.  
  206. ##############################################################################
  207. ### Don't edit anything else from this point onwards even if you know tcl! ###
  208. ##############################################################################
  209.  
  210. set autovoice(auth) "\x61\x77\x79\x65\x61\x68"
  211. set autovoice(ver) "v3.75.b"
  212.  
  213. bind pubm - "*" autovoice:users
  214. bind join - "*" autovoice:erase:record
  215. if {$autovoice(dvtime) > 0} {bind time - "*" autovoice:devoice:idlers}
  216.  
  217. proc autovoice:users {nick uhost hand chan text} {
  218. global autovoice voice
  219. if {($autovoice(chantype) == 1) && ([lsearch -exact [split [string tolower $autovoice(chans)]] [string tolower $chan]] == -1)} { return 0 }
  220. if {[isbotnick $nick] || [isop $nick $chan] || [isvoice $nick $chan]} { return 0 }
  221. set exemptlist [list]
  222. foreach user $autovoice(avexempt) {
  223. lappend exemptlist $user
  224. }
  225. if {[llength $exemptlist] > 0} {
  226. foreach person $exemptlist {
  227. if {[string equal -nocase $person $nick]} {
  228. return 0
  229. }
  230. }
  231. }
  232. set user [split [string tolower $nick:$chan]]
  233. if {![info exists voice($user)] && ![isvoice $nick $chan] && ![isop $nick $chan]} {
  234. set voice($user) 0
  235. } elseif {[info exists voice($user)] && ([expr $voice($user) + 1] >= $autovoice(lines)) && ![isop $nick $chan] && ![isvoice $nick $chan]} {
  236. utimer 3 [list autovoice:delay $nick $chan]
  237. unset voice($user)
  238. } elseif {[info exists voice($user)]} {
  239. incr voice($user)
  240. }
  241. }
  242.  
  243. proc autovoice:delay {nick chan} {
  244. set user [split [string tolower $nick:$chan]]
  245. if {[botisop $chan] && [onchan $nick $chan] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
  246. pushmode $chan +v $nick
  247. set voiced($user) 1
  248. }
  249. if {[info exists voiced($user)]} {
  250. pushmode $chan -k \0032Active.\00312chatter
  251. flushmode $chan
  252. }
  253. }
  254.  
  255. proc autovoice:erase:record {nick uhost hand chan} {
  256. global autovoice voice
  257. if {($autovoice(chantype) == 1) && ([lsearch -exact [split [string tolower $autovoice(chans)]] [string tolower $chan]] == -1)} { return 0 }
  258. if {[isbotnick $nick]} { return 0 }
  259. set user [split [string tolower $nick:$chan]]
  260. if {[info exists voice($user)]} { unset voiceuser($user) }
  261. }
  262.  
  263. proc autovoice:devoice:idlers {m h d mo y} {
  264. global autovoice
  265. if {([scan $m %d]+([scan $h %d]*60)) % $autovoice(dvcheck) == 0} {
  266. switch -exact $autovoice(chantype) {
  267. 1 { set chans [split $autovoice(chans)] }
  268. 2 { set chans [channels] }
  269. default { return 0 }
  270. }
  271. foreach chan $chans {
  272. set chan [split [string tolower $chan]]
  273. foreach user [chanlist $chan] {
  274. set user [split [string tolower $user]]
  275. if {![isbotnick $user] && ![isop $user $chan] && [isvoice $user $chan]} {
  276. set exemptlist [list]
  277. foreach nick $autovoice(dvexempt) {
  278. lappend exemptlist $nick
  279. }
  280. if {[llength $exemptlist] > 0} {
  281. foreach person $exemptlist {
  282. if {[string equal -nocase $person $user]} {
  283. set exempt($user) 1; break
  284. }
  285. }
  286. }
  287. if {![info exists exempt($user)] && ([getchanidle $user $chan] >= $autovoice(dvtime))} {
  288. pushmode $chan -v $user
  289. if {![info exists devoice($chan)]} {
  290. set devoice($chan) 1
  291. }
  292. } else {
  293. continue
  294. }
  295. } else {
  296. continue
  297. }
  298. }
  299. if {[info exists devoice($chan)]} {
  300. pushmode $chan -k \0032Unactive.\00312chatter
  301. flushmode $chan
  302. }
  303. }
  304. }
  305. }
  306.  
  307. if {![string equal "\x61\x77\x79\x65\x61\x68" $autovoice(auth)]} { set autovoice(auth) \x61\x77\x79\x65\x61\x68 }
  308. putlog "Active Chatter $autovoice(ver) by $autovoice(auth) has been loaded successfully."
  309.  
  310.  
  311.  
  312.