administration.lua: 1.8.1

me.lua: Fix for potential future bug.
README.md: Better links.
config.lua: Added comments, links, removed unnecessary things.
greetings.lua: Default configuration now built in so as to not
  crowd the config file.
.gitignore: wew lad
This commit is contained in:
topkecleon
2016-04-05 06:43:11 -04:00
parent 2efb8cec75
commit 38efb5d827
7 changed files with 91 additions and 55 deletions

View File

@ -1,6 +1,6 @@
--[[
administration.lua
Version 1.8
Version 1.8.1
Part of the otouto project.
© 2016 topkecleon <drew@otou.to>
GNU General Public License, version 2
@ -21,6 +21,8 @@
1.8 - Group descriptions will be updated automatically. Fixed markdown
stuff. Removed /kickme.
1.8.1 - /rule <i> will return that numbered rule, if it exists.
]]--
-- Build the administration db if nonexistent.
@ -530,8 +532,8 @@ local commands = {
{ -- rules
triggers = {
'^/rules$',
'^/rules@'..bot.username
'^/rules?',
'^/rules?@'..bot.username
},
command = 'rules',
@ -539,12 +541,20 @@ local commands = {
interior = true,
action = function(msg, group)
local output = 'No rules have been set for ' .. msg.chat.title .. '.'
local output
local input = get_word(msg.text_lower, 2)
input = tonumber(input)
if #group.rules > 0 then
output = '*Rules for* _' .. msg.chat.title .. '_ *:*\n'
for i,v in ipairs(group.rules) do
output = output .. '*' .. i .. '.* ' .. v .. '\n'
if input and group.rules[input] then
output = '*' .. input .. '.* ' .. group.rules[input]
else
output = '*Rules for* _' .. msg.chat.title .. '_ *:*\n'
for i,v in ipairs(group.rules) do
output = output .. '*' .. i .. '.* ' .. v .. '\n'
end
end
else
output = 'No rules have been set for ' .. msg.chat.title .. '.'
end
sendMessage(msg.chat.id, output, true, nil, true)
end

View File

@ -45,7 +45,7 @@ local action = function(msg)
local message
if msg.text:lower():match('y/n%p?$') then
if msg.text_lower:match('y/n%p?$') then
message = yesno_answers[math.random(#yesno_answers)]
else
message = ball_answers[math.random(#ball_answers)]

View File

@ -1,4 +1,35 @@
-- Put this on the bottom of your plugin list, after help.lua.
-- If you want to configure your own greetings, copy the following table
-- (without the "config.") to your config.lua file.
if not config.greetings then
config.greetings = {
['Hello, #NAME.'] = {
'hello',
'hey',
'sup',
'hi',
'good morning',
'good day',
'good afternoon',
'good evening'
},
['Goodbye, #NAME.'] = {
'bye',
'later',
'see ya',
'good night'
},
['Welcome back, #NAME.'] = {
'i\'m home',
'i\'m back'
},
['You\'re welcome, #NAME.'] = {
'thanks',
'thank you'
}
}
end
local triggers = {
bot.first_name .. '%p*$'

View File

@ -17,7 +17,7 @@ local action = function(msg)
local output = ''
for k,v in pairs(target) do
output = output .. '*' .. k .. ':* `' .. v .. '`\n'
output = output .. '*' .. k .. ':* `' .. tostring(v) .. '`\n'
end
sendMessage(msg.chat.id, output, true, nil, true)