vk-luvit

VK Bot API wrapper for luvit

MIT License

Stars
4
Committers
1

vk-luvit

VK API.

luvit.

:

  • VK API.
    
  • .
  • VK API.
    
  • .

:

  • luvit.
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 Reference:

VK(token[, version])

   VK API.

  • token string|table . , .
  • version string (optional) VK API. '5.131'.

vk:request(method[, params])

vk(method[, params])

VK API. , , nil .

VK API [](https://dev.vk.com/method)

  • method string .
  • params table (optional) .

API Reference:

API(options)

  • VK. .

  • options string|table . / , -.
  • options.token string|table . , .
  • options.version string (optional) VK API. '5.131'.
  • options.queued boolean (optional) true, api.execute . 500 .
    • false.

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 Reference:

Bot(options)

  • VK. .

  • options string|table . / , -.
  • options.token string|table . , .
  • options.version string (optional) VK API. '5.131'.
  • options.queued boolean (optional) true, api.execute . 500 .
    • false.

bot:run()

.

bot:stop()

. : VK API.

bot.api

API .

bot.on.event_name([filter,] func)


  • filter function (optional) -. filter(event). , -, nil, - . , .
  • func function -, , , nil. filter.

Keyboard Reference:

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 .