Skip to content

Latest commit

 

History

History
287 lines (275 loc) · 22.1 KB

README.md

File metadata and controls

287 lines (275 loc) · 22.1 KB

tdbot.lua

A simple Lua wrapper for telegram-bot.

See wiki for documentation.

How to Use

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

See example script below.

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

-- An alias to sendText
function sendText(chat_id, reply_to_message_id, text)
  tdbot.sendText(chat_id, reply_to_message_id, text, 0, 1, nil, 1, 'html', 0, nil)
end

function tdbot_update_callback (data)
  if (data._ == "updateNewMessage") then
    local msg = data.message

    if msg.content._ == "messageText" then
      if msg.content.text == "ping" then
          sendText(chat_id, msg.id, '<b>pong!</b>')
        }, dl_cb, nil))
      end
    end
  end
end

The Functions

tdbot.lua is a Work In Progress. This commit is based on telegram-bot-171023-nightly.tl scheme.
Here is a list of telegram-bot methods. Checked functions has been tested and works or returned "ok".