Fixed some bugs
This commit is contained in:
@@ -15,13 +15,19 @@ function getEURUSD(usd)
|
||||
end
|
||||
|
||||
function run(msg, matches)
|
||||
return getEURUSD(matches[1])
|
||||
if matches[1] == "!eur" then
|
||||
return getEURUSD(nil)
|
||||
end
|
||||
return getEURUSD(matches[1])
|
||||
end
|
||||
|
||||
return {
|
||||
description = "EURUSD market value",
|
||||
usage = "!eur [USD]",
|
||||
patterns = {"^!eur (%d+[%d%.]*)$"},
|
||||
patterns = {
|
||||
"^!eur$",
|
||||
"^!eur (%d+[%d%.]*)$",
|
||||
},
|
||||
run = run
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,17 @@ function get_value( value_name )
|
||||
end
|
||||
|
||||
function run(msg, matches)
|
||||
local text = matches[1]
|
||||
return text
|
||||
if matches[1] == "!get" then
|
||||
return get_value(nil)
|
||||
end
|
||||
return get_value(matches[1])
|
||||
end
|
||||
|
||||
return {
|
||||
description = "retrieves variables saved with !set",
|
||||
usage = "!get (value_name)",
|
||||
patterns = {"^!get ?(%a+)?$"},
|
||||
patterns = {
|
||||
"^!get (%a+)$",
|
||||
"^!get$"},
|
||||
run = run
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function save_value( text )
|
||||
var_name, var_value = string.match(text, "(%a+) (.+)")
|
||||
var_name, var_value = string.match(text, "!set (%a+) (.+)")
|
||||
if (var_name == nil or var_value == nil) then
|
||||
return "Usage: !set var_name value"
|
||||
end
|
||||
|
||||
@@ -29,6 +29,6 @@ end
|
||||
return {
|
||||
description = "Sends a tweet",
|
||||
usage = "!tw [text]",
|
||||
patterns = {"!tw (.+)"},
|
||||
patterns = {"^!tw (.+)"},
|
||||
run = run
|
||||
}
|
||||
Reference in New Issue
Block a user