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

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
plugins/mokubot*
plugins/qtbot*
plugins/weeabot*
*.db
lua-tg
drua-tg
tg

View File

@ -32,13 +32,13 @@ When you are ready to start the bot, run `./launch.sh`. To stop the bot, send "/
Note that certain plugins, such as translate.lua and greetings.lua, will require privacy mode to be disabled. Additionally, some plugins may require or make use of various API keys:
- gImages.lua & youtube.lua: Google [API](http://console.developers.google.com) and [CSE](https://cse.google.com/cse) keys (`google_api_key`, `google_cse_key`)
- weather.lua: [OpenWeatherMap](http://openweathermap.org) API key (`owm_api_key`)
- lastfm.lua: [last.fm](http://last.fm) API key (`lastfm_api_key`)
- bible.lua: [Biblia](http://biblia.com) API key (`biblia_api_key`)
- lastfm.lua: [last.fm](http://last.fm/api) API key (`lastfm_api_key`)
- bible.lua: [Biblia](http://api.biblia.com) API key (`biblia_api_key`)
- cats.lua: [The Cat API](http://thecatapi.com) API key (optional) (`thecatapi_key`)
- gImages.lua: Google [API](http://console.developers.google.com) and [CSE](https://cse.google.com/cse) keys (`google_api_key`, `google_cse_key`)
- apod.lua: [NASA](http://api.nasa.gov) API key (`nasa_api_key`)
- translate.lua: [Yandex](https://tech.yandex.com/keys/get/?service=trnsl) API key (`yandex_key`)
- translate.lua: [Yandex](http://tech.yandex.com/keys/get/?service=trnsl) API key (`yandex_key`)
- chatter.lua: [SimSimi](http://developer.simsimi.com/signUp) API key (`simsimi_key`)
* * *

View File

@ -1,26 +1,46 @@
return {
-- Your authorization token from the botfather.
bot_api_key = '',
google_api_key = '',
google_cse_key = '',
lastfm_api_key = '',
owm_api_key = '',
biblia_api_key = '',
thecatapi_key = '',
nasa_api_key = '',
yandex_key = '',
simsimi_key = '',
simsimi_trial = true,
-- Differences, in seconds, between your time and UTC.
time_offset = 0,
-- Two-letter language code.
lang = 'en',
-- Your Telegram ID.
admin = 00000000,
-- The channel, group, or user to send error reports to.
-- If this is not set, errors will be printed to the console.
log_chat = nil,
-- The port used to communicate with tg for administration.lua.
-- If you change this, make sure you also modify launch-tg.sh.
cli_port = 4567,
admin = 00000000,
log_chat = nil,
-- The block of text returned by /start.
about_text = [[
I am otouto, the plugin-wielding, multi-purpose Telegram bot.
I am otouto, the plugin-wielding, multipurpose Telegram bot.
Send /help to get started.
]] ,
]],
-- http://console.developers.google.com
google_api_key = '',
-- https://cse.google.com/cse
google_cse_key = '',
-- http://openweathermap.org/appid
owm_api_key = '',
-- http://last.fm/api
lastfm_api_key = '',
-- http://api.biblia.com
biblia_api_key = '',
-- http://thecatapi.com/docs.html
thecatapi_key = '',
-- http://api.nasa.gov
nasa_api_key = '',
-- http://tech.yandex.com/keys/get/?service=trnsl
yandex_key = '',
-- http://developer.simsimi.com/signUp
simsimi_key = '',
simsimi_trial = true,
errors = {
connection = 'Connection error.',
results = 'No results found.',
@ -29,37 +49,11 @@ Send /help to get started.
chatter_connection = 'I don\'t feel like talking right now.',
chatter_response = 'I don\'t know what to say to that.'
},
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'
}
},
plugins = {
'control.lua',
'blacklist.lua',
'about.lua',
'floodcontrol.lua',
'ping.lua',
'whoami.lua',
'nick.lua',
@ -94,4 +88,5 @@ Send /help to get started.
'help.lua',
'greetings.lua'
}
}

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,13 +541,21 @@ 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
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)