tdbot.lua icon indicating copy to clipboard operation
tdbot.lua copied to clipboard

Lua wrapper for telegram-bot

tdbot.lua

A simple Lua wrapper for tdbot.

See wiki for documentation.

How to Use

  • Put tdbot.lua on a same directory level with the bot script
  • Import tdbot.lua into the bot.
  • Call the functions.

See example script below.

-- Load tdbot library.
local tdbot = require 'tdbot'

function tdbot_update_callback (data)
  if (data["@type"] == "updateNewMessage") then
    local msg = data.message

    if msg.content["@type"] == "messageText" then
      if msg.content.text.text == "ping" then
        tdbot.sendText(msg.chat_id, msg.id, '<b>pong!</b>', 'html')
      end
    end
  end
end

The Functions

tdbot.lua is a Work In Progress. This commit is based on:

  • tdbot commit https://github.com/vysheng/tdbot/commit/a838e8768f1c405306975763d59d48ca9f347805
  • td_api.tl from td commit https://github.com/tdlib/td/commit/cfe4d9bdcee9305632eb228a46a95407d05b5c7a

Here is a list of tdbot methods. Checked functions has been tested and works or at least returned "ok".