VK API.
VK API.
VK API.
lit install Laminariy/vk-luvit
local Bot = require("vk-luvit").Bot
local bot = Bot('Your token')
bot.on.message_new(function(event)
bot.api.messages.send({
peer_id = event.message.from_id,
random_id = 0,
message = event.message.text
})
end)
bot:run()
VK(token[, version])
VK API.
token
string|table . , .version
string (optional) VK API. '5.131'.VK API. , , nil .
VK API [](https://dev.vk.com/method)
method
string .params
table (optional) .API(options)
options
string|table . / , -.options.token
string|table . , .options.version
string (optional) VK API. '5.131'.options.queued
boolean (optional) true, api.execute . 500 .
api.method([params])
VK API, method - . camelCase snake_case.
VK API [](https://dev.vk.com/method)
params
table (optional) . local API = require('vk-luvit').API
local api = API('Your token')
-- camelCase
api.groups.getById()
-- snake_case
api.groups.get_by_id()
Bot(options)
options
string|table . / , -.options.token
string|table . , .options.version
string (optional) VK API. '5.131'.options.queued
boolean (optional) true, api.execute . 500 .
bot:run()
.
bot:stop()
. : VK API.
bot.api
API .
bot.on.event_name([filter,] func)
Bot LongPoll event_name - . VK API
'all', -.
filter
function (optional) -. filter(event). , -, nil, - . , .func
function -, , , nil. filter.Keyboard([one_time, inline])
one_time
boolean (optional) true, .inline
boolean (optional) true, .keyboard:button(action[, color])
.
action
table .color
string (optional) .keyboard:row()
.
keyboard:clear()
.
keyboard:get()
JSON .