yay, more bugfixes
This commit is contained in:
parent
c6f6fe96b8
commit
4cf00227f6
@ -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
|
bing.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('bing', true):t('g', true):t('google', true).table
|
||||||
end
|
end
|
||||||
|
|
||||||
function bing:action(msg)
|
function bing:action(msg, config)
|
||||||
local input = utilities.input(msg.text)
|
local input = utilities.input(msg.text)
|
||||||
if not input then
|
if not input then
|
||||||
if msg.reply_to_message and msg.reply_to_message.text ~= '' then
|
if msg.reply_to_message and msg.reply_to_message.text ~= '' then
|
||||||
@ -42,11 +42,11 @@ function bing:action(msg)
|
|||||||
local resbody = {}
|
local resbody = {}
|
||||||
local _,b,_ = https.request{
|
local _,b,_ = https.request{
|
||||||
url = url,
|
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),
|
sink = ltn12.sink.table(resbody),
|
||||||
}
|
}
|
||||||
if b ~= 200 then
|
if b ~= 200 then
|
||||||
utilities.send_reply(self, msg, self.config.errors.results)
|
utilities.send_reply(self, msg, config.errors.results)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local dat = JSON.decode(table.concat(resbody))
|
local dat = JSON.decode(table.concat(resbody))
|
||||||
|
@ -24,7 +24,7 @@ function channel:init(config)
|
|||||||
channel.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('ch', true).table
|
channel.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('ch', true).table
|
||||||
end
|
end
|
||||||
|
|
||||||
function channel:action(msg)
|
function channel:action(msg, config)
|
||||||
-- An exercise in using zero early returns. :)
|
-- An exercise in using zero early returns. :)
|
||||||
local input = utilities.input(msg.text)
|
local input = utilities.input(msg.text)
|
||||||
local output
|
local output
|
||||||
|
@ -44,9 +44,9 @@ function chatter:action(msg, config)
|
|||||||
local input = msg.text_lower:gsub(self.info.first_name, 'simsimi')
|
local input = msg.text_lower:gsub(self.info.first_name, 'simsimi')
|
||||||
input = input:gsub('@'..self.info.username, '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)
|
local jstr, res = HTTP.request(url)
|
||||||
if res ~= 200 then
|
if res ~= 200 then
|
||||||
|
@ -21,7 +21,7 @@ function control:action(msg, config)
|
|||||||
|
|
||||||
if msg.text_lower:match('^'..cmd_pat..'reload') then
|
if msg.text_lower:match('^'..cmd_pat..'reload') then
|
||||||
for pac, _ in pairs(package.loaded) do
|
for pac, _ in pairs(package.loaded) do
|
||||||
if pac:match('^plugins%.') then
|
if pac:match('^otouto%.plugins%.') then
|
||||||
package.loaded[pac] = nil
|
package.loaded[pac] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user