diff --git a/README.md b/README.md index c9e4992..0620728 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ otouto (including all plugins and documentation) is free software; you are free | [List of plugins](#list-of-plugins) | [Contributors](#contributors) | ## Setup -You _must_ have Lua (5.2+), luasocket, luasec, multipart-post, and dkjson installed. You should also have lpeg, though it is not required. It is recommended you install these with LuaRocks. +You _must_ have Lua 5.3, luasocket, luasec, multipart-post, and dkjson installed. You should also have lpeg, though it is not required. It is recommended you install these with LuaRocks. To get started, clone the repository and set the following values in `config.lua`: diff --git a/install-dependencies.sh b/install-dependencies.sh new file mode 100644 index 0000000..9ccc4cf --- /dev/null +++ b/install-dependencies.sh @@ -0,0 +1,22 @@ +# This script will attempt to install Lua 5.3, Luarocks (pointed at 5.3), and +# the rocks necssary to run otouto. This script targets Ubuntu 16.04; it will +# probably not work on any earlier version of Ubuntu. + +#!/bin/sh +echo 'Requesting root privileges to install necessary packages:' +echo 'lua5.3 liblua5.3-dev git libssl-dev fortune-mod fortunes' +sudo apt-get update +sudo apt-get install -y lua5.3 liblua5.3-dev git libssl-dev fortune-mod fortunes +git clone http://github.com/keplerproject/luarocks +cd luarocks +./configure --lua-version=5.3 --versioned-rocks-dir --lua-suffix=5.3 +make build +sudo make install +sudo luarocks-5.3 install luasocket +sudo luarocks-5.3 install luasec +sudo luarocks-5.3 install multipart-post +sudo luarocks-5.3 install lpeg +sudo luarocks-5.3 install dkjson +cd .. +echo 'Finished. Use ./launch to start otouto.' +echo 'Be sure to set your bot token in config.lua.' diff --git a/launch.sh b/launch.sh index 6f6f5f2..e9885ea 100755 --- a/launch.sh +++ b/launch.sh @@ -1,7 +1,13 @@ #!/bin/sh -while true; do - lua main.lua - echo 'otouto has stopped. ^C to exit.' - sleep 5s -done +# Ubuntu 16.04 seems to not link "lua" to lua5.3. +if type lua5.3 >/dev/null 2>/dev/null; then + while true; do + lua5.3 main.lua + echo 'otouto has stopped. ^C to exit.' + sleep 5s + done +else + echo 'Lua 5.3 was not found.' + exit +fi diff --git a/otouto/bot.lua b/otouto/bot.lua index 9f15e8f..4b6a955 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -27,6 +27,8 @@ bot.version = '3.13' -- Function to be run on start and reload. function bot:init(config) + assert(config.bot_api_key, 'You didn\'t set your bot token in config.lua!') + bindings = require('otouto.bindings').init(config.bot_api_key) utilities = require('otouto.utilities') diff --git a/otouto/plugins/administration.lua b/otouto/plugins/administration.lua index 67d1f14..a801a12 100644 --- a/otouto/plugins/administration.lua +++ b/otouto/plugins/administration.lua @@ -1066,7 +1066,7 @@ function administration.init_command(self_, config_) command = 'alist', privilege = 3, - interior = true, + interior = false, doc = 'Returns a list of administrators. Owner is denoted with a star character.', action = function(self, msg, group, config) diff --git a/otouto/plugins/luarun.lua b/otouto/plugins/luarun.lua index 817c6cb..1e5e230 100644 --- a/otouto/plugins/luarun.lua +++ b/otouto/plugins/luarun.lua @@ -36,7 +36,7 @@ function luarun:action(msg, config) end local output, success = - loadstring("local bot = require('otouto.bot')\n\z + load("local bot = require('otouto.bot')\n\z local bindings = require('otouto.bindings')\n\z local utilities = require('otouto.utilities')\n\z local drua = require('otouto.drua-tg')\n\z diff --git a/tg-install.sh b/tg-install.sh index a78b911..9586a78 100755 --- a/tg-install.sh +++ b/tg-install.sh @@ -5,11 +5,12 @@ # alternative), figure it out yourself. echo 'Requesting root privileges to install necessary packages:' -echo 'libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make' -sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make -echo 'Compiling tg, test branch.' +echo 'git libreadline-dev libssl-dev libevent-dev make' +sudo apt-get update +sudo apt-get install -y git libreadline-dev libssl-dev libevent-dev make git clone http://github.com/vysheng/tg --recursive -b test cd tg -./configure +./configure --disable-libconfig --disable-liblua --disable-json make -echo 'All done! Use ./tg-launch.sh to launch tg. Be sure to log in with your Telegram account.' +echo 'All done! Use ./tg-launch.sh to launch tg.' +echo 'Be sure to log in with your Telegram account.'