GithubHelp home page GithubHelp logo

rizaumami / tdbot.lua Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 21.0 130 KB

Lua wrapper for telegram-bot

License: GNU General Public License v3.0

Lua 96.30% Shell 3.70%
lua tdbot tdclii telegram-bot telegram-cli

tdbot.lua's People

Contributors

rizaumami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tdbot.lua's Issues

set proxy

hi
you can send to me example for set proxy?
for language lua

setTdlibParameters does not work

hi i wanna change the api id and api hash from the lua-source in tdbot
but ill face this error :
["@type"] = "error",
code = 400,
message = "Unexpected setTdlibParameters"
how can i fix it ?

parse_mode Bug

if i send msg with parse_mode and callback the callback funcation not work
see: https://github.com/rizaumami/tdbot.lua/blob/master/tdbot.lua#L106 and 720 and 1088

assert (tdbot_function (a.tdbody, a.callback or dl_cb, a.data))
    end, {tdbody = tdbody, callback = callback, data = data})

This fix the Bug...

and if you can add split msg by 4096 byte per msg for a long text msg
Thanks You, Amazing Work! ๐Ÿ‘

join channel

hi, how to join channel with id (without link)?

function (importChatInviteLink) not work with channel username.

and how to start one bot with tdbot?

cant use more then 1 text in markDown

when i use more then 1 text in markDown
bot dont send text and crash

here is my code

   if messageText == "test" then
	tdbot.sendText(msg.chat_id,msg.id,'`Test` `Test2`','md')
	end

GetInlineQueryData

hey riza
is there any function to get inlinequery data?
i try everything
this is a vardump of updateNewCallbackQuery
_ = "updateNewCallbackQuery",
chat_id = 87227375,
chat_instance = "-506799303792642479",
id = "374638468114935129",
message_id = 695205888,
_ = "callbackQueryPayloadData",
data = "Z2V0Y2hhdDg3MjI3MzE1"
} --[[table: 0x55ee4cd761b0]],
sender_user_id = 87227375
} --[[table: 0x55ee4cd76e60]]

Problem with nils

Hi Riza, how can i handle all nils so if tdbot got nil don't break the code?

parse_mode Bug

if text have more then 1 parse mode in a text like
<b>test</b> <b>test</b>

bot crash and log is :

[ 1][t 0][1549041921.485059500][clilua.cpp:148][!Td] FAILED TO PARSE LUA: [Error : 0 : Expected Array, got Object]

[ 0][t 0][1549041921.485291243][clilua.cpp:213][!Td] lua: ./tdbot.lua:114: assertion failed!

[pid 81692] [time 1549041921] Signal: 6

Help

how to disable json response print in terminal ?

How to send inline keyboard button via "replyMarkupInlineKeyboard" in bot (API) mode

Hi,
Can you give an example that explain how to send inline keyboard button via "replyMarkupInlineKeyboard" (on sendMessage method) in bot (API) mode ?

The new update of tdlib supports API, so it should work.

I use the code below, but it returns error that says:
[ 1][t 0][1533544806.054300547][clilua.cpp:148][!Td] FAILED TO PARSE LUA: [Error : 0 : Expected array, got JsonObject]
[ 0][t 0][1533496321.609632015][clilua.cpp:186][!Td] lua: ./bot.lua:51: assertion failed!

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
        assert(tdbot_function({
          ["@type"]="sendMessage",
          chat_id=msg.chat_id,
          reply_to_message_id=msg.id,
          disable_notification=false,
          from_background=true,
          reply_markup={
            ["@type"]="replyMarkupInlineKeyboard",
            rows={
              {
                text="example",
                type={
                  ["@type"]="inlineKeyboardButtonTypeUrl",
                  url="https://example.com"
                }
              }
            }
          },
          input_message_content={
            ["@type"]="inputMessageText",
            text={text="pong"},
            disable_web_page_preview=true,
            clear_draft=false,
            entities={},
            parse_mode=nil
          }
        },dl_cb, nil))
      end
    end
  end
end

So what's the problem?!
Tnx

How to use replay_markup

hi,

how can i use replay_markup in bot ?

its not working :

assert (tdbot_function ({
  _ = "sendMessage",
  chat_id = math.ceil(msg.chat_id),
  reply_to_message_id = 0,
  disable_notification=false,
  from_background=true,
  reply_markup={
      _ = "replyMarkupShowKeyboard",
      resize_keyboard = true,
	  rows ={
        {
          [0] = {
            _ = "keyboardButton",
            text = "bottom1",
            type = {
              _ = "keyboardButtonTypeText"
            }
          }
        },
        {
          [0] = {
            _ = "keyboardButton",
            text = "bottom2",
            type = {
              _ = "keyboardButtonTypeText"
            }
          }
        },
	  },
 },
  input_message_content={
    _="inputMessageText",
    text= "itsok",
    disable_web_page_preview=true,
    clear_draft=false,
    entities={},
    parse_mode=MarkDown}
  }, dl_cb, nil))

ty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.