50 lines
1.3 KiB
Org Mode
50 lines
1.3 KiB
Org Mode
* Computer bot
|
|
|
|
Original is *[[https://gitdab.com/er2/comp-tg][here]]* and on my private server.
|
|
Mirrors can update irregularly.
|
|
|
|
-----
|
|
|
|
This is a bot for Telegram.
|
|
It haven't got much possibilities,
|
|
but this code can be used in other bots.
|
|
|
|
Bot can use locale of Telegram client (unlike much bots)
|
|
and use it or fallback to English.
|
|
|
|
Bot uses an OOP-style of Lua
|
|
as [[https://is.gd/f0Vadk][described on Wikipedia]].
|
|
|
|
For more readability bot's userland written in MoonScript.
|
|
|
|
Maybe I will rewrite bot's core to C but here already so many Lua code.
|
|
|
|
* Installation
|
|
|
|
[[https://alpinelinux.org][Alpine linux]], root:
|
|
|
|
+ Enable community repo (described in wiki)
|
|
|
|
+ Install lua and tools: ~apk add doas git lua5.3-dev luarocks musl-dev gcc openssl-dev~
|
|
|
|
+ Install LuaSec for https requests: ~luarocks-5.3 install luasec~
|
|
|
|
+ Install MoonScript: ~luarocks-5.1 install moonscript~
|
|
|
|
+ Create user: ~adduser user~
|
|
|
|
setup it (add to doas) and login to this user
|
|
|
|
+ Clone repo: ~git clone --recursive https://gitdab.com/er2/comp-tg~
|
|
|
|
and enter ~cd comp-tg~
|
|
|
|
+ Change token and owner in *config.lua*
|
|
|
|
+ Compile bot: ~moonc src/~
|
|
|
|
+ Add service ~doas cp bot.rc /etc/init.d/mybot && doas chmod +x /etc/init.d/mybot~
|
|
|
|
+ Configure it ~doas vi /etc/init.d/mybot~ (change user)
|
|
|
|
+ Start it ~doas service mybot start~
|