Skip to content

TRIGONIM/ggram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ggram โ€“ Lua Telegram Bot Framework

Create Telegram bots of any complexity in Lua

local ggram = require("ggram")
local bot = ggram("token")

require("ggram.polling").start(bot) -- enables getUpdates loop

bot.command("start", function(ctx)
	ctx.reply.text("Hello @" .. ctx.from.username)
end)

Additional examples can be found in /examples


โœจ Features

  • Can work both on pure Lua, and on the Garry's Mod server
  • Does NOT require any third-party .dll or WEB scripts
  • Very minimalistic and easily expandable
  • If Telegram adds methods that are not already in the bot, they are very easy to add with a 3-line module
  • Possibility for sending animations, documents, images

๐Ÿ› ๏ธ Installation

Docker

Download this repository and go to the downloaded folder. You can take a look at the contents of the Dockerfile. It does not contain ggram itself. It installs the dependencies to make it work.

# create image. You can choose any Dockerfile from this repo
docker build -t ggramenv:latest -f Dockerfile_tarantool .

# run example bot (echo.lua)
# dont forget to change bot token in the file
docker run -it \
	-e "LUA_PATH=/app/lua/?.lua;/app/lua/?/init.lua;;" \
	-v $PWD:/app ggramenv \
	lua app/examples/echo.lua

# ๐ŸŽ‰

Linux / Mac

Install luarocks (package manager like apt but for lua)

sudo apt install luarocks # linux
# or
brew install luarocks # mac

Install ggram

luarocks install ggram

๐Ÿš€ Creating and launching a bot

  1. Create bot.lua file. You can choose any name for the file.
  2. Paste the contents of /examples/echo.lua into the file.
  3. Run file with lua bot.lua. If you want to run a bot on a Garry's Mod server, then read this.
  4. Check out other examples in the /examples folder.

If any error was occur, check the troubleshooting guide

๐Ÿ“š Docs

All the docs are collected here and useful info here

About

๐Ÿค– Lua library for the Telegram bot API. You can even use it in Garry's Mod

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages