This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/plugins/luarun.lua
topkecleon c50b1ca3fa Username cachine and various fixes.
Usernames seen by the bot are now cached in the $usernames table. To get the ID associated with a
username, use the resolve_username() function from utilities.lua.
The table_size() function in utilities.lua will tell you the number of items in a key/pair table.
about.lua no longer displays a link preview in the about message.
currency.lua now accepts decimal arguments for the amount.
luarun.lua now correctly displays "false" return values.
moderation.lua will no longer send "I do not administrate this group".
2016-01-12 05:22:28 -05:00

34 lines
582 B
Lua

local triggers = {
'^/lua[@'..bot.username..']*'
}
local action = function(msg)
if msg.from.id ~= config.admin then
return
end
local input = msg.text:input()
if not input then
sendReply(msg, 'Please enter a string to load.')
return
end
local output = loadstring(input)()
if output == nil then
output = 'Done!'
elseif type(output) == 'table' then
output = 'Done! Table returned.'
else
output = '```\n' .. tostring(output) .. '\n```'
end
sendMessage(msg.chat.id, output, true, msg.message_id, true)
end
return {
action = action,
triggers = triggers
}