Advertisement
funnygonzo

Biertheke

Mar 20th, 2021
2,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 22.14 KB | None | 0 0
  1. ####################################################################
  2. ##         beer.tcl v.1.beta1 by SpiKe^^  ##  15 Mar 09  -        ##
  3. ####################################################################
  4. #                                                                  #
  5. # beer is a simple channel chatter script.  Incluced are default   #
  6. # bartender triggers.  Can be used for Any Triggers.  Variable     #
  7. # replacements can be used in all replies.  Complete on-join greet #
  8. # functions included.                                              #
  9. #                                                                  #
  10. # Add this line:      source scripts/beer.tcl                      #
  11. # to your eggdrop config and rehash to load the script.            #
  12. #                                                                  #
  13. #           Please report bugs or make comments at:                #
  14. #                irc: undernet: #pc-mIRC-help                      #
  15. #              email: spike@mytclscripts.com                       #
  16. #               http://www.mytclscripts.com                        #
  17. #                                                                  #
  18. #                       Highlights                                 #
  19. # 1. Unlimited Public Triggers with Public Replies                 #
  20. # 2. Flood Protection                                              #
  21. # 3. Multi-Channel                                                 #
  22. # 4. Control Access by User Flags                                  #
  23. # 5. Complete On-Join Greeting Functions                           #
  24. # 6. Variable Replacements in All Replies:                         #
  25. #     %m (me)         :is replaced by the users nick               #
  26. #     %d (drinker)    :is replaced by the nick(s) provided         #
  27. #     %b (bartender)  :is replaced by the botnick                  #
  28. #     %c (channel)    :is replaced by the channel                  #
  29. #                                                                  #
  30. ####################################################################
  31. #                                                                  #
  32. #                        Beer Script Notes                         #
  33. #                                                                  #
  34. # 1. Script can set an unlimited number of public triggers and     #
  35. #    a one line public reply for each trigger.                     #
  36. #                                                                  #
  37. # 2. Triggers/replies are listed in the tcl setting, one per line: #
  38. #                                                                  #
  39. #    Example:  beer %b hands %d a beer.                            #
  40. #                  å                                                #
  41. #    The first word in the line is the trigger word:    beer       #
  42. #    Trigger can be any one word  (No Spaces in triggers).         #
  43. #    Everything else is the reply:    %b hands %d a beer.          #
  44. #                                                                  #
  45. # 3. Script will trigger in 3 different ways:                      #
  46. #    a.  The trigger by itself:   !beer                            #
  47. #        Drinker (%d) would be replaced by the users nick          #
  48. #    b.  Trigger with a target nick:   !beer SpiKe^^               #
  49. #        Drinker would be replaced by the nick:   SpiKe^^          #
  50. #    c.  Trigger with multiple nicks:   !beer SpiKe^^ ted bart     #
  51. #        Drinker would be replaced by:   SpiKe^^ ted & bart        #
  52. #                                                                  #
  53. # 4. Variable replacement codes for nicks in replies:              #
  54. #     %m (me)         :usually replaced by the users nick          #
  55. #     %d (drinker)    :usually replaced by the nick(s) provided    #
  56. #     %b (bartender)  :always replaced by the botnick              #
  57. #                                                                  #
  58. # 4. Variable replacement notes:                                   #
  59. #    a.  Don't use all 3 nick codes in the same reply.             #
  60. #        If no target nick is provided, (me) & (drinker) would     #
  61. #        both be replaced by the users nick.                       #
  62. #    b.  If reply uses both (me) & (drinker) replacement codes,    #
  63. #        and no target nick is provided...                         #
  64. #          %d    :would be replaced by the users nick              #
  65. #          %m    :would be replaced by the botnick  (bartender)    #
  66. #                                                                  #
  67. ####################################################################
  68.  
  69.  
  70.  
  71.  
  72. ################################################
  73. ########  Beer Channel Talker Settings  ########
  74. ################################################
  75.  
  76. ##  set Beer Channels here  ##
  77. # ex. {#MyChan}
  78. # ex. {#powerdrinkers #bud #weiser}
  79. # or:  {*}  = all channels
  80. set beerchans {*}
  81.  
  82. ##  set public beer flags here  ##
  83. ##  userfile flags required to trigger the beer script (-|- = everyone)  ##
  84. set beerflags -|-
  85.  
  86. ##  set public trigger prefix here  (can be "")  ##
  87. set beerpre "."
  88.  
  89. ##  set beer flood settings  ##
  90. set beerflood  4  ;##  number of beer requests in 10 seconds  ##
  91. set beerignore 20  ;##  next request sets ignore for 'x' seconds  ##
  92. set beerigmsg "Bier Flood! Die Bar ist nun geschlossen."  ;##  can be "" for no msg  ##
  93. set beeropen "Die Bar ist wieder offen."  ;##  can be "" for no msg  ##
  94.  
  95. ##  set reply colors here  (each can be "")  ##
  96. set beercolor1 "10"  ;# all beer reply lines start this color #
  97. set beercolor2 "10"
  98. set beercolor3 "10"
  99. set beercolor4 "10"
  100.  
  101. ########################################
  102. ####  Beer Talker Triggers/Replies  ####
  103. ########################################
  104.  
  105. ##  set triggers and returns here ##
  106. ##  trigger first,  no spaces in triggers!!  ##
  107. ####  variable replacement  ####
  108. ##  %m (me)         :is replaced by the users nick  ##
  109. ##  %d (drinker)    :is replaced by the nick(s) provided  ##
  110. ##  %b (bartender)  :is replaced by the botnick  ##
  111. ##  %c (channel)    :is replaced by the channel  ##
  112. ##  %p (prefix)     :is replaced by the command prefix setting  ##
  113. ####  colors replacement  (all reply lines start with color #1)  ####
  114. ##  %1 (color #1)   :is replaced by color #1 from above  ##
  115. ##  %2 (color #2)   :is replaced by color #2 from above  ##
  116. ##  %3 (color #3)   :is replaced by color #3 from above  ##
  117. ##  %4 (color #4)   :is replaced by color #4 from above  ##
  118.  
  119. set beers {
  120.  
  121. menu Wir haben %pbeer %pcocktails %pshots %pwine %pmunchies %pjukebox %phouse
  122.  
  123. beer Wir haben %pbud %pbudlight %pbudice %pmiller
  124. bud  %d says pop a top again %b. I think I'll have another round.
  125. budlight 1 for %d and 1 for %m.
  126. budice %b hands %d a budice
  127. miller another please %b. Few more and I'll be living the "high" life ;)
  128.  
  129. cocktails Wir haben %pmargaritas
  130. margaritas %d sagt hey %b, gib der Lady einen Drink. Lord have mercy, my only thought was tequila makes her clothes fall off.
  131.  
  132. shots Wir haben %ptequlia %pwhiskey %pscotch %pburbon
  133. tequila %b pours the shot thinking... 1 tequila, 2 tequila 3 tequila, floor.
  134. whiskey %b hands %d a double shot and reflects... few more of those you'll be dancing on the ceiling.
  135. scotch another round my friend, and one for %d
  136. burbon %d loosens tie and sighs... %b triple on the rocks if it does ya:)
  137.  
  138. wine We have %pred %pwhite
  139. red %b sings red red wine you make me feel so fine...you keep me rocking all of the time, and hands %d the glass
  140. white hey %b once i drank a lil wine and it made me oh so fine. so keep em coming %b then we can dance and party all night
  141.  
  142. munchies We have %pchips %ppretzels %peggs %ppizza %pcheeseberger
  143. chips Hey %d, betcha can't eat just one.
  144. pretzels %b places a bowl of pretzels on the bar.
  145. eggs hmmm pickled eggs and beer.. are ya sure;)
  146. pizza %b places a piping hot fully loaded pizza in front of %d enjoy %d
  147. cheeseberger %b asks...want fries with that
  148.  
  149. jukebox We play all the hits. %prock %pcountry %ppunk %pcomedy
  150. rock Sammy Hagar Sings... One shot...Hey! more tequila! Two shots...Hey! que veneno! Three shots... Ay yi yi yi yi ... Hey! Hey! Hey! Hey! Hey! Hey!
  151. country Jimmy Buffet Sings... So %b bring a pitcher, Another round of brew...Honey why don't we get drunk and screw
  152. punk Bare Naked Ladies Sings... I love you more then the week before... I discovered alcohol.
  153. comedy The Blues Brothers Sing... Hey %b Draw one, two, three, four glasses of beer
  154.  
  155. house We have %pladies %pgents %pstool %plastcall %pbar %pround %ptime %pdrunk %psingalong
  156. ladies its ladies nite %b buys all the pretty ladies a drink
  157. gents This is your lucky nite boys. Wet t-shirt contest tonight.
  158. stool well hell I was sure that stool was there a minute ago
  159. lastcall The clock on the wall says 3 o'clock... last call for alcohol... What ya need;)
  160. bar %b buys everyone on %c a drink
  161. round %d buys everyone on %c a drink
  162. time Time for another round. What'll it be boys & girls;)
  163. drunk Who %d  
  164. singalong We have 99 bottles of beer on the wall, 99 bottles of beer, %b takes one down....
  165.  
  166. }  ;## end beers list ##
  167.  
  168.  
  169.  
  170. ###############################################
  171. ########  Beer Channel Greet Settings  ########
  172. ###############################################
  173.  
  174. ##  send onjoin greeting how ??  (0 = no channel greeting)  ##
  175. set beeronjoin 3  ;# 1=privatemsg 2=usernotice 3=public inchan 4=channelnotice #
  176.  
  177. ##  set channels to do onjoin message in  ##
  178. ##  NOTE:  onjoin messages only sent to Beer Channels  ##
  179. # ex. {#MyChan}
  180. # ex. {#powerdrinkers #bud #weiser}
  181. # or:  {*}  = all Beer Channels
  182. set beerjchans {#funxd}
  183.  
  184. ##  set exempt user flags for onjoin  ##
  185. # ex. b       :same as b|b  :exempt all global & channel bots
  186. # ex. -|mn    :exempt only channel masters & owners
  187. # ex. f|*     :exempt global friends and everyone with any channel flags
  188. set beerjxmpt bmno|fmn
  189.  
  190. ##  OnJoin reply flood  ##  mostly for beeronjoin setting 1 or 2 above  ##
  191. set beerjflood  4  ;##  max number of joins to reply to in 10 seconds  ##
  192.  
  193. #######################################
  194. ####  Beer Channel Greetings Text  ####
  195. #######################################
  196.  
  197. ##  set the text to send for OnJoin greetings  ##
  198. ####  variable replacement  (for both public & private greetings)  ####
  199. ##  %b (bot nick)   :is replaced by the botnick  ##
  200. ##  %p (prefix)     :is replaced by the command prefix setting  ##
  201. ##  %1 (color #1)   :is replaced by color #1 from above  ##
  202. ##  %2 (color #2)   :is replaced by color #2 from above  ##
  203. ##  %3 (color #3)   :is replaced by color #3 from above  ##
  204. ##  %4 (color #4)   :is replaced by color #4 from above  ##
  205.  
  206.  
  207. ##  set public (in channel) join message/notice  # for settings 3 & 4 above ##
  208. ##  note:  also used after a join flood, even if set to 1 or 2 ##
  209. ####  variable replacement  (for public greetings)  ####
  210. ##  %c (channel)    :is replaced by the channel joined   ##
  211. ##  %n (nick)       :is replaced by the nick(s) that joined  ##
  212. ##  %j (joined)     :above nicks joined with ,'s or a &  ##
  213. set beerpubjoin {
  214.  
  215. [%n] Willkommen in %c Ich bin %b. Ich bin dein Baarkeeper heute. Wir haben %pbeer %pcocktails %pshots %pwine %pmunchies %pjukebox %phouse
  216.  
  217. }  ;## end onjoin msg  ##
  218.  
  219. ##  set private message/notice join text  # for settings 1 & 2 above ##
  220. ####  variable replacement  (for private greetings)  ####
  221. ##  %n (nick)       :is replaced by the users nick  ##
  222. ##  %c (channel)    :is replaced by the channel(s) this nick joined  ##
  223. ##  %j (joined)     :above channels joined with ,'s or a &  ##
  224. set beerusrjoin {
  225.  
  226. [%n] Welcome to %c I'm %b. I'll be your bartender today. We have %pbeer %pcocktails %pshots %pwine %pmunchies %pjukebox %phouse
  227.  
  228. }  ;## end onjoin msg  ##
  229.  
  230.  
  231.  
  232. ########################################################################################
  233. ### end settings ### end settings ### end settings ### end settings ### end settings ###
  234. ### end settings ### end settings ### end settings ### end settings ### end settings ###
  235. ########################################################################################
  236.  
  237. set beerchans [split [string trim $beerchans]]
  238. set beerigmsg [string trim $beerigmsg]  ;  set beeropen [string trim $beeropen]
  239.  
  240. proc BrIsDig {str} { return [string is digit -strict $str] }
  241. proc BrStrLo {str} { return [string tolower $str] }
  242.  
  243. if {$beercolor1 eq "" && $beercolor2 eq "" && $beercolor3 eq "" && $beercolor4 eq ""} {
  244.   array set beer {clr1 "" clr2 "" clr3 "" clr4 ""}
  245. } elseif {$beercolor1 eq $beercolor2 && $beercolor1 eq $beercolor3 && $beercolor1 eq $beercolor4} {
  246.   array set beer {clr2 "" clr3 "" clr4 ""}  ;  set beer(clr1) $beercolor1
  247. } else {
  248.   array set beer [list clr1 $beercolor1 clr2 $beercolor2 clr3 $beercolor3 clr4 $beercolor4]
  249. }
  250. unset beercolor1 beercolor2 beercolor3 beercolor4
  251.  
  252. foreach brtmp [binds DrinkNow] {
  253.  foreach {brtyp brflg brnam brhit brprc} $brtmp {  break  }
  254.  unbind $brtyp $brflg $brnam $brprc
  255. }
  256.  
  257. set beers [split [string trim $beers] "\n"]  ;  set newbeers ""
  258. foreach bitem $beers {  set brtmp [split [string trim $bitem]]
  259.  if {[llength $brtmp]>"1"} {  set brtrig [lindex $brtmp 0]  ;  set brtxt [join [lrange $brtmp 1 end]]
  260.  set brtxt [string map [list %p $beerpre] $brtxt]
  261.    foreach brchan $beerchans {  bind pubm $beerflags "$brchan $beerpre$brtrig*" DrinkNow  }
  262.    if {[string match {*%[1234]*} $brtxt]} {  set brtmp ""
  263.      if {![string match {%[1234]*} $brtxt]} {
  264.        if {$beer(clr1) ne ""} {  set brtmp $beer(clr1)  }
  265.      } elseif {[string index $brtxt 1]=="2"} {
  266.        if {$beer(clr2) eq ""} {  set brtxt [string range $brtxt 2 end]  }
  267.      } elseif {[string index $brtxt 1]=="3"} {
  268.        if {$beer(clr3) eq ""} {  set brtxt [string range $brtxt 2 end]  }
  269.      } elseif {[string index $brtxt 1]=="4"} {
  270.        if {$beer(clr4) eq ""} {  set brtxt [string range $brtxt 2 end]  }
  271.      } else {
  272.        if {$beer(clr1) eq ""} {  set brtxt [string range $brtxt 2 end]  }
  273.      }
  274.      set brtxt [string map [list %1 $beer(clr1) %2 $beer(clr2) %3 $beer(clr3) %4 $beer(clr4)] $brtxt]
  275.    } else {
  276.      if {$beer(clr1) eq ""} {  set brtmp ""  } else {  set brtmp $beer(clr1)  }
  277.    }
  278.    lappend newbeers "$beerpre$brtrig $brtmp$brtxt"
  279.  }
  280. }
  281. set beers $newbeers
  282.  
  283. if {![info exists beer(fludcnt)]} {  set beer(fludcnt) 0  }
  284. if {![info exists beer(ignore)]} {  set beer(ignore) 0  }
  285. if {![info exists beer(publs)]} {  set beer(publs) ""  }
  286.  
  287. proc ZeroFcnt {} {  global beer
  288.  if {$beer(ignore)=="0"} {  set beer(publs) ""  ;  set beer(fludcnt) 0  }
  289. }
  290.  
  291. proc UnIgnore {cnt} {  global beer beeropen  ;  incr beer(ignore) -$cnt
  292.  if {$beer(ignore)=="0"} {
  293.    if {$beeropen ne ""} {
  294.      if {$beer(clr1) eq ""} {  set brtmp ""  } else {  set brtmp $beer(clr1)  }
  295.      foreach chan $beer(publs) {  puthelp "PRIVMSG $chan :$brtmp $beeropen"  }
  296.    }
  297.    set beer(publs) ""  ;  set beer(fludcnt) 0
  298.  }
  299. }
  300.  
  301. proc DrinkNow {nk uh hn ch tx} {  global beer beers beerflood beerignore beerigmsg botnick
  302.  set tx [split $tx]  ;  set next [lsearch -inline $beers "[lindex $tx 0] *"]
  303.  if {$next ne ""} {
  304.    if {$beer(fludcnt)==$beerflood} {  utimer $beerignore "UnIgnore 1"  ;  incr beer(ignore)
  305.      if {[lsearch $beer(publs) $ch]=="-1"} {  lappend beer(publs) $ch  }
  306.      if {$beerigmsg ne ""} {
  307.        if {$beer(clr1) eq ""} {  set brtmp ""  } else {  set brtmp $beer(clr1)  }
  308.        foreach chan $beer(publs) {  puthelp "PRIVMSG $chan :$brtmp $beerigmsg"  }
  309.      }
  310.    } elseif {$beer(fludcnt)>$beerflood && [lsearch $beer(publs) $ch]=="-1"} {  lappend beer(publs) $ch
  311.      if {$beerigmsg ne ""} {
  312.        if {$beer(clr1) eq ""} {  set brtmp ""  } else {  set brtmp $beer(clr1)  }
  313.        puthelp "PRIVMSG $ch :$brtmp $beerigmsg"
  314.      }
  315.    }
  316.    incr beer(fludcnt)
  317.    if {$beer(ignore)>"0"} {  return 0  }
  318.    if {$beer(fludcnt)=="1"} {  utimer 10 ZeroFcnt  }
  319.    if {[lsearch $beer(publs) $ch]=="-1"} {  lappend beer(publs) $ch  }
  320.    set me $nk  ;  set drinker $me  ;  set bar $botnick
  321.    if {[llength $tx]=="1"} {
  322.      if {[string match *%b* $next] && [string match *%d* $next] && [string match *%m* $next]} {  set err 1
  323.      } elseif {[string match *%d* $next] && [string match *%m* $next]} {  set me $bar  }
  324.    } elseif {[llength $tx]=="2"} {  set drinker [lindex $tx 1]
  325.    } else {  set drinker "[join [lrange $tx 1 end-1]] & [lindex $tx end]"  }
  326.    puthelp "PRIVMSG $ch :[string map [list %d $drinker %c $ch %m $me %b $bar] [join [lrange [split $next] 1 end]]]"
  327.  }
  328. }
  329.  
  330. ## beer on-join code ##
  331.  
  332. foreach brtmp [binds BeerJoin] {
  333.  foreach {brtyp brflg brnam brhit brprc} $brtmp {  break  }
  334.  unbind $brtyp $brflg $brnam $brprc
  335. }
  336.  
  337. if {![BrIsDig $beeronjoin]} {  set beeronjoin 0  }
  338.  
  339. if {$beeronjoin>"0"} {
  340.   if {$beerjchans eq "" || $beerjchans eq "*"} {  set beerjchans $beerchans
  341.   } else {  set beerjchans [split [string trim $beerjchans]]  ;  set brtmp ""
  342.     foreach bchan $beerjchans {
  343.      if {$beerchans eq "*" || [lsearch [BrStrLo $beerchans] [BrStrLo $bchan]]>"-1"} {
  344.          lappend brtmp $bchan  }
  345.     }
  346.     if {$brtmp ne ""} {  set beerjchans $brtmp  } else {  set beeronjoin 0
  347.       putlog "Beer.tcl on-join message disabled. Missing/Invalid On-Join Channel(s)."
  348.     }
  349.   }
  350. }
  351.  
  352. if {$beeronjoin>"0"} {  set brcnt 0
  353.   foreach brmsg [list $beerusrjoin $beerpubjoin] {  incr brcnt
  354.    set brmsg [split [string trim $brmsg] "\n"]  ;  set newgreet ""
  355.    foreach bline $brmsg {  set bline [string trim $bline]
  356.     if {$bline ne ""} {  lappend newgreet [string map [list %p $beerpre] $bline]  }
  357.    }
  358.    if {$brcnt=="1"} {  set beerusrjoin $newgreet  } else {  set beerpubjoin $newgreet  }
  359.   }
  360.   if {$beerpubjoin eq ""} {  set beeronjoin 0
  361.     putlog "Beer.tcl on-join message disabled. Missing a Public On-Join Message."
  362.   } elseif {$beerusrjoin eq "" && $beeronjoin<"3"} {
  363.     putlog "Beer.tcl on-join message set public. Missing a User On-Join Message."
  364.     if {$beeronjoin=="1"} {  set beeronjoin 3  } else {  set beeronjoin 4  }
  365.   }
  366. }
  367.  
  368. if {$beeronjoin=="0"} {  unset beerusrjoin beerpubjoin beerjchans beerjflood beerjxmpt
  369.   if {[info exists beer(joinls)]} {
  370.       unset beer(joinls) beer(joincnt) beer(joinflud) beer(lastjmsg) beer(wasflud)  }
  371.   if {[info exists beer(jtimer)]} {  unset beer(jtimer)  }
  372. } else {  set beerjxmpt [string trim $beerjxmpt]
  373.   if {$beerjxmpt ne ""} {
  374.     if {[string first | $beerjxmpt]=="-1"} {  append beerjxmpt |$beerjxmpt  }
  375.     set beerjxmpt [split $beerjxmpt |]
  376.   }
  377.   if {$beerjxmpt eq "- -"} {  set beerjxmpt ""  }
  378.   if {![info exists beer(joinls)]} {
  379.       array set beer {joinls "" joincnt 0 joinflud 0 lastjmsg "" wasflud 0}  }
  380.   foreach brch $beerjchans {  bind join - "$brch *" BeerJoin  }
  381. ####  Begin PROC BeerJoin  ####
  382.   proc BeerJoin {nk uh hn ch} {  global beer beerjflood beerjxmpt botnick
  383.    if {$beer(joincnt)==$beerjflood} {  set beer(joinflud) 1  ;  set beer(wasflud) 1  }
  384.    incr beer(joincnt)  ;  set xmpt 0
  385.    if {$nk eq $botnick} {  set xmpt 1
  386.    } elseif {$beerjxmpt ne "" && $hn ne "*"} {  foreach {ng nc} $beerjxmpt { break }
  387.      set flgs [split [chattr $hn $ch] |]  ;  foreach {hg hc} $flgs { break }
  388.      if {$ng ne "-" && $ng ne ""} {
  389.        if {$ng eq "*" && $hg ne "-"} {  set xmpt 1
  390.        } else {  set patrn *\[$ng\]*
  391.          if {[string match $patrn $hg]} {  set xmpt 1  }
  392.        }
  393.      }
  394.      if {$xmpt=="0" && $nc ne "-" && $nc ne ""} {
  395.        if {$nc eq "*" && $hc ne "-"} {  set xmpt 1
  396.        } else {  set patrn *\[$nc\]*
  397.          if {[string match $patrn $hc]} {  set xmpt 1  }
  398.        }
  399.      }
  400.    }
  401.    if {$xmpt=="0"} {
  402.      if {[lsearch [BrStrLo $beer(joinls)] [BrStrLo $nk@$ch]]=="-1"} { lappend beer(joinls) $nk@$ch }
  403.      if {![info exists beer(qtimer)]} {  set beer(qtimer) [utimer 4 SndJmsg]  }
  404.    }
  405.    if {![info exists beer(jtimer)]} {  set beer(jtimer) [utimer 10 ZeroJcnt]  }
  406.   }
  407. ####  End PROC BeerJoin  ####
  408. ####  Begin PROC ZeroJcnt  ####
  409.   proc ZeroJcnt {} {  global beer beerjflood
  410.    if {$beer(joincnt)>$beerjflood} {  set beer(wasflud) 1  } else {  set beer(wasflud) 0  }
  411.    set beer(joincnt) 0
  412.    if {$beer(wasflud)=="0"} {  unset beer(jtimer)
  413.      if {$beer(joinls) eq ""} {  ;## if the queue has stopped running too ##
  414.        if {$beer(wasflud)=="0"} {  set beer(joinflud) 0  }
  415.      }
  416.      return 0
  417.    }
  418.    set beer(jtimer) [utimer 10 ZeroJcnt]
  419.   }
  420. ####  End PROC ZeroJcnt  ####
  421. ####  Begin PROC SndJmsg  ####
  422.   proc SndJmsg {} {  global beer beeronjoin beerusrjoin beerpubjoin botnick
  423.    set idx -1  ;  set got 0
  424.    foreach nc $beer(joinls) {  incr idx
  425.     foreach {nk ch} [split $nc @] {  break  }
  426.     if {[onchan $nk $ch] && [BrStrLo $nc] ne $beer(lastjmsg)} {  set got 1  ;  break  }
  427.    }
  428.    if {$got=="0"} {  set beer(joinls) ""
  429.    } else {  set beer(lastjmsg) [BrStrLo $nc]
  430.      set beer(joinls) [lreplace $beer(joinls) 0 $idx]  ;  set how 2
  431.      if {$beer(joinflud)=="1" && $beeronjoin=="1"} {  set putpre "PRIVMSG $ch :"
  432.      } elseif {$beer(joinflud)=="1" && $beeronjoin=="2"} {  set putpre "NOTICE $ch :"
  433.      } elseif {$beeronjoin=="1"} {  set putpre "PRIVMSG $nk :"  ;  set how 1
  434.      } elseif {$beeronjoin=="2"} {  set putpre "NOTICE $nk :"  ;  set how 1
  435.      } elseif {$beeronjoin=="4"} {  set putpre "NOTICE $ch :"
  436.      } else {  set putpre "PRIVMSG $ch :"  }
  437.      set brtmp ""  ;  set newjls ""
  438.      if {$how=="1"} {  lappend brtmp $ch  ;  set st $nk@*
  439.      } else {  lappend brtmp $nk  ;  set st *@$ch  }
  440.      foreach onc $beer(joinls) {
  441.       if {[string match -nocase $st $onc]} {
  442.         foreach {onk och} [split $onc @] {  break  }
  443.         if {[onchan $onk $och]} {
  444.           if {$how=="1"} {  lappend brtmp $och  } else {  lappend brtmp $onk  }
  445.         }
  446.       } else {  lappend newjls $onc  }
  447.      }
  448.      set beer(joinls) $newjls
  449.    }
  450.    if {$beer(joinls) eq ""} {  unset beer(qtimer)
  451.      if {$beer(wasflud)=="0"} {  set beer(joinflud) 0  }
  452.    } else {  set beer(qtimer) [utimer 4 SndJmsg]  }
  453.    if {$got=="1"} {  set norc [join $brtmp]
  454.      if {[llength $brtmp]<"3"} {  set brtmp [join $brtmp " & "]
  455.      } else {  set brtmp [join $brtmp ", "]  }
  456.      set maps [list %b $botnick %1 $beer(clr1) %2 $beer(clr2) %3 $beer(clr3) %4 $beer(clr4)]
  457.      if {$how=="1"} {  set txlns $beerusrjoin  ;  lappend maps %n $nk %c $norc %j $brtmp
  458.      } else {  set txlns $beerpubjoin  ;  lappend maps %n $norc %c $ch %j $brtmp  }
  459.      foreach txtl $txlns {  puthelp "$putpre[string map $maps $txtl]"  }
  460.    }
  461.   }
  462. ####  End PROC SndJmsg  ####
  463. }
  464.  
  465. putlog "beer.tcl v.1.beta1 by guiness-fans loaded"
  466.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement