diff weather.tcl @ 273:38a5bce4b078

weather: Move configuration to separate file.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 Jan 2015 11:12:36 +0200
parents 82833838924e
children f6dc673adfa1
line wrap: on
line diff
--- a/weather.tcl	Fri Jan 23 11:01:53 2015 +0200
+++ b/weather.tcl	Fri Jan 23 11:12:36 2015 +0200
@@ -10,61 +10,10 @@
 #
 ##########################################################################
 
-# Channels where weather functionality is enabled
-# set weather_channels "#foobar;#baz"
-# You can use * to match substrings or everything
-set weather_channels "*"
-
-# Default location if none given and none set by user.
-# Multiple can be specified as "foo;bar;etc"
-set weather_default_locations "raahe lapaluoto;tie 8 pattijoki"
-
-# Weather data file, must match the one in fetch_weather.pl's config
-set weather_datafile "/home/niinuska/bot/weather.data"
-
-# Alias data file
-set weather_aliasfile "/home/niinuska/bot/weather.alias"
-
-# How often to check the weather data file for updates (in minutes)
-set weather_check_period 2
-
-# Max number of results to be listed
-set weather_max_results 3
-
-# ...
-set weather_logmsg 1
-set weather_preferredmsg "PRIVMSG"
-
-
-###
-### Messages
-###
-set weather_msg_usage_prefix_1 "Käyttö: !sää "
-set weather_msg_usage_prefix_2 "        !sää "
-
-set weather_msg_usage_def_set "vakio <paikka>\[;<paikka2>\] -- asettaa vakiohavaintoaseman\nvakio -- näyttää nykyisen"
-set weather_msg_usage_alias "alias <alias> = <nimi> (Lisää alias-nimen, esim. alias perse = turku)"
-set weather_msg_usage_unalias "unalias <alias> (Poistaa aliaksen)"
-
-set weather_msg_usage_stations "asemat <patterni> -- listaa mittausasemat joiden nimi matsaa patternin kanssa"
-
-set weather_msg_usage_full "\[paikka\]\n$weather_msg_usage_def_set\n$weather_msg_usage_alias\n$weather_msg_usage_unalias\n$weather_msg_usage_stations"
-
-set weather_msg_def_set "Vakio-havaintoasemiksi asetettu: \002%1\002."
-set weather_msg_defloc "Käyttäjän \002%1\002 vakio-havaintoasemat ovat: \002%2\002."
-set weather_msg_def_not_set "Vakio-havaintoasemia ei asetettu käyttäjälle \002%1\002."
-
-set weather_msg_aliased "Aliasoitiin \002%1\002 = \002%2\002."
-set weather_msg_unaliased "Unaliasoitiin \002%1\002."
-set weather_msg_aliases "Aliakset: %1"
-
-set weather_msg_user_not_known "Tuntematon käyttäjä."
-set weather_msg_no_access "Ei oikeuksia muuttaa asetuksia."
-
-set weather_msg_stations "Mittausasemat: %1"
-
-set weather_msg_no_results "\002%1\002: Ei mittaustietoja."
-set weather_msg_no_data_for_location "\002%1\002: Paikkakunnan tietoja ei saatu."
+### The configuration should be in config.weather in same directory
+### as this script. Or change the line below to point where ever
+### you wish. See "config.weather.example" for an example config file.
+source [file dirname [info script]]/config.weather
 
 
 ##########################################################################
@@ -74,13 +23,6 @@
 set weather_version "0.9"
 
 
-### Binding initializations
-bind pub - !sää weather_cmd_pub
-bind pub - !saa weather_cmd_pub
-bind msg - !sää weather_cmd_msg
-bind msg - !saa weather_cmd_msg
-
-
 ### Initialization messages
 package require textutil::split
 set weather_message "$weather_name v$weather_version by ccr/TNSP"
@@ -356,7 +298,7 @@
     set res [join $result " ; "]
     weather_msg $upublic $unick $uchan $weather_msg_stations [list $res]
     return 0
-  } elseif {$rarg == "vakio" || $rarg == "default" || $rarg == "vakiot"} {
+  } elseif {$rarg == "vakio" || $rarg == "default" || $rarg == "vakiot" || $rarg == "defaults"} {
     # List or set the default weather station name patterns for this user
 
     # Access check