<commit_before>if comic_memory == nil then
	comic_memory = {}
end

function comic_callback(event, origin, params)
	local spec_f = io.open(get_config("comic:workdir").."spec", "w")
	for i,v in ipairs(comic_memory) do
		spec_f:write(v.user .. ": " .. v.message .. "\n")
	end
	spec_f:close()

	os.execute(get_config("comic:script"))

	function comic_upload_callback(url, channel)
		if url ~= nil then
			irc_msg(channel, "Here's your comic: " .. url)
		else
			irc_msg(channel, "Couldn't make a comic, sorry")
		end
	end

	imgur_upload(get_config("comic:output"), comic_upload_callback, get_config("comic:channel"))
end
register_command("comic", "comic_callback")

function comic_remember(event, origin, params)
	if params[1] ~= get_config("comic:channel") then
		return
	end

	while #comic_memory > tonumber(get_config("comic:count")) do
		table.remove(comic_memory,1)
	end

	comic_memory[#comic_memory+1] = {user=origin, message=params[2]}
	print("comic memory has " .. (#comic_memory) .." entries")
end
register_callback("CHANNEL", "comic_remember")<commit_msg>fix an error<commit_after>if comic_memory == nil then
	comic_memory = {}
end

function comic_callback(event, origin, params)
	local spec_f = io.open(get_config("comic:workdir").."spec", "w")
	for i,v in ipairs(comic_memory) do
		spec_f:write(v.user .. ": " .. v.message .. "\n")
	end
	spec_f:close()

	os.execute(get_config("comic:script"))

	function comic_upload_callback(url, channel)
		if url ~= nil then
			irc_msg(channel, "Here's your comic: " .. url)
		else
			irc_msg(channel, "Couldn't make a comic, sorry")
		end
	end

	imgur_upload(get_config("comic:output"), comic_upload_callback, get_config("comic:channel"))
end
register_command("comic", "comic_callback")

function comic_remember(event, origin, params)
	if params[1] ~= get_config("comic:channel") then
		return
	end

	while #comic_memory > tonumber(get_config("comic:count")) do
		table.remove(comic_memory,1)
	end

	comic_memory[#comic_memory+1] = {user=origin, message=params[2]}
	--print("comic memory has " .. (#comic_memory) .." entries")
end
register_callback("CHANNEL", "comic_remember")
{'fraction_non_alphanumeric': 0.15073009891662742, 'fraction_numerical': 0.0037682524729156855, 'mean_word_length': 5.700315457413249, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5724202', 'n_tokens_mistral': 804, 'n_tokens_neox': 761, 'n_words': 159}