Ticket #13: last-simple.diff

File last-simple.diff, 1.5 KB (added by bmotion, 2 years ago)

More converting from bMotionCache. This time adjusting last_simple

  • modules/variables.tcl

     
    6767  set bMotionCache(randomUser) "" 
    6868  set bMotionCache(lastPlugin) "" 
    6969 
    70   set bMotionCache(last_simple) "" 
     70  bMotion_plugins_settings_set "system" "last_simple" "" "" "" 
    7171 
    7272#this is set later 
    7373set botnicks "" 
  • modules/plugins.tcl

     
    8080## Find a simple plugin 
    8181proc bMotion_plugin_find_simple { text lang } { 
    8282  bMotion_putloglev 3 * "bMotion_plugin_find_simple: text = $text, lang = $lang" 
    83   global bMotion_plugins_simple botnicks bMotionCache 
     83  global bMotion_plugins_simple botnicks 
    8484  set s [lsort [array names bMotion_plugins_simple]] 
    8585 
    8686  foreach key $s { 
     
    9696      if [regexp -nocase $rexp $text] { 
    9797        set c [rand 100] 
    9898        bMotion_putloglev 4 * "simple plugin $key matches" 
    99         if {$bMotionCache(last_simple) == $key} { 
     99        if {[bMotion_plugins_settings_get "system" "last_simple" "" ""] == $key} { 
    100100          bMotion_putloglev 3 * "trying to trigger same simple plugin twice in a row, aborting" 
    101101          return "" 
    102102        } 
    103               set bMotionCache(last_simple) $key 
     103            bMotion_plugins_settings_set "system" "last_simple" "" "" $key 
    104104        if {$chance > $c} { 
    105105          bMotion_putloglev 4 * "  `- firing" 
    106106          return $response