42cda22ab6
partial localization support
30 lines
422 B
Lua
30 lines
422 B
Lua
local PLUGIN = {}
|
|
|
|
PLUGIN.doc = [[
|
|
/hex <number>
|
|
This function converts a number to or from hexadecimal.
|
|
]]
|
|
|
|
PLUGIN.triggers = {
|
|
'^/hex '
|
|
}
|
|
|
|
function PLUGIN.action(msg)
|
|
|
|
local input = get_input(msg.text)
|
|
|
|
if string.sub(input, 1, 2) == '0x' then
|
|
send_msg(msg, tonumber(input))
|
|
|
|
elseif tonumber(input) then
|
|
send_msg(msg, string.format('%x', input))
|
|
|
|
else
|
|
send_msg(msg, locale.inv_arg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return PLUGIN
|