help.lua and about.lua: /start now triggers about.lua
blacklist.lua: Added username support.
This commit is contained in:
@ -11,12 +11,15 @@ local action = function(msg)
|
||||
-- other plugins.
|
||||
if msg.forward_from then return end
|
||||
|
||||
local message = config.about_text .. '\nBased on otouto v'..version..' by topkecleon.\notouto is licensed under the GPLv2.\ngithub.com/topkecleon/otouto'
|
||||
local message = config.about_text .. '\nBased on @otouto v'..version..' by topkecleon.'
|
||||
|
||||
if msg.new_chat_participant and msg.new_chat_participant.id == bot.id then
|
||||
sendMessage(msg.chat.id, message, true)
|
||||
return
|
||||
elseif string.match(msg.text_lower, '^/about[@'..bot.username..']*') then
|
||||
elseif msg.text_lower:match('^/about[@'..bot.username..']*') then
|
||||
sendMessage(msg.chat.id, message, true)
|
||||
return
|
||||
elseif msg.text_lower:match('^/start') then
|
||||
sendMessage(msg.chat.id, message, true)
|
||||
return
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
--[[
|
||||
administration.lua
|
||||
Version 1.3
|
||||
Version 1.4
|
||||
Part of the otouto project.
|
||||
© 2016 topkecleon <drew@otou.to>
|
||||
GNU General Public License, version 2
|
||||
@ -9,9 +9,10 @@
|
||||
It requires tg (http://github.com/vysheng/tg) with supergroup support.
|
||||
For more documentation, view the readme or the manual (otou.to/rtfm).
|
||||
|
||||
Important notices about updates will be here!
|
||||
Remember to load this before blacklist.lua.
|
||||
|
||||
Important notices about updates will be here!
|
||||
|
||||
The global banlist has been merged with the blacklist. This merge will occur
|
||||
automatically on versions 1.1 and 1.2.
|
||||
|
||||
@ -53,8 +54,7 @@ for k,v in pairs(database.administration) do
|
||||
end
|
||||
|
||||
local sender = dofile('lua-tg/sender.lua')
|
||||
local tg = sender(localhost, config.cli_port)
|
||||
local last_admin_cron = os.date('%M', os.time())
|
||||
tg = sender('localhost', config.cli_port)
|
||||
|
||||
local flags = {
|
||||
[1] = {
|
||||
@ -208,13 +208,13 @@ local get_desc = function(chat_id)
|
||||
output = output .. '\n\n*Message of the Day:*\n' .. group.motd
|
||||
end
|
||||
if group.rules then
|
||||
output = output .. '\n\n*Rules:*\n'
|
||||
output = output .. '\n\n*Rules:*'
|
||||
for i,v in ipairs(group.rules) do
|
||||
output = output .. '*' .. i .. '.* ' .. v .. '\n'
|
||||
output = output .. '\n*' .. i .. '.* ' .. v
|
||||
end
|
||||
end
|
||||
if group.flags then
|
||||
output = output .. '\n*Flags:*\n'
|
||||
output = output .. '\n\n*Flags:*\n'
|
||||
for i = 1, #flags do
|
||||
if group.flags[i] then
|
||||
output = output .. '• ' .. flags[i].short .. '\n'
|
||||
@ -872,7 +872,7 @@ local commands = {
|
||||
end
|
||||
},
|
||||
|
||||
{ --degov
|
||||
{ -- degov
|
||||
triggers = {
|
||||
'^/degov[@'..bot.username..']*'
|
||||
},
|
||||
@ -1096,13 +1096,13 @@ local commands = {
|
||||
-- Generate trigger table.
|
||||
local triggers = {}
|
||||
for i,v in ipairs(commands) do
|
||||
for key,val in pairs(v.triggers) do
|
||||
for ind, val in ipairs(v.triggers) do
|
||||
table.insert(triggers, val)
|
||||
end
|
||||
end
|
||||
|
||||
database.administration.global.help = {}
|
||||
for i,v in pairs(ranks) do
|
||||
for i,v in ipairs(ranks) do
|
||||
database.administration.global.help[i] = {}
|
||||
end
|
||||
for i,v in ipairs(commands) do
|
||||
@ -1133,7 +1133,7 @@ local action = function(msg)
|
||||
end
|
||||
|
||||
local cron = function()
|
||||
tg = sender(localhost, config.cli_port)
|
||||
tg = sender(localhost, config.cldgmi_port)
|
||||
end
|
||||
|
||||
local command = 'groups'
|
||||
|
@ -23,21 +23,38 @@ local triggers = {
|
||||
return -- End if the user isn't admin.
|
||||
end
|
||||
|
||||
local input = msg.text:input()
|
||||
if not input then
|
||||
if msg.reply_to_message then
|
||||
input = tostring(msg.reply_to_message.from.id)
|
||||
local target, input
|
||||
if msg.reply_to_message then
|
||||
target = msg.reply_to_message.from.id
|
||||
else
|
||||
input = msg.text:input()
|
||||
if input then
|
||||
input = get_word(input, 1)
|
||||
if tonumber(input) then
|
||||
target = input
|
||||
else
|
||||
target = resolve_username(input)
|
||||
if target == nil then
|
||||
sendReply(msg, 'Sorry, I do not recognize that username.')
|
||||
return
|
||||
elseif target == false then
|
||||
sendReply(msg, 'Invalid ID or username.')
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
sendReply(msg, 'You must use this command via reply or by specifying a user\'s ID.')
|
||||
sendReply(msg, 'You must use this command via reply or by specifying an ID or username.')
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if database.blacklist[input] then
|
||||
database.blacklist[input] = nil
|
||||
target = tostring(target)
|
||||
|
||||
if database.blacklist[target] then
|
||||
database.blacklist[target] = nil
|
||||
sendReply(msg, input .. ' has been removed from the blacklist.')
|
||||
else
|
||||
database.blacklist[input] = true
|
||||
database.blacklist[target] = true
|
||||
sendReply(msg, input .. ' has been added to the blacklist.')
|
||||
end
|
||||
|
||||
|
@ -23,7 +23,7 @@ local action = function(msg)
|
||||
return
|
||||
end
|
||||
|
||||
str = str:match('<img src="(.*)">')
|
||||
str = str:match('<img src="(.-)">')
|
||||
local output = '[Cat!]('..str..')'
|
||||
|
||||
sendMessage(msg.chat.id, output, false, nil, true)
|
||||
|
@ -22,7 +22,7 @@ if not database.hearthstone or os.time() > database.hearthstone.expiration then
|
||||
|
||||
database.hearthstone.expiration = os.time() + 600000
|
||||
|
||||
print('Download complete! It will be permanently stored.')
|
||||
print('Download complete! It will be stored for a week.')
|
||||
|
||||
end
|
||||
|
||||
|
@ -17,8 +17,7 @@ Arguments: <required> \[optional]
|
||||
|
||||
local triggers = {
|
||||
'^/help[@'..bot.username..']*',
|
||||
'^/h[@'..bot.username..']*$',
|
||||
'^/start[@'..bot.username..']*'
|
||||
'^/h[@'..bot.username..']*$'
|
||||
}
|
||||
|
||||
local action = function(msg)
|
||||
|
Reference in New Issue
Block a user