• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

rizaumami/tdcli.lua: A simple Lua library for the telegram-cli

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

rizaumami/tdcli.lua

开源软件地址(OpenSource Url):

https://github.com/rizaumami/tdcli.lua

开源编程语言(OpenSource Language):

Lua 100.0%

开源软件介绍(OpenSource Introduction):

tdcli.lua

A simple Lua library for the telegram-cli.

See wiki for documentation.

How to Use

  • luarocks install tdcli.lua
  • Import tdcli.lua into your bot.
  • Call the functions.

See example script below.

-- Load tdcli library.
tdcli = require 'tdcli'

-- An alias to sendText
function sendText(chat_id, reply_to_message_id, text, disable_web_page_preview, parse_mode)
  local parse_mode = parse_mode or 'HTML'
  local disable_web_page_preview = disable_web_page_preview or 1
  tdcli.sendText(chat_id, reply_to_message_id, 0, 1, nil, text, disable_web_page_preview, parse_mode)
end

function tdcli_update_callback(data)
  if (data.ID == "UpdateNewMessage") then
    local msg = data.message_
    local input = msg.content_.text_
    local chat_id = msg.chat_id_
    local user_id = msg.sender_user_id_
    -- If the message is text message
    if msg.content_.ID == "MessageText" then
      -- And the text is...
      if input == "ping" then
        -- Reply with unformatted text
        sendText(chat_id, msg.id_, 'pong')
      -- And if the text is...
      elseif input == "PING" then
        -- Reply with formatted text
        sendText(user_id, 0, '*PONG*', 1, 'Markdown')
      end
    end
  elseif (data.ID == "UpdateOption" and data.name_ == "my_id") then
    tdcli_function ({
      ID="GetChats",
      offset_order_="9223372036854775807",
      offset_chat_id_=0,
      limit_=20
    }, dl_cb, nil)
  end
end

The Functions

tdcli.lua is a Work In Progress. This commit is based on telegram-cli-1222.tl scheme. Here is a list of functions that's should works, and what left to be tested.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap