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:
parent
2efb8cec75
commit
38efb5d827
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
plugins/mokubot*
|
plugins/mokubot*
|
||||||
plugins/qtbot*
|
plugins/qtbot*
|
||||||
plugins/weeabot*
|
|
||||||
*.db
|
*.db
|
||||||
lua-tg
|
lua-tg
|
||||||
|
drua-tg
|
||||||
tg
|
tg
|
||||||
|
@ -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:
|
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`)
|
- weather.lua: [OpenWeatherMap](http://openweathermap.org) API key (`owm_api_key`)
|
||||||
- lastfm.lua: [last.fm](http://last.fm) API key (`lastfm_api_key`)
|
- lastfm.lua: [last.fm](http://last.fm/api) API key (`lastfm_api_key`)
|
||||||
- bible.lua: [Biblia](http://biblia.com) API key (`biblia_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`)
|
- 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`)
|
- 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`)
|
- chatter.lua: [SimSimi](http://developer.simsimi.com/signUp) API key (`simsimi_key`)
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
75
config.lua
75
config.lua
@ -1,26 +1,46 @@
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
|
-- Your authorization token from the botfather.
|
||||||
bot_api_key = '',
|
bot_api_key = '',
|
||||||
google_api_key = '',
|
-- Differences, in seconds, between your time and UTC.
|
||||||
google_cse_key = '',
|
|
||||||
lastfm_api_key = '',
|
|
||||||
owm_api_key = '',
|
|
||||||
biblia_api_key = '',
|
|
||||||
thecatapi_key = '',
|
|
||||||
nasa_api_key = '',
|
|
||||||
yandex_key = '',
|
|
||||||
simsimi_key = '',
|
|
||||||
simsimi_trial = true,
|
|
||||||
time_offset = 0,
|
time_offset = 0,
|
||||||
|
-- Two-letter language code.
|
||||||
lang = 'en',
|
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.
|
-- If you change this, make sure you also modify launch-tg.sh.
|
||||||
cli_port = 4567,
|
cli_port = 4567,
|
||||||
admin = 00000000,
|
-- The block of text returned by /start.
|
||||||
log_chat = nil,
|
|
||||||
about_text = [[
|
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.
|
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 = {
|
errors = {
|
||||||
connection = 'Connection error.',
|
connection = 'Connection error.',
|
||||||
results = 'No results found.',
|
results = 'No results found.',
|
||||||
@ -29,37 +49,11 @@ Send /help to get started.
|
|||||||
chatter_connection = 'I don\'t feel like talking right now.',
|
chatter_connection = 'I don\'t feel like talking right now.',
|
||||||
chatter_response = 'I don\'t know what to say to that.'
|
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 = {
|
plugins = {
|
||||||
'control.lua',
|
'control.lua',
|
||||||
'blacklist.lua',
|
'blacklist.lua',
|
||||||
'about.lua',
|
'about.lua',
|
||||||
'floodcontrol.lua',
|
|
||||||
'ping.lua',
|
'ping.lua',
|
||||||
'whoami.lua',
|
'whoami.lua',
|
||||||
'nick.lua',
|
'nick.lua',
|
||||||
@ -94,4 +88,5 @@ Send /help to get started.
|
|||||||
'help.lua',
|
'help.lua',
|
||||||
'greetings.lua'
|
'greetings.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--[[
|
--[[
|
||||||
administration.lua
|
administration.lua
|
||||||
Version 1.8
|
Version 1.8.1
|
||||||
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
|
||||||
@ -21,6 +21,8 @@
|
|||||||
1.8 - Group descriptions will be updated automatically. Fixed markdown
|
1.8 - Group descriptions will be updated automatically. Fixed markdown
|
||||||
stuff. Removed /kickme.
|
stuff. Removed /kickme.
|
||||||
|
|
||||||
|
1.8.1 - /rule <i> will return that numbered rule, if it exists.
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- Build the administration db if nonexistent.
|
-- Build the administration db if nonexistent.
|
||||||
@ -530,8 +532,8 @@ local commands = {
|
|||||||
|
|
||||||
{ -- rules
|
{ -- rules
|
||||||
triggers = {
|
triggers = {
|
||||||
'^/rules$',
|
'^/rules?',
|
||||||
'^/rules@'..bot.username
|
'^/rules?@'..bot.username
|
||||||
},
|
},
|
||||||
|
|
||||||
command = 'rules',
|
command = 'rules',
|
||||||
@ -539,13 +541,21 @@ local commands = {
|
|||||||
interior = true,
|
interior = true,
|
||||||
|
|
||||||
action = function(msg, group)
|
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 #group.rules > 0 then
|
||||||
|
if input and group.rules[input] then
|
||||||
|
output = '*' .. input .. '.* ' .. group.rules[input]
|
||||||
|
else
|
||||||
output = '*Rules for* _' .. msg.chat.title .. '_ *:*\n'
|
output = '*Rules for* _' .. msg.chat.title .. '_ *:*\n'
|
||||||
for i,v in ipairs(group.rules) do
|
for i,v in ipairs(group.rules) do
|
||||||
output = output .. '*' .. i .. '.* ' .. v .. '\n'
|
output = output .. '*' .. i .. '.* ' .. v .. '\n'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
output = 'No rules have been set for ' .. msg.chat.title .. '.'
|
||||||
|
end
|
||||||
sendMessage(msg.chat.id, output, true, nil, true)
|
sendMessage(msg.chat.id, output, true, nil, true)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
@ -45,7 +45,7 @@ local action = function(msg)
|
|||||||
|
|
||||||
local message
|
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)]
|
message = yesno_answers[math.random(#yesno_answers)]
|
||||||
else
|
else
|
||||||
message = ball_answers[math.random(#ball_answers)]
|
message = ball_answers[math.random(#ball_answers)]
|
||||||
|
@ -1,4 +1,35 @@
|
|||||||
-- Put this on the bottom of your plugin list, after help.lua.
|
-- 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 = {
|
local triggers = {
|
||||||
bot.first_name .. '%p*$'
|
bot.first_name .. '%p*$'
|
||||||
|
@ -17,7 +17,7 @@ local action = function(msg)
|
|||||||
|
|
||||||
local output = ''
|
local output = ''
|
||||||
for k,v in pairs(target) do
|
for k,v in pairs(target) do
|
||||||
output = output .. '*' .. k .. ':* `' .. v .. '`\n'
|
output = output .. '*' .. k .. ':* `' .. tostring(v) .. '`\n'
|
||||||
end
|
end
|
||||||
sendMessage(msg.chat.id, output, true, nil, true)
|
sendMessage(msg.chat.id, output, true, nil, true)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user