Show
Ignore:
Timestamp:
07/29/07 17:18:19 (18 months ago)
Author:
james
Message:

beautify the sample config file
add stats settings to sample config
let config override stats module (#133)
write some help for the stats module admin

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/extra/stats.tcl

    r782 r834  
    2626## /JMS 
    2727 
    28 ### CONFIG 
     28### CONFIG: now set in settings.tcl; this bit just sets the defaults 
     29### Don't change these any more, edit your settings file :) 
    2930 
    3031## enable sending of stats etc 
    31 set bMotion_stats_enabled 0 
     32if {![info exists bMotion_stats_enabled]} { 
     33        set bMotion_stats_enabled 0 
     34} 
    3235 
    3336## enable version checking (doesn't need stats to be sent) 
    34 set bMotion_stats_version 0 
     37if {![info exists bMotion_stats_version]} { 
     38        set bMotion_stats_version 0 
     39} 
    3540 
    3641 
    3742## what can we send (if stats_enabled is 1) 
    3843# this is the bot's nick 
    39 set bMotion_stats_send(botnick) 1 
    40 # the admin info ('admin' in config) 
    41 set bMotion_stats_send(admin) 1 
    42 # the network name ('network' in config) 
    43 set bMotion_stats_send(network) 1 
    44 # bmotion's gender/orientation 
    45 set bMotion_stats_send(bminfo) 1 
     44if {![info exists bMotion_stats_send]} { 
     45        set bMotion_stats_send(botnick) 1 
     46        # the admin info ('admin' in config) 
     47        set bMotion_stats_send(admin) 1 
     48        # the network name ('network' in config) 
     49        set bMotion_stats_send(network) 1 
     50        # bmotion's gender/orientation 
     51        set bMotion_stats_send(bminfo) 1 
     52} 
    4653 
    4754### END USER CONFIG 
     
    341348 
    342349                if {$bMotion_stats_time > 0} { 
    343                         bMotion_putadmin "  last stats run was [expr [clock seconds] - $bMotion_stats_time] seconds ago" 
     350                        bMotion_putadmin "  last stats run was [expr [clock seconds] - $bMotion_stats_time] seconds ago ([clock format $bMotion_stats_time])" 
    344351                } else { 
    345352                        bMotion_putadmin "  last stats run never or unknown" 
     
    364371        } 
    365372} 
     373 
     374proc bMotion_stats_help { } { 
     375        bMotion_putadmin "Interact with the stats module." 
     376        bMotion_putadmin "  .bmotion stats status" 
     377        bMotion_putadmin "    Show the status of the stats module, including if it's enabled," 
     378        bMotion_putadmin "    if it's checking for updates, your bots unique ID, when the last" 
     379        bMotion_putadmin "    stats run took place, and when the next one will." 
     380        bMotion_putadmin "  .bmotion stats go" 
     381        bMotion_putadmin "    Immediately perform a stats run (if needed)" 
     382        bMotion_putadmin "(See settings.tcl and modules/extra/stats.tcl for config and information." 
     383} 
     384 
    366385if {$bMotion_testing == 0} { 
    367         bMotion_plugin_add_management "stats" "^stats" n bMotion_stats_admin "any" 
     386        bMotion_plugin_add_management "stats" "^stats" n bMotion_stats_admin "any" "bMotion_stats_help" 
    368387} 
    369388