c50b1ca3fa
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".
34 lines
582 B
Lua
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
|
|
}
|
|
|