Advertisement
LoveAbleElf

av.pubmsg.tcl

Aug 27th, 2017
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. ############################## _\|/_ ###############################
  2. ##
  3. ## autovoice on pubmsg script v1.2
  4. ## by aerosoul@IRCNet (soul@gmx.net)
  5. ##
  6. ## this script will give voice to users who say something on the
  7. ## channel and devoice them after idle time.
  8. ##
  9. ## people will have a overlook of who idles and who is active on your
  10. ## channels (especially for chans with bot-only ops)
  11. ##
  12. ## - add voice on pubmsg for #channel :
  13. ## .chanset #channel +av.pubmsg
  14. ## remove with .chanset #channel -av.pubmsg
  15. ## - add devoice after idle time for #channel :
  16. ## .chanset #channel +av.devoice
  17. ## - optionally set devoice time in the bots partyline :
  18. ## .chanset #channel av.dtime 30 (in minutes)
  19. ##
  20. ## there is a little delay before voicing, so there won't be
  21. ## modefloods.
  22. ##
  23. ## tell me bugs and suggestions @ IRCNet #playaz or soul@gmx.net
  24. ## (no, I don't write a version for older eggys, sorry.)
  25. ## if you want to send me ganja, please leave a msg ;)
  26. ##
  27. ## v1.2 28. may 2001: - added option to set devoice time @ partyline
  28. ## - fixed some stuff / cleaned up
  29. ## - removed responding to stupid "thank you, bot"
  30. ## scripts
  31. ## - the script now also voices @'s. makes more
  32. ## sense =)
  33. ##
  34. ############################## _\|/_ ###############################
  35.  
  36. # set the channels for this script in partyline (see above)
  37.  
  38. # default: devoice after 23 mins
  39. # optionally you can set this in the bots partyline
  40. set av_dtime 23
  41.  
  42. # users with flag +g or +2 or bots won't be devoiced
  43. set av_nodevoiceflag "2gb"
  44.  
  45. # users with flag +1 won't be voiced
  46. # set to "1b" if you don't want bots to be voiced, too
  47. set av_novoiceflag "1"
  48.  
  49. # log devoicing to partyline ? (0/1)
  50. set av_partylog 0
  51.  
  52. # delay before autovoicing, in seconds (will be randomized)
  53. set av_delay 23
  54.  
  55. # also give voice to ops? (0/1)
  56. set av_opvoice 1
  57.  
  58. ############################## _\|/_ ###############################
  59.  
  60. # # # # # # # # # # don't edit below this line # # # # # # # # # # #
  61. # # # # # # # # if you don't know what you're doing # # # # # # # #
  62.  
  63. if {$numversion < "1050000"} {
  64. putlog "you need eggdrop version >1.5 for autovoice on pubmsg script to work"
  65. return 0
  66. }
  67.  
  68. setudef flag av.pubmsg
  69. setudef flag av.devoice
  70. setudef int av.dtime
  71.  
  72. proc av_main {nik uhost hand chan text} {
  73. global av_delay av_novoiceflag
  74.  
  75. set delay [expr 1 + [rand $av_delay]]
  76.  
  77. if {![string match *av_devoice* [timers]]} {timer [expr 3 + [rand 5]] av_devoice}
  78. set chan [string tolower $chan]
  79. if {[av_fcheck $chan] == 0} {return 0}
  80. if {[matchattr $hand $av_novoiceflag] || [matchattr $hand |$av_novoiceflag $chan]} {
  81. return 0
  82. }
  83. if {![isvoice $nik $chan]} {
  84. utimer $delay [split "av_doit $chan $nik"]
  85. }
  86. }
  87.  
  88. proc av_doit {vchan vnick} {
  89. global av_opvoice
  90. if {![isvoice $vnick $vchan]} {
  91. if {($av_opvoice == 0) && [isop $vnick $vchan]} { return 0 }
  92. pushmode $vchan +v $vnick
  93. }
  94. }
  95.  
  96. proc av_devoice {} {
  97. global av_dtime av_nodevoiceflag av_partylog
  98. if {![string match *av_devoice* [timers]]} {timer [expr 1 + [rand 3]] av_devoice}
  99. foreach chan [channels] {
  100. set dtime $av_dtime
  101. if {[av_cdtime $chan] != 0} {
  102. set dtime [av_cdtime $chan]
  103. }
  104. set av_deoplist ""
  105. if {[av_dcheck $chan] == 1} {
  106. foreach user [chanlist $chan] {
  107. set hand [nick2hand $user]
  108. if {[matchattr $hand $av_nodevoiceflag] || [matchattr $hand |$av_nodevoiceflag $chan]} {
  109. continue
  110. }
  111. if {([getchanidle $user $chan] > $dtime) && [isvoice $user $chan]} {
  112. pushmode $chan -v $user
  113. set av_deoplist "$av_deoplist $user"
  114. }
  115. }
  116. if {$av_partylog == 1} {
  117. set count 0
  118. foreach u $av_deoplist {
  119. set count [expr $count + 1]
  120. }
  121. if {($count != 0)} {
  122. putlog "-\[ av.pubmsg \]- devoicing $count users in $chan: $av_deoplist"
  123. }
  124. }
  125. }
  126. }
  127. }
  128.  
  129. proc av_cdtime {chan} {
  130. foreach info [string tolower [channel info $chan]] {
  131. if {[lindex $info 0] == "av.dtime"} {
  132. return [lindex $info 1]
  133. }
  134. }
  135. }
  136.  
  137. proc av_fcheck {chan} {
  138. foreach info [channel info $chan] {
  139. if {[string tolower [string range $info 1 e]] == "av.pubmsg"} {
  140. if {[string index $info 0] == "-"} {
  141. return 0
  142. } else {
  143. return 1
  144. }
  145. }
  146. }
  147. return 0
  148. }
  149.  
  150. proc av_dcheck {chan} {
  151. foreach info [channel info $chan] {
  152. if {[string tolower [string range $info 1 e]] == "av.devoice"} {
  153. if {[string index $info 0] == "-"} {
  154. return 0
  155. } else {
  156. return 1
  157. }
  158. }
  159. }
  160. return 0
  161. }
  162.  
  163. set autovoice_chans ""
  164.  
  165. foreach chan [channels] {
  166. if {[av_fcheck $chan] == 1} {
  167. set autovoice_chans "$autovoice_chans $chan"
  168. }
  169. }
  170.  
  171. if {![string match *av_devoice* [timers]]} {timer [expr 3 + [rand 5]] av_devoice}
  172.  
  173. bind pubm - * av_main
  174.  
  175. ############################## _\|/_ ###############################
  176.  
  177. putlog "-\[ voice on pubmsg script v1.2 by aerosoul active on: $autovoice_chans \]-"
  178.  
  179. ############################ legalize! #############################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement