much improved personality.lua interactions
partial localization support
This commit is contained in:
		| @@ -172,6 +172,8 @@ Add your bot API key, and other API keys if desirable. | ||||
| The plugins which require API keys that are not provided are disabled by default. | ||||
| The provided Giphy key is the public test key, and is subject to rate limitaton. | ||||
|  | ||||
| The "fortune.lua" plugin requires the fortune program to be installed on the host computer. | ||||
|  | ||||
| TIME_OFFSET is the time difference, in seconds, between your system clock. It is sometimes necessary for accurate output of the time plugin. Default at 0 (duh). | ||||
|  | ||||
| "admins" table includes the ID numbers, as integers, of any privileged users. These will have access to the admin plugin and any addition privileged commands. | ||||
|   | ||||
							
								
								
									
										10
									
								
								bot.lua
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								bot.lua
									
									
									
									
									
								
							| @@ -31,9 +31,13 @@ function bot_init() | ||||
|  | ||||
| 	print('\nLoading configuration...') | ||||
|  | ||||
| 	local jstr = io.open('config.json') | ||||
| 	local jstr = jstr:read('*all') | ||||
| 	config = JSON.decode(jstr) | ||||
| 	local j = io.open('config.json') | ||||
| 	local j = j:read('*all') | ||||
| 	config = JSON.decode(j) | ||||
| 	local j = io.open('loc/'..config.LOCALE..'.json') | ||||
| 	local j = j:read('*all') | ||||
| 	locale = JSON.decode(j) | ||||
|  | ||||
| 	print(#config.plugins .. ' plugins enabled.') | ||||
|  | ||||
| 	require('bindings') | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
|  "BIBLIA_API_KEY": "", | ||||
|  "GIPHY_API_KEY": "dc6zaTOxFJmzC", | ||||
|  "TIME_OFFSET": 0, | ||||
|  "LOCALE": "en_US", | ||||
|  "admins": [ | ||||
|   0 | ||||
|  ], | ||||
|   | ||||
| @@ -1,47 +0,0 @@ | ||||
| { | ||||
|  "BOT_API_KEY": "", | ||||
|  "BIBLIA_API_KEY": "", | ||||
|  "GIPHY_API_KEY": "dc6zaTOxFJmzC", | ||||
|  "TIME_OFFSET": 0, | ||||
|  "admins": [ | ||||
|   0 | ||||
|  ], | ||||
|  "plugins": [ | ||||
|   "about.lua", | ||||
|   "8ball.lua", | ||||
|   "admin.lua", | ||||
|   "bandersnatch.lua", | ||||
|   "btc.lua", | ||||
|   "calc.lua", | ||||
|   "chatter.lua", | ||||
|   "commit.lua", | ||||
|   "dice.lua", | ||||
|   "dogify.lua", | ||||
|   "echo.lua", | ||||
|   "fortune.lua", | ||||
|   "gImages.lua", | ||||
|   "giphy.lua", | ||||
|   "gMaps.lua", | ||||
|   "gSearch.lua", | ||||
|   "hackernews.lua", | ||||
|   "help.lua", | ||||
|   "hex.lua", | ||||
|   "imdb.lua", | ||||
|   "personality.lua", | ||||
|   "pokedex.lua", | ||||
|   "pun.lua", | ||||
|   "reaction.lua", | ||||
|   "reddit.lua", | ||||
|   "remind.lua", | ||||
|   "slap.lua", | ||||
|   "time.lua", | ||||
|   "urbandictionary.lua", | ||||
|   "weather.lua", | ||||
|   "whoami.lua", | ||||
|   "xkcd.lua" | ||||
|  ], | ||||
|  "people": { | ||||
|   "55994550": "topkecleon", | ||||
|  } | ||||
| } | ||||
|  | ||||
							
								
								
									
										40
									
								
								loc/en_US.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								loc/en_US.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| { | ||||
|     "hello": [ | ||||
|         "hello", | ||||
|         "hey", | ||||
|         "hi", | ||||
|         "good morning", | ||||
|         "good day", | ||||
|         "good afternoon", | ||||
|         "good evening" | ||||
|     ], | ||||
|     "goodbye": [ | ||||
|         "bye", | ||||
|         "later", | ||||
|         "see ya", | ||||
|         "good night" | ||||
|     ], | ||||
|     "thankyou": [ | ||||
|         "thanks", | ||||
|         "thank you" | ||||
|     ], | ||||
|     "love": [ | ||||
|         "love you" | ||||
|     ], | ||||
|     "hate": [ | ||||
|         "hate you", | ||||
|         "screw you", | ||||
|         "fuck you", | ||||
|         "go away" | ||||
|     ], | ||||
|     "responses": { | ||||
|         "hello": "Hi", | ||||
|         "goodbye": "Bye-bye", | ||||
|         "thankyou": "No problem", | ||||
|         "love": "You, too", | ||||
|         "hate": "Screw you" | ||||
|     }, | ||||
|     "conn_err": "Connection error.", | ||||
|     "noresults": "No results found.", | ||||
|     "inv_arg": "Invalid argument." | ||||
| } | ||||
							
								
								
									
										46
									
								
								loc/weeb.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								loc/weeb.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| { | ||||
|     "hello": [ | ||||
|         "hello", | ||||
|         "hey", | ||||
|         "hi", | ||||
|         "good morning", | ||||
|         "good day", | ||||
|         "good afternoon", | ||||
|         "good evening", | ||||
|         "ohayou?", | ||||
|         "kon?'?nichiwa", | ||||
|         "konbanwa" | ||||
|     ], | ||||
|     "goodbye": [ | ||||
|         "bye", | ||||
|         "later", | ||||
|         "see ya", | ||||
|         "good night", | ||||
|         "sayou?nara", | ||||
|         "oyasumi" | ||||
|     ], | ||||
|     "thankyou": [ | ||||
|         "thanks", | ||||
|         "thank you", | ||||
|         "arigatou?" | ||||
|     ], | ||||
|     "love": [ | ||||
|         "love you" | ||||
|     ], | ||||
|     "hate": [ | ||||
|         "hate you", | ||||
|         "screw you", | ||||
|         "fuck you", | ||||
|         "go away" | ||||
|     ], | ||||
|     "responses": { | ||||
|         "hello": "Hi", | ||||
|         "goodbye": "Bye-bye", | ||||
|         "thankyou": "No problem", | ||||
|         "love": "You, too", | ||||
|         "hate": "Screw you" | ||||
|     }, | ||||
|     "conn_err": "Connection error.", | ||||
|     "noresults": "No results found.", | ||||
|     "inv_arg": "Invalid argument." | ||||
| } | ||||
| @@ -6,9 +6,11 @@ PLUGIN.triggers = { | ||||
|  | ||||
| function PLUGIN.action(msg) | ||||
|  | ||||
| 	if msg.date < os.time() - 1 then return end | ||||
|  | ||||
| 	local input = get_input(msg.text) | ||||
|  | ||||
| 	local message = 'Command not found.' | ||||
| 	local message = locale.inv_arg | ||||
|  | ||||
| 	local sudo = 0 | ||||
| 	for i,v in ipairs(config.admins) do | ||||
|   | ||||
| @@ -22,7 +22,7 @@ function PLUGIN.action(msg) | ||||
| 	local message, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		message = 'Connection error.' | ||||
| 		message = locale.conn_err | ||||
| 	end | ||||
|  | ||||
| 	send_msg(msg, message) | ||||
|   | ||||
| @@ -19,7 +19,7 @@ function PLUGIN.action(msg) | ||||
| 	local jstr, res = HTTPS.request('https://api.bitcoinaverage.com/ticker/global/') | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	local jdat = JSON.decode(jstr) | ||||
| @@ -29,7 +29,7 @@ function PLUGIN.action(msg) | ||||
| 		arg1 = string.upper(string.sub(input, 1, 3)) | ||||
| 		arg2 = string.sub(input, 5) | ||||
| 		if not tonumber(arg2) then | ||||
| 			return send_msg(msg, 'Invalid argument.') | ||||
| 			return send_msg(msg, locale.inv_arg) | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| @@ -43,7 +43,7 @@ function PLUGIN.action(msg) | ||||
| 	if url then | ||||
| 		jstr, b = HTTPS.request(url) | ||||
| 	else | ||||
| 		return send_msg(msg, 'Error: Currency not found.') | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	jdat = JSON.decode(jstr) | ||||
|   | ||||
| @@ -20,7 +20,7 @@ function PLUGIN.action(msg) | ||||
| 	local message, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	send_msg(msg, message) | ||||
|   | ||||
| @@ -33,10 +33,10 @@ function PLUGIN.action(msg) | ||||
| 		end | ||||
| 		range = string.sub(input, dloc+1) | ||||
| 		if not tonumber(rolls) or not tonumber(range) then | ||||
| 			return send_msg(msg, 'Invalid syntax.') | ||||
| 			return send_msg(msg, locale.inv_arg) | ||||
| 		end | ||||
| 	else | ||||
| 		return send_msg(msg, 'Invalid syntax.') | ||||
| 		return send_msg(msg, locale.inv_arg) | ||||
| 	end | ||||
|  | ||||
| 	if tonumber(rolls) == 1 then | ||||
| @@ -44,19 +44,15 @@ function PLUGIN.action(msg) | ||||
| 	elseif tonumber(rolls) > 1 then | ||||
| 		results = rolls .. 'D' .. range .. ':\n' | ||||
| 	else | ||||
| 		return send_msg(msg, 'Invalid syntax.') | ||||
| 		return send_msg(msg, locale.inv_arg) | ||||
| 	end | ||||
|  | ||||
| 	if tonumber(range) < 2 then | ||||
| 		return send_msg(msg, 'Invalid syntax.') | ||||
| 		return send_msg(msg, locale.inv_arg) | ||||
| 	end | ||||
|  | ||||
| 	if tonumber(rolls) > 100 then | ||||
| 		return send_msg(msg, 'Maximum dice is 100.') | ||||
| 	end | ||||
|  | ||||
| 	if tonumber(range) > 100000 then | ||||
| 		return send_msg(msg, 'Maximum range is 100000.') | ||||
| 	if tonumber(rolls) > 100 or tonumber(range) > 100000 then | ||||
| 		return send_msg(msg, 'Max 100D100000') | ||||
| 	end | ||||
|  | ||||
| 	for i = 1, tonumber(rolls) do | ||||
|   | ||||
| @@ -38,14 +38,14 @@ function PLUGIN.action(msg) | ||||
| 	local jstr, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		send_msg(msg, 'Connection error.') | ||||
| 		send_msg(msg, locale.conn_err) | ||||
| 		return | ||||
| 	end | ||||
|  | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
| 	if #jdat.responseData.results < 1 then | ||||
| 		send_msg(msg, 'No results found.') | ||||
| 		send_msg(msg, locale.noresults) | ||||
| 		return | ||||
| 	end | ||||
|  | ||||
|   | ||||
| @@ -20,13 +20,13 @@ function PLUGIN.action(msg) | ||||
| 	local jstr, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
| 	if jdat.status ~= 'OK' then | ||||
| 		local message = 'Error: \"' .. input .. '\" not found.' | ||||
| 		local message = locale.noresults | ||||
| 		return send_msg(msg, message) | ||||
| 	end | ||||
|  | ||||
|   | ||||
| @@ -33,13 +33,13 @@ function PLUGIN.action(msg) | ||||
| 	local jstr, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
| 	if #jdat.responseData.results < 1 then | ||||
| 		return send_msg(msg, 'No results found.') | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	message = '' | ||||
|   | ||||
| @@ -30,7 +30,7 @@ function PLUGIN.action(msg) | ||||
|  | ||||
| 		local jstr, res = HTTP.request(random_url) | ||||
| 		if res ~= 200 then | ||||
| 			return send_msg(msg, 'Connection error.') | ||||
| 			return send_msg(msg, locale.conn_err) | ||||
| 		end | ||||
| 		local jdat = JSON.decode(jstr) | ||||
| 		result_url = jdat.data.image_url | ||||
| @@ -39,7 +39,7 @@ function PLUGIN.action(msg) | ||||
|  | ||||
| 		local jstr, res = HTTP.request(search_url .. input) | ||||
| 		if res ~= 200 then | ||||
| 			return send_msg(msg, 'Connection error.') | ||||
| 			return send_msg(msg, locale.conn_err) | ||||
| 		end | ||||
| 		local jdat = JSON.decode(jstr) | ||||
| 		result_url = jdat.data[math.random(#jdat.data)].images.original.url | ||||
|   | ||||
| @@ -20,7 +20,7 @@ function PLUGIN.action(msg) | ||||
| 		send_msg(msg, string.format('%x', input)) | ||||
|  | ||||
| 	else | ||||
| 		send_msg(msg, 'Invalid number.') | ||||
| 		send_msg(msg, locale.inv_arg) | ||||
|  | ||||
| 	end | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,7 @@ function PLUGIN.action(msg) | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Error connecting to server.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	if jdat.Response ~= 'True' then | ||||
|   | ||||
| @@ -12,7 +12,7 @@ PLUGIN.triggers = { | ||||
| 	'^i\'m back%p?$' | ||||
| } | ||||
|  | ||||
| function PLUGIN.action(msg) -- I WISH LUA HAD PROPER REGEX SUPPORT | ||||
| function PLUGIN.action(msg) | ||||
|  | ||||
| 	local input = string.lower(msg.text) | ||||
|  | ||||
| @@ -24,24 +24,20 @@ function PLUGIN.action(msg) -- I WISH LUA HAD PROPER REGEX SUPPORT | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| 	if input:match('thanks,? '..bot.first_name) or input:match('thank you,? '..bot.first_name) then | ||||
| 		return send_message(msg.chat.id, 'No problem, ' .. msg.from.first_name .. '!') | ||||
| 	end | ||||
| 	interactions = { | ||||
| 		[locale.responses.hello]	= locale.hello, | ||||
| 		[locale.responses.goodbye]	= locale.goodbye, | ||||
| 		[locale.responses.thankyou]	= locale.thankyou, | ||||
| 		[locale.responses.love]		= locale.love, | ||||
| 		[locale.responses.hate]		= locale.hate | ||||
| 	} | ||||
|  | ||||
| 	if input:match('hello,? '..bot.first_name) or input:match('hey,? '..bot.first_name) or input:match('hi,? '..bot.first_name) then | ||||
| 		return send_message(msg.chat.id, 'Hi, ' .. msg.from.first_name .. '!') | ||||
| 	end | ||||
|  | ||||
| 	if input:match('bye,? '..bot.first_name) or input:match('later,? '..bot.first_name) then | ||||
| 		return send_message(msg.chat.id, 'Bye-bye, ' .. msg.from.first_name .. '!') | ||||
| 	end | ||||
|  | ||||
| 	if input:match('i hate you,? '..bot.first_name) or input:match('screw you,? '..bot.first_name) or input:match('fuck you,? '..bot.first_name) then | ||||
| 		return send_msg(msg, '; _ ;') | ||||
| 	end | ||||
|  | ||||
| 	if string.match(input, 'i love you,? '..bot.first_name) then | ||||
| 		return send_msg(msg, '<3') | ||||
| 	for k,v in pairs(interactions) do | ||||
| 		for key,val in pairs(v) do | ||||
| 			if input:match(val..',? '..bot.first_name) then | ||||
| 				return send_message(msg.chat.id, k..', '..msg.from.first_name..'!') | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| --	msg.text = '@' .. bot.username .. ', ' .. msg.text:gsub(bot.first_name, '') | ||||
|   | ||||
| @@ -23,7 +23,7 @@ function PLUGIN.action(msg) | ||||
| 	local dex_url = base_url .. '/api/v1/pokemon/' .. input | ||||
| 	local dex_jstr, res = HTTP.request(dex_url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Pokemon not found..') | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	local dex_jdat = JSON.decode(dex_jstr) | ||||
| @@ -31,7 +31,7 @@ function PLUGIN.action(msg) | ||||
| 	local desc_url = base_url .. dex_jdat.descriptions[math.random(#dex_jdat.descriptions)].resource_uri | ||||
| 	local desc_jstr, res = HTTP.request(desc_url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	local desc_jdat = JSON.decode(desc_jstr) | ||||
|   | ||||
| @@ -4,7 +4,8 @@ PLUGIN.triggers = { | ||||
| 	['¯\\_(ツ)_/¯'] = '/shrug$', | ||||
| 	['( ͡° ͜ʖ ͡°)'] = '/lenny$', | ||||
| 	['(╯°□°)╯︵ ┻━┻'] = '/flip$', | ||||
| 	['┌(┌ ^o^)┐'] = '/homo$' | ||||
| 	['┌(┌ ^o^)┐'] = '/homo$', | ||||
| 	['ಠ_ಠ'] = '/look$' | ||||
| } | ||||
|  | ||||
| function PLUGIN.action(msg) | ||||
|   | ||||
| @@ -24,11 +24,11 @@ function PLUGIN.action(msg) | ||||
| 			local url = 'http://www.reddit.com/' .. first_word(input) .. '/.json' | ||||
| 			local jstr, res = HTTP.request(url) | ||||
| 			if res ~= 200 then | ||||
| 				return send_msg(msg, 'Connection error.') | ||||
| 				return send_msg(msg, locale.conn_err) | ||||
| 			end | ||||
| 			jdat = JSON.decode(jstr) | ||||
| 			if #jdat.data.children == 0 then | ||||
| 				return send_msg(msg, 'Subreddit not found.') | ||||
| 				return send_msg(msg, locale.noresults) | ||||
| 			end | ||||
|  | ||||
| 		else | ||||
| @@ -36,11 +36,11 @@ function PLUGIN.action(msg) | ||||
| 			local url = 'http://www.reddit.com/search.json?q=' .. URL.escape(input) | ||||
| 			local jstr, res = HTTP.request(url) | ||||
| 			if res ~= 200 then | ||||
| 				return send_msg(msg, 'Connection error.') | ||||
| 				return send_msg(msg, locale.conn_err) | ||||
| 			end | ||||
| 			jdat = JSON.decode(jstr) | ||||
| 			if #jdat.data.children == 0 then | ||||
| 				return send_msg(msg, 'No results found.') | ||||
| 				return send_msg(msg, locale.noresults) | ||||
| 			end | ||||
|  | ||||
| 		end | ||||
| @@ -50,7 +50,7 @@ function PLUGIN.action(msg) | ||||
| 		url = 'https://www.reddit.com/.json' | ||||
| 		local jstr, res = HTTP.request(url) | ||||
| 		if res ~= 200 then | ||||
| 			return send_msg(msg, 'Connection error.') | ||||
| 			return send_msg(msg, locale.conn_err) | ||||
| 		end | ||||
| 		jdat = JSON.decode(jstr) | ||||
|  | ||||
|   | ||||
| @@ -20,14 +20,13 @@ function PLUGIN.action(msg) | ||||
|  | ||||
| 	coords = get_coords(input) | ||||
| 	if not coords then | ||||
| 		local message = 'Error: \"' .. input .. '\" not found.' | ||||
| 		return send_msg(msg, message) | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	local url = 'http://maps.googleapis.com/maps/api/timezone/json?location=' .. coords.lat ..','.. coords.lon .. '×tamp='..os.time() | ||||
| 	local jstr, res = HTTPS.request(url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
|   | ||||
| @@ -21,13 +21,13 @@ function PLUGIN.action(msg) | ||||
| 	local jstr, res = HTTP.request(url) | ||||
|  | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
|  | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
| 	if jdat.result_type == "no_results" then | ||||
| 		return send_msg(msg, 'No results found.') | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	message = '"' .. jdat.list[1].word .. '"\n' .. trim_string(jdat.list[1].definition) | ||||
|   | ||||
| @@ -19,14 +19,13 @@ function PLUGIN.action(msg) | ||||
|  | ||||
| 	coords = get_coords(input) | ||||
| 	if not coords then | ||||
| 		local message = 'Error: \"' .. input .. '\" not found.' | ||||
| 		return send_msg(msg, message) | ||||
| 		return send_msg(msg, locale.noresults) | ||||
| 	end | ||||
|  | ||||
| 	local url = 'http://api.openweathermap.org/data/2.5/weather?lat=' .. coords.lat .. '&lon=' .. coords.lon | ||||
| 	local jstr, res = HTTP.request(url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| local PLUGIN = {} | ||||
|  | ||||
| PLUGIN.doc = [[ | ||||
| 	/who | ||||
| 	/whoami | ||||
| 	Get the user ID for yourself and the group. Use it in a reply to get info for the sender of the original message. | ||||
| ]] | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,7 @@ function PLUGIN.action(msg) | ||||
| 	local url = 'http://xkcd.com/info.0.json' | ||||
| 	local jstr, res = HTTP.request(url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
| 	local latest = JSON.decode(jstr).num | ||||
|  | ||||
| @@ -24,7 +24,7 @@ function PLUGIN.action(msg) | ||||
| 		local jstr, res = HTTP.request(url) | ||||
| 		if res ~= 200 then | ||||
| 			print('here') | ||||
| 			return send_msg(msg, 'Connection error.') | ||||
| 			return send_msg(msg, locale.conn_err) | ||||
| 		end | ||||
| 		url = JSON.decode(jstr).responseData.results[1].url .. 'info.0.json' | ||||
| 	else | ||||
| @@ -34,7 +34,7 @@ function PLUGIN.action(msg) | ||||
|  | ||||
| 	local jstr, res = HTTP.request(url) | ||||
| 	if res ~= 200 then | ||||
| 		return send_msg(msg, 'Connection error.') | ||||
| 		return send_msg(msg, locale.conn_err) | ||||
| 	end | ||||
| 	local jdat = JSON.decode(jstr) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 topkecleon
					topkecleon