diff --git a/otouto/plugins/bing.lua b/otouto/plugins/bing.lua index 10d3dad..f362bc2 100644 --- a/otouto/plugins/bing.lua +++ b/otouto/plugins/bing.lua @@ -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)) diff --git a/otouto/plugins/channel.lua b/otouto/plugins/channel.lua index e69b3fa..cf51e4b 100644 --- a/otouto/plugins/channel.lua +++ b/otouto/plugins/channel.lua @@ -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 diff --git a/otouto/plugins/chatter.lua b/otouto/plugins/chatter.lua index 2dcde3e..0a080c2 100755 --- a/otouto/plugins/chatter.lua +++ b/otouto/plugins/chatter.lua @@ -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 diff --git a/otouto/plugins/control.lua b/otouto/plugins/control.lua index 7681c21..c7b7593 100644 --- a/otouto/plugins/control.lua +++ b/otouto/plugins/control.lua @@ -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