yay, more bugfixes

This commit is contained in:
topkecleon 2016-06-07 03:02:05 -04:00
parent c6f6fe96b8
commit 4cf00227f6
4 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ function bing:init(config)
bing.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('bing', true):t('g', true):t('google', true).table
end
function bing:action(msg)
function bing:action(msg, config)
local input = utilities.input(msg.text)
if not input then
if msg.reply_to_message and msg.reply_to_message.text ~= '' then
@ -42,11 +42,11 @@ function bing:action(msg)
local resbody = {}
local _,b,_ = https.request{
url = url,
headers = { ["Authorization"] = "Basic " .. mime.b64(":" .. self.config.bing_api_key) },
headers = { ["Authorization"] = "Basic " .. mime.b64(":" .. config.bing_api_key) },
sink = ltn12.sink.table(resbody),
}
if b ~= 200 then
utilities.send_reply(self, msg, self.config.errors.results)
utilities.send_reply(self, msg, config.errors.results)
return
end
local dat = JSON.decode(table.concat(resbody))

View File

@ -24,7 +24,7 @@ function channel:init(config)
channel.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('ch', true).table
end
function channel:action(msg)
function channel:action(msg, config)
-- An exercise in using zero early returns. :)
local input = utilities.input(msg.text)
local output

View File

@ -44,9 +44,9 @@ function chatter:action(msg, config)
local input = msg.text_lower:gsub(self.info.first_name, 'simsimi')
input = input:gsub('@'..self.info.username, 'simsimi')
local sandbox = self.config.simsimi_trial and 'sandbox.' or ''
local sandbox = config.simsimi_trial and 'sandbox.' or ''
local url = chatter.base_url:format(sandbox, config.simsimi_key, self.config.lang, URL.escape(input))
local url = chatter.base_url:format(sandbox, config.simsimi_key, config.lang, URL.escape(input))
local jstr, res = HTTP.request(url)
if res ~= 200 then

View File

@ -21,7 +21,7 @@ function control:action(msg, config)
if msg.text_lower:match('^'..cmd_pat..'reload') then
for pac, _ in pairs(package.loaded) do
if pac:match('^plugins%.') then
if pac:match('^otouto%.plugins%.') then
package.loaded[pac] = nil
end
end