GithubHelp home page GithubHelp logo

cloudxtreme / lua-telegram-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ldb/lua-telegram-bot

0.0 1.0 0.0 31 KB

A simple LUA Framework for Telegram Bot API

License: GNU General Public License v3.0

Lua 100.00%

lua-telegram-bot's Introduction

lua-telegram-bot

A simple LUA Framework for the Telegram Bot API

Installing

To install this module, place it inside the same folder your bot is located.

This modules requires luasec to work. You can easily install it with luarocks using luarocks install luasec.

You will also need a Module for JSON en- and decoding, which can be found here. Simply place it in the lua-telegram-bot Folder.

Using

To use this module, import it into your bot like this:

local bot = (require "lua-bot-api").configure(token)

Include your bot token as parameter for configure().

At the moment, only getUpdates method (aka polling) is supported, no webhooks.

The bot Table exports variables and functions which return the following return values:

Return values

All functions return a table as received from the server if called successfully as their first return value. This does not mean the request was successful, for example in case of a bad offset in getUpdates().

A function returns nil and an error description if it was wrongly called (missing parameters).

Variables

id
username
first_name

Functions

getMe()
getUpdates([offset] [,limit] [,timeout])
sendMessage(chat_id, text [,parse_mode] [,disable_web_page_preview] [,reply_to_message_id] [,reply_markup])
forwardMessage(chat_id, from_chat_id, message_id)
sendPhoto(chat_id, photo, caption [,reply_to_message_id] [,reply_markup])
sendAudio(chat_id, audio, duration [,performer] [,title] [,reply_to_message_id] [,reply_markup])
sendDocument(chat_id, document [,reply_to_message_id] [,reply_markup])
sendSticker(chat_id, sticker [,reply_to_message_id] [,reply_markup])
sendVideo(chat_id, video [,duration] [,caption] [,reply_to_message_id] [,reply_markup])
sendVoice(chat_id, voice [,duration] [,reply_to_message_id] [,reply_markup])
sendLocation(chat_id, latitude, longitude [,reply_to_message_id] [,reply_markup])
sendChatAction(chat_id, action)
getUserProfilePhotos(user_id [,offset] [,limit])
getFile(file_id)
answerInlineQuery(inline_query_id, results [,cache_time] [,is_personal] [,next_offset])

Helper functions:

downloadFile(file_id [,download_path])
  • Downloads file from Telegram Servers.
  • download_path is an optional path where the file can be saved. If not specified, it will be saved in /downloads/<filenameByTelegram>. In both cases make sure the path already exists, since LUA can not create folders without additional modules.
generateReplyKeyboardMarkup(keyboard [,resize_keyboard] [,one_time_keyboard] [,selective])
  • Generates a ReplyKeyboardMarkup of type reply_markup which can be sent optionally in other functions such as sendMessage().
  • Displays the custom keyboard on the receivers device.
generateReplyKeyboardHide([hide_keyboard] [,selective])
  • Generates a ReplyKeyboardHide of type reply_markup which can be sent optionally in other functions such as sendMessage().
  • Forces to hide the custom keyboard on the receivers device.
  • hide_keyboard can be left out, as it is always true.
generateForceReply([force_reply] [,selective])
  • Generates a ForceReply of type reply_markup which can be sent optionally in other functions such as sendMessage().
  • Forces to reply to the corresponding message from the receivers device.
  • force_reply can be left out, as it is always true.

lua-telegram-bot's People

Contributors

cosmonawt avatar

Watchers

 avatar

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.