help.lua and about.lua: /start now triggers about.lua
blacklist.lua: Added username support.
This commit is contained in:
parent
ec64f18138
commit
f529bc9ad8
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
plugins/CUSTOM.lua
|
plugins/mokubot.lua
|
||||||
*.json
|
plugins/qtbot.lua
|
||||||
lua-tg/*
|
plugins/weeabot.lua
|
||||||
tg/*
|
*.db
|
||||||
|
lua-tg
|
||||||
|
tg
|
||||||
|
22
README.md
22
README.md
@ -217,10 +217,20 @@ There are a a few ways to contribute if you are not a programmer. For one, your
|
|||||||
|
|
||||||
Contributions are appreciated in any form. Monetary contributions will go toward server costs. Both programmers and donators will be eternally honored (at their discretion) on this page.
|
Contributions are appreciated in any form. Monetary contributions will go toward server costs. Both programmers and donators will be eternally honored (at their discretion) on this page.
|
||||||
|
|
||||||
| Developers | Donators |
|
| Contributors |
|
||||||
|:-----------|:---------|
|
|:-----------|
|
||||||
| [Juan Potato](http://github.com/JuanPotato) | [n8](http://telegram.me/n8_c00) |
|
| [Juan Potato](http://github.com/JuanPotato) |
|
||||||
| [Tiago Danin](http://github.com/TiagoDanin) | [Alex](http://telegram.me/sandu) |
|
| [Tiago Danin](http://github.com/TiagoDanin) |
|
||||||
| [Ender](http://github.com/luksireiku) | [Brayden Banks](http://telegram.me/bb010g) |
|
| [bb010g](http://github.com/bb010g) |
|
||||||
|
| [Ender](http://github.com/luksireiku) |
|
||||||
| [Iman Daneshi](http://github.com/Imandaneshi) |
|
| [Iman Daneshi](http://github.com/Imandaneshi) |
|
||||||
| [HeitorPB](https://github.com/heitorPB) |
|
| [HeitorPB](http://github.com/heitorPB) |
|
||||||
|
| [Akronix](http://github.com/Akronix) |
|
||||||
|
| [Ville](http://github.com/cwxda) |
|
||||||
|
| [dogtopus](http://github.com/dogtopus) |
|
||||||
|
|
||||||
|
| Donators |
|
||||||
|
|:---------|
|
||||||
|
| [n8](http://telegram.me/n8_c00) |
|
||||||
|
| [Alex](http://telegram.me/sandu) |
|
||||||
|
| [Brayden Banks](http://telegram.me/bb010g) |
|
||||||
|
@ -114,6 +114,8 @@ forwardMessage = function(chat_id, from_chat_id, message_id, disable_notificatio
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- TODO: More of this.
|
||||||
|
|
||||||
sendPhotoID = function(chat_id, file_id, caption, reply_to_message_id, disable_notification)
|
sendPhotoID = function(chat_id, file_id, caption, reply_to_message_id, disable_notification)
|
||||||
|
|
||||||
local url = BASE_URL .. '/sendPhoto?chat_id=' .. chat_id .. '&photo=' .. file_id
|
local url = BASE_URL .. '/sendPhoto?chat_id=' .. chat_id .. '&photo=' .. file_id
|
||||||
@ -134,8 +136,6 @@ sendPhotoID = function(chat_id, file_id, caption, reply_to_message_id, disable_n
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: More of this.
|
|
||||||
|
|
||||||
curlRequest = function(curl_command)
|
curlRequest = function(curl_command)
|
||||||
-- Use at your own risk. Will not check for success.
|
-- Use at your own risk. Will not check for success.
|
||||||
|
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
lua bot.lua
|
lua bot.lua
|
||||||
|
echo 'otouto has stopped. ^C to exit.'
|
||||||
sleep 5s
|
sleep 5s
|
||||||
done
|
done
|
||||||
|
@ -11,12 +11,15 @@ local action = function(msg)
|
|||||||
-- other plugins.
|
-- other plugins.
|
||||||
if msg.forward_from then return end
|
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
|
if msg.new_chat_participant and msg.new_chat_participant.id == bot.id then
|
||||||
sendMessage(msg.chat.id, message, true)
|
sendMessage(msg.chat.id, message, true)
|
||||||
return
|
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)
|
sendMessage(msg.chat.id, message, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--[[
|
--[[
|
||||||
administration.lua
|
administration.lua
|
||||||
Version 1.3
|
Version 1.4
|
||||||
Part of the otouto project.
|
Part of the otouto project.
|
||||||
© 2016 topkecleon <drew@otou.to>
|
© 2016 topkecleon <drew@otou.to>
|
||||||
GNU General Public License, version 2
|
GNU General Public License, version 2
|
||||||
@ -9,9 +9,10 @@
|
|||||||
It requires tg (http://github.com/vysheng/tg) with supergroup support.
|
It requires tg (http://github.com/vysheng/tg) with supergroup support.
|
||||||
For more documentation, view the readme or the manual (otou.to/rtfm).
|
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.
|
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
|
The global banlist has been merged with the blacklist. This merge will occur
|
||||||
automatically on versions 1.1 and 1.2.
|
automatically on versions 1.1 and 1.2.
|
||||||
|
|
||||||
@ -53,8 +54,7 @@ for k,v in pairs(database.administration) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local sender = dofile('lua-tg/sender.lua')
|
local sender = dofile('lua-tg/sender.lua')
|
||||||
local tg = sender(localhost, config.cli_port)
|
tg = sender('localhost', config.cli_port)
|
||||||
local last_admin_cron = os.date('%M', os.time())
|
|
||||||
|
|
||||||
local flags = {
|
local flags = {
|
||||||
[1] = {
|
[1] = {
|
||||||
@ -208,13 +208,13 @@ local get_desc = function(chat_id)
|
|||||||
output = output .. '\n\n*Message of the Day:*\n' .. group.motd
|
output = output .. '\n\n*Message of the Day:*\n' .. group.motd
|
||||||
end
|
end
|
||||||
if group.rules then
|
if group.rules then
|
||||||
output = output .. '\n\n*Rules:*\n'
|
output = output .. '\n\n*Rules:*'
|
||||||
for i,v in ipairs(group.rules) do
|
for i,v in ipairs(group.rules) do
|
||||||
output = output .. '*' .. i .. '.* ' .. v .. '\n'
|
output = output .. '\n*' .. i .. '.* ' .. v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if group.flags then
|
if group.flags then
|
||||||
output = output .. '\n*Flags:*\n'
|
output = output .. '\n\n*Flags:*\n'
|
||||||
for i = 1, #flags do
|
for i = 1, #flags do
|
||||||
if group.flags[i] then
|
if group.flags[i] then
|
||||||
output = output .. '• ' .. flags[i].short .. '\n'
|
output = output .. '• ' .. flags[i].short .. '\n'
|
||||||
@ -872,7 +872,7 @@ local commands = {
|
|||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
{ --degov
|
{ -- degov
|
||||||
triggers = {
|
triggers = {
|
||||||
'^/degov[@'..bot.username..']*'
|
'^/degov[@'..bot.username..']*'
|
||||||
},
|
},
|
||||||
@ -1096,13 +1096,13 @@ local commands = {
|
|||||||
-- Generate trigger table.
|
-- Generate trigger table.
|
||||||
local triggers = {}
|
local triggers = {}
|
||||||
for i,v in ipairs(commands) do
|
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)
|
table.insert(triggers, val)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
database.administration.global.help = {}
|
database.administration.global.help = {}
|
||||||
for i,v in pairs(ranks) do
|
for i,v in ipairs(ranks) do
|
||||||
database.administration.global.help[i] = {}
|
database.administration.global.help[i] = {}
|
||||||
end
|
end
|
||||||
for i,v in ipairs(commands) do
|
for i,v in ipairs(commands) do
|
||||||
@ -1133,7 +1133,7 @@ local action = function(msg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cron = function()
|
local cron = function()
|
||||||
tg = sender(localhost, config.cli_port)
|
tg = sender(localhost, config.cldgmi_port)
|
||||||
end
|
end
|
||||||
|
|
||||||
local command = 'groups'
|
local command = 'groups'
|
||||||
|
@ -23,21 +23,38 @@ local triggers = {
|
|||||||
return -- End if the user isn't admin.
|
return -- End if the user isn't admin.
|
||||||
end
|
end
|
||||||
|
|
||||||
local input = msg.text:input()
|
local target, input
|
||||||
if not input then
|
if msg.reply_to_message then
|
||||||
if msg.reply_to_message then
|
target = msg.reply_to_message.from.id
|
||||||
input = tostring(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
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if database.blacklist[input] then
|
target = tostring(target)
|
||||||
database.blacklist[input] = nil
|
|
||||||
|
if database.blacklist[target] then
|
||||||
|
database.blacklist[target] = nil
|
||||||
sendReply(msg, input .. ' has been removed from the blacklist.')
|
sendReply(msg, input .. ' has been removed from the blacklist.')
|
||||||
else
|
else
|
||||||
database.blacklist[input] = true
|
database.blacklist[target] = true
|
||||||
sendReply(msg, input .. ' has been added to the blacklist.')
|
sendReply(msg, input .. ' has been added to the blacklist.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ local action = function(msg)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
str = str:match('<img src="(.*)">')
|
str = str:match('<img src="(.-)">')
|
||||||
local output = '[Cat!]('..str..')'
|
local output = '[Cat!]('..str..')'
|
||||||
|
|
||||||
sendMessage(msg.chat.id, output, false, nil, true)
|
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
|
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
|
end
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ Arguments: <required> \[optional]
|
|||||||
|
|
||||||
local triggers = {
|
local triggers = {
|
||||||
'^/help[@'..bot.username..']*',
|
'^/help[@'..bot.username..']*',
|
||||||
'^/h[@'..bot.username..']*$',
|
'^/h[@'..bot.username..']*$'
|
||||||
'^/start[@'..bot.username..']*'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local action = function(msg)
|
local action = function(msg)
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
while true; do
|
while true; do
|
||||||
tg/bin/telegram-cli -P 4567 -E
|
tg/bin/telegram-cli -P 4567 -E
|
||||||
rm ~/.telegram-cli/state
|
rm ~/.telegram-cli/state
|
||||||
sleep 2s
|
echo 'tg has stopped. ^C to exit.'
|
||||||
|
sleep 5s
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user