Browse Source

coin: wrap an if statement

tags/v0.9
Přemysl Janouch 5 years ago
parent
commit
e8ddf5e58c
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      plugins/coin

+ 5
- 1
plugins/coin View File

@@ -97,7 +97,11 @@ while {[gets stdin line] != -1} {
set input [string range $input [string length $prefix] end]

if {$input == "coin"} {
if {rand() < 0.5} { pmrespond "Heads." } else { pmrespond "Tails." }
if {rand() < 0.5} {
pmrespond "Heads."
} else {
pmrespond "Tails."
}
} elseif {[regexp {^dice( +|$)(.*)} $input -> _ args]} {
if {! [string is integer -strict $args] || $args <= 0} {
pmrespond "Invalid or missing number."

Loading…
Cancel
Save