various improvements
This commit is contained in:
@ -10,7 +10,14 @@ function PLUGIN.action(msg)
|
||||
|
||||
local message = 'Command not found.'
|
||||
|
||||
if msg.from.id ~= config.ADMIN_ID then
|
||||
local sudo = 0
|
||||
for i,v in ipairs(config.admins) do
|
||||
if msg.from.id == v then
|
||||
sudo = v
|
||||
end
|
||||
end
|
||||
|
||||
if sudo == 0 then
|
||||
message = 'Permission denied.'
|
||||
|
||||
elseif string.lower(first_word(input)) == 'run' then
|
||||
|
@ -25,14 +25,24 @@ function PLUGIN.action(msg)
|
||||
jdat.res = "I don't know what to say to that."
|
||||
end
|
||||
|
||||
local message = jdat.res
|
||||
|
||||
-- Let's clean up the response a little. Capitalization & punctuation.
|
||||
local message = jdat.res:gsub('simsimi', 'clive')
|
||||
local message = message:gsub("^%l", string.upper)
|
||||
filter = {
|
||||
['%aim%aimi'] = bot.first_name,
|
||||
['^%s*(.-)%s*$'] = '%1',
|
||||
['^%l'] = string.upper
|
||||
}
|
||||
|
||||
for k,v in pairs(filter) do
|
||||
message = string.gsub(message, k, v)
|
||||
end
|
||||
|
||||
if not string.match(message, '%p$') then
|
||||
message = message .. '.'
|
||||
end
|
||||
|
||||
send_message(msg.chat.id, jdat.res)
|
||||
send_message(msg.chat.id, message)
|
||||
|
||||
end
|
||||
|
||||
|
@ -13,6 +13,8 @@ PLUGIN.triggers = {
|
||||
|
||||
function PLUGIN.action(msg)
|
||||
|
||||
if string.find(msg.text, '@') and not string.match('help@'..bot.username) then return end
|
||||
|
||||
local input = get_input(msg.text)
|
||||
|
||||
if input then
|
||||
@ -29,6 +31,7 @@ function PLUGIN.action(msg)
|
||||
*Arguments: <required> [optional]
|
||||
Use "!help <command>" for specific information.
|
||||
otouto v]] .. VERSION .. [[ by @topkecleon.
|
||||
Fork me on github! github.com/topkecleon/otouto
|
||||
]]
|
||||
|
||||
if msg.from.id ~= msg.chat.id then
|
||||
|
@ -1,7 +1,12 @@
|
||||
-- config.people is a table of IDs/nicknames the bot can address more familiarly
|
||||
-- like so:
|
||||
-- 13227902: "Drew"
|
||||
|
||||
|
||||
local PLUGIN = {}
|
||||
|
||||
PLUGIN.triggers = {
|
||||
'otouto%p?$',
|
||||
bot.first_name .. '%p?$',
|
||||
'^tadaima%p?$',
|
||||
'^i\'m home%p?$',
|
||||
'^i\'m back%p?$'
|
||||
@ -11,25 +16,27 @@ function PLUGIN.action(msg) -- I WISH LUA HAD PROPER REGEX SUPPORT
|
||||
|
||||
local input = string.lower(msg.text)
|
||||
|
||||
if config.people[tostring(msg.from.id)] then msg.from.first_name = config.people[tostring(msg.from.id)] end
|
||||
|
||||
for i = 2, #PLUGIN.triggers do
|
||||
if string.match(input, PLUGIN.triggers[i]) then
|
||||
return send_message(msg.chat.id, 'Welcome back, ' .. msg.from.first_name .. '!')
|
||||
end
|
||||
end
|
||||
|
||||
if input:match('thanks,? otouto') or input:match('thank you,? otouto') then
|
||||
if input:match('thanks,? '..bot.first_name) or input:match('thank you,? '..bot.first_name) then
|
||||
return send_message(msg.chat.id, 'No problem, ' .. msg.from.first_name .. '!')
|
||||
end
|
||||
|
||||
if input:match('hello,? otouto') or input:match('hey,? otouto') or input:match('hi,? otouto') then
|
||||
if input:match('hello,? '..bot.first_name) or input:match('hey,? '..bot.first_name) or input:match('hi,? '..bot.first_name) then
|
||||
return send_message(msg.chat.id, 'Hi, ' .. msg.from.first_name .. '!')
|
||||
end
|
||||
|
||||
if input:match('i hate you,? otouto') or input:match('screw you,? otouto') or input:match('fuck you,? otouto') then
|
||||
if input:match('i hate you,? '..bot.first_name) or input:match('screw you,? '..bot.first_name) or input:match('fuck you,? '..bot.first_name) then
|
||||
return send_msg(msg, '; _ ;')
|
||||
end
|
||||
|
||||
if string.match(input, 'i love you,? otouto') then
|
||||
if string.match(input, 'i love you,? '..bot.first_name) then
|
||||
return send_msg(msg, '<3')
|
||||
end
|
||||
|
||||
|
@ -105,7 +105,7 @@ function PLUGIN.action(msg)
|
||||
slapper = msg.from.first_name
|
||||
else
|
||||
victim = msg.from.first_name
|
||||
slapper = bot.username
|
||||
slapper = bot.first_name
|
||||
end
|
||||
|
||||
local message = PLUGIN.getSlap(slapper, victim)
|
||||
|
@ -1,3 +1,5 @@
|
||||
-- TIME_OFFSET is the number of seconds necessary to correct your system clock to UTC.
|
||||
|
||||
local PLUGIN = {}
|
||||
|
||||
PLUGIN.doc = [[
|
||||
|
Reference in New Issue
Block a user