diff --git a/launch.sh b/launch.sh index fccd6c2..10c027a 100755 --- a/launch.sh +++ b/launch.sh @@ -1,8 +1,8 @@ #!/bin/sh -# Launch Brawlbot -# Restart Brawlbot five seconds after halted. +# Launch Mikubot +# Restart Mikubot five seconds after halted. while true; do lua main.lua - echo 'Miku wurde gestoppt. ^C zum beenden.' + echo 'Mikubot wurde gestoppt. ^C zum beenden.' sleep 5s done \ No newline at end of file diff --git a/miku/bot.lua b/miku/bot.lua index 98d2b7b..0b20fc8 100644 --- a/miku/bot.lua +++ b/miku/bot.lua @@ -23,14 +23,9 @@ local bot = {} bot.version = '160824' function bot:init(config) -- The function run when the bot is started or reloaded. -<<<<<<< HEAD:miku/bot.lua + assert(config.bot_api_key, 'Dein Bot-Token ist nicht in der Config gesetzt!') bindings = require('miku.bindings').init(config.bot_api_key) utilities = require('miku.utilities') -======= - assert(config.bot_api_key, 'Dein Bot-Token ist nicht in der Config gesetzt!') - bindings = require('otouto.bindings').init(config.bot_api_key) - utilities = require('otouto.utilities') ->>>>>>> upstream/master:otouto/bot.lua cred_data = load_cred() -- Fetch bot information. Try until it succeeds. diff --git a/miku/plugins/banhammer.lua b/miku/plugins/banhammer.lua index c100a4b..e3d2884 100644 --- a/miku/plugins/banhammer.lua +++ b/miku/plugins/banhammer.lua @@ -155,14 +155,10 @@ function banhammer:pre_process(msg, config) end else if not has_been_warned then -<<<<<<< HEAD:miku/plugins/banhammer.lua - utilities.send_reply(msg, "Dies ist ein privater Bot, der erst nach einer Freischaltung benutzt werden kann.\nThis is a private bot, which can only be used after an approval.") -======= utilities.send_reply(msg, config.banhammer_text or [[ Dies ist ein privater Bot, der erst nach einer Freischaltung benutzt werden kann. This is a private bot, which can only be used after an approval. ]]) ->>>>>>> upstream/master:otouto/plugins/banhammer.lua redis:hset('user:'..user_id, 'has_been_warned', true) else print('User has already been warned!') diff --git a/miku/plugins/cleverbot.lua b/miku/plugins/cleverbot.lua index f9bbac3..6b052eb 100644 --- a/miku/plugins/cleverbot.lua +++ b/miku/plugins/cleverbot.lua @@ -2,15 +2,9 @@ local cleverbot = {} function cleverbot:init(config) cleverbot.triggers = { -<<<<<<< HEAD:miku/plugins/cleverbot.lua "^/[Cc][Bb][Oo][Tt] (.*)$", "^[Mm][Ii][Kk][Uu][Bb][Oo][Tt], (.+)$", "^[Mm][Ii][Kk][Uu], (.+)$" -======= - "^/cbot (.+)$", - "^[Bb]rawlbot, (.+)$", - "^[Bb]ot, (.+)$" ->>>>>>> upstream/master:otouto/plugins/cleverbot.lua } cleverbot.url = config.chatter.cleverbot_api end diff --git a/miku/plugins/luarun.lua b/miku/plugins/luarun.lua index 131dc48..d4fb843 100644 --- a/miku/plugins/luarun.lua +++ b/miku/plugins/luarun.lua @@ -1,66 +1,6 @@ -<<<<<<< HEAD:miku/plugins/luarun.lua -local luarun = {} - -function luarun:init(config) - luarun.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('lua', true):t('return', true).table - if config.luarun_serpent then - serpent = require('serpent') - luarun.serialize = function(t) - return serpent.block(t, {comment=false}) - end - else - JSON = require('dkjson') - luarun.serialize = function(t) - return JSON.encode(t, {indent=true}) - end - end -end - -function luarun:action(msg, config) - - if not is_sudo(msg, config) then - return true - end - - local input = utilities.input(msg.text) - if not input then - utilities.send_reply(msg, 'Bitte gebe einen Befehl ein.') - return - end - - if msg.text_lower:match('^'..config.cmd_pat..'return') then - input = 'return ' .. input - end - - local output = loadstring( [[ - local bot = require('miku.bot') - local bindings = require('miku.bindings') - local utilities = require('miku.utilities') - local json = require('dkjson') - local URL = require('socket.url') - local http = require('socket.http') - local https = require('ssl.https') - return function (msg, config) ]] .. input .. [[ end - ]] )()(msg, config) - if output == nil then - output = 'Ausgeführt!' - else - if type(output) == 'table' then - local s = luarun.serialize(output) - if URL.escape(s):len() < 4000 then - output = s - end - end - output = '```\n' .. tostring(output) .. '\n```' - end - utilities.send_message(msg.chat.id, output, true, msg.message_id, true) - -end - -======= -local luarun = {} +local luarun = {} -local utilities = require('otouto.utilities') +local utilities = require('miku.utilities') local URL = require('socket.url') local JSON, serpent @@ -96,9 +36,9 @@ function luarun:action(msg, config) end local output, success = - load("local bot = require('otouto.bot')\n\z - local bindings = require('otouto.bindings')\n\z - local utilities = require('otouto.utilities')\n\z + load("local bot = require('miku.bot')\n\z + local bindings = require('miku.bindings')\n\z + local utilities = require('miku.utilities')\n\z local json = require('dkjson')\n\z local URL = require('socket.url')\n\z local http = require('socket.http')\n\z @@ -130,5 +70,4 @@ function luarun:action(msg, config) end ->>>>>>> upstream/master:otouto/plugins/luarun.lua return luarun \ No newline at end of file