Skip to content

Commit

Permalink
Startmess now takes two arguments, interval and message
Browse files Browse the repository at this point in the history
  • Loading branch information
Zmegolaz committed Apr 5, 2014
1 parent 373e488 commit b26422c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 2 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Command - Description - Requirements
!punish - Take points from a user - Admin
!answer - Get the answer for the last question - OP
!spell <spell> [nick|id] - Cast a spell - Anyone of level 5 or higher
!startmess - Start sending a message every x minutes - Admin
!startmess <interval> <message> - Start sending a message every <interval> 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
Expand Down Expand Up @@ -63,14 +63,13 @@ 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.
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.
5 changes: 0 additions & 5 deletions frogesport-config-EXAMPLE.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions frogesport.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]} {
Expand Down Expand Up @@ -187,6 +187,18 @@ namespace eval ::frogesport {
if {![checkauth $nick]} {
return
}
if {[llength $arg] < 2} {
putserv "NOTICE $nick :!startmess <intervall> <meddelande>"
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
}

Expand Down Expand Up @@ -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 <intervall> <meddelande>"
if {[isop $nick $::frogesport::running_chan]} {
set opcommands ", !answer "
}
Expand Down

0 comments on commit b26422c

Please sign in to comment.