From b26422c2d8bf2d070e56855ec0e5eace4004bb98 Mon Sep 17 00:00:00 2001 From: Zmegolaz Date: Sat, 5 Apr 2014 10:30:54 +0200 Subject: [PATCH] Startmess now takes two arguments, interval and message --- CHANGELOG | 3 +++ README | 5 ++--- frogesport-config-EXAMPLE.tcl | 5 ----- frogesport.tcl | 16 ++++++++++++++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 000a3d8..cb772a8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.2 - 2014-04-05 + Changes + * !startmess now takes two arguments, interval and message, instead of them having to be configured in hte config file. Version 1.6.1 - 2014-03-31 Features * You can now use !topkpm and !topfast to see the top lists of the respective columns. diff --git a/README b/README index 832691f..b658b8e 100644 --- a/README +++ b/README @@ -35,7 +35,7 @@ Command - Description - Requirements !punish - Take points from a user - Admin !answer - Get the answer for the last question - OP !spell [nick|id] - Cast a spell - Anyone of level 5 or higher -!startmess - Start sending a message every x minutes - Admin +!startmess - Start sending a message every minutes - Admin !stats [nick] - Check the stats for someone, if [nick] is omitted, you will get your own stats - Anyone !stopmess - Stop sending a message every x minutes - Admin !recommend - Get help about how to recommend questions - Anyone @@ -63,8 +63,8 @@ Newseason should save the old table as users_unixtime. Newseason should remove inactive users with low (configurable) total points. Newseason should reset the mana too. Send some kind of message if someone tries to compare a user to the same user. -Translate everything to English. Move all text to a separate file for easier translations. +Translate everything to English. Documentation. Logg all user/question modifications. Happy hour. @@ -72,5 +72,4 @@ Config sanity check. Separate the help, stats and similar from the question asking. Best time per question. Number of times a question is asked, and number of times it was answered correctly. -Characters per second. Different points for different questions. diff --git a/frogesport-config-EXAMPLE.tcl b/frogesport-config-EXAMPLE.tcl index ff0ad42..d9b96bb 100644 --- a/frogesport-config-EXAMPLE.tcl +++ b/frogesport-config-EXAMPLE.tcl @@ -93,11 +93,6 @@ variable recommend_show "7" # How many seconds has to pass between each ping command? variable s_pinginterval "10" -# The bot can send periodic messages to the channel, for example to tell people why it is down. What should that message be? -variable periodic_message "Frogesport is down because of database maintenance." -# How often? In minutes. -variable s_periodic_message "1" - # Text color: variable color_text "00" # Text background color diff --git a/frogesport.tcl b/frogesport.tcl index 3e322cc..27dec4f 100644 --- a/frogesport.tcl +++ b/frogesport.tcl @@ -87,7 +87,7 @@ bind msg * "f package require mysqltcl namespace eval ::frogesport { - variable version "1.6" + variable version "1.6.2" # Include the config file if {[file exists scripts/frogesport/frogesport-config.tcl]} { @@ -187,6 +187,18 @@ namespace eval ::frogesport { if {![checkauth $nick]} { return } + if {[llength $arg] < 2} { + putserv "NOTICE $nick :!startmess " + return + } + # Stop the previous message if it's already running + if {[info exists ::frogesport::messageId]} { + after cancel $::frogesport::messageId + } + # How often? In minutes. + variable s_periodic_message [lindex $arg 0] + # What should the message be? + variable periodic_message [lrange $arg 1 end] sendmess } @@ -1000,7 +1012,7 @@ namespace eval ::frogesport { # Give the user help proc help { nick host hand chan arg } { # If the user is OP, give it the op commands too - set opcommands "" + set opcommands ", !startmess " if {[isop $nick $::frogesport::running_chan]} { set opcommands ", !answer " }