8dd43e6f37
antihammer enabled will not be affected by global bans. However, users who are hammer'd from an antihammer group will also be banned locally. Bot will now also attempt to kick via bot API before using tg. Added autobanning after (default) 3 autokicks. Threshold onfigurable with antiflood. Autokick counters reset within twenty-four hours. Merged antisquig action into generic. There is no automatic migration; simply add the following to database.administration: autokick_timer = 0 groups[*].flags[6] = false groups[*].autoban = 3 groups[*].autokicks = {} luarun.lua: Autoload more libraries by default, because the entire purpose of this plugin is for me to be lazy. pun.lua: Added puns. slap.lua: Added slaps.
42 lines
957 B
Lua
42 lines
957 B
Lua
local luarun = {}
|
|
|
|
local bindings = require('bindings')
|
|
local utilities = require('utilities')
|
|
|
|
function luarun:init()
|
|
luarun.triggers = utilities.triggers(self.info.username):t('lua', true).table
|
|
end
|
|
|
|
function luarun:action(msg)
|
|
|
|
if msg.from.id ~= self.config.admin then
|
|
return
|
|
end
|
|
|
|
local input = utilities.input(msg.text)
|
|
if not input then
|
|
bindings.sendReply(self, msg, 'Please enter a string to load.')
|
|
return
|
|
end
|
|
|
|
local output = loadstring( [[
|
|
local bindings = require('bindings')
|
|
local utilities = require('utilities')
|
|
local JSON = require('dkjson')
|
|
local URL = require('socket.url')
|
|
local HTTP = require('socket.http')
|
|
local HTTPS = require('ssl.https')
|
|
return function (self, msg) ]] .. input .. [[ end
|
|
]] )()(self, msg)
|
|
if output == nil then
|
|
output = 'Done!'
|
|
else
|
|
output = '```\n' .. tostring(output) .. '\n```'
|
|
end
|
|
bindings.sendMessage(self, msg.chat.id, output, true, msg.message_id, true)
|
|
|
|
end
|
|
|
|
return luarun
|
|
|