diff --git a/plugins/rechner.lua b/plugins/rechner.lua new file mode 100644 index 0000000..67f9812 --- /dev/null +++ b/plugins/rechner.lua @@ -0,0 +1,14 @@ +function run(msg, matches) + -- Convert expression to a function and execute it + local expression = string.gsub(matches[1], "(%a+)", "math.%1") + return load('return '..expression)() +end + +return { + description = "Ein simpler Taschenrechner", + usage = "/calc [Rechnung]", + patterns = { + "^/calc (.*)$" + }, + run = run +} \ No newline at end of file