diff options
Diffstat (limited to 'economy.lua')
-rw-r--r-- | economy.lua | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/economy.lua b/economy.lua index 28c9171..e27572b 100644 --- a/economy.lua +++ b/economy.lua @@ -34,28 +34,31 @@ function furrybot.money(money, color) return furrybot.colors.money .. "$" .. money .. color end -function furrybot.commands.money(name, target) - target = target or name - furrybot.ping_message(name, (target == name and "You have " or target .. " has ") .. furrybot.money(furrybot.get_money(target), furrybot.colors.system) .. ".", furrybot.colors.system) -end -furrybot.commands.balance = furrybot.commands.money - -function furrybot.commands.pay(name, target, number) - if furrybot.online_or_error(name, target) then - local money = tonumber(number or "") - if not money or money <= 0 or math.floor(money) ~= money then - furrybot.error_message(name, "Invalid amount of money") - else - if furrybot.take_money(name, money) then - furrybot.add_money(target, money) - furrybot.ping_message(target, name .. " has payed you " .. furrybot.money(money, furrybot.colors.system) .. ".", furrybot.colors.system) +furrybot.commands.money = { + func = function(name, target) + target = target or name + furrybot.ping_message(name, (target == name and "You have " or target .. " has ") .. furrybot.money(furrybot.get_money(target), furrybot.colors.system) .. ".", furrybot.colors.system) + end, +} + +furrybot.commands.pay = { + unsafe = true, + func = function(name, target, number) + if furrybot.online_or_error(name, target) then + local money = tonumber(number or "") + if not money or money <= 0 or math.floor(money) ~= money then + furrybot.error_message(name, "Invalid amount of money") else - furrybot.error_message(name, "You don't have enough money") + if furrybot.take_money(name, money) then + furrybot.add_money(target, money) + furrybot.ping_message(target, name .. " has payed you " .. furrybot.money(money, furrybot.colors.system) .. ".", furrybot.colors.system) + else + furrybot.error_message(name, "You don't have enough money") + end end end - end -end -furrybot.unsafe_commands.pay = true + end, +} return function(_http, _env, _storage) http, env, storage = _http, _env, _storage |