{"issue":{"milestone":null,"title":"New features","created_at":"2011-12-29T20:14:07Z","user":{"login":"clobrother","id":1293082,"url":"https://api.github.com/users/clobrother","avatar_url":"https://secure.gravatar.com/avatar/892f5f42c3af926d5c5d89d82b096a2f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"892f5f42c3af926d5c5d89d82b096a2f"},"labels":[],"updated_at":"2011-12-29T20:14:07Z","state":"open","id":2682328,"closed_at":null,"html_url":"https://github.com/EthanCentaurai/BottleCap/issues/1","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"Hi there,\r\nIf people wrote a message like that : \"HI THERe\", it won't be filtered\r\nThat's why a rewrite your function (not so good, i'm a bit noob with lua).\r\nThis should hide message if less than 20% char are caps.\r\nHere's the code :\r\n\r\n\r\nlocal function bottleCaps(_, _, msg, ...)\r\n\t-- prevent all caps from showing in the chatframes\r\n\tif db.ignore then\r\n\t\tlocal tmp = msg\r\n\t\tlocal value\r\n\t\tlocal a = true\r\n\t\tfor i = 65, 90 do\r\n\t\t\ta = true\r\n\t\t\twhile(a == true) do\r\n\t\t\t\tvalue = string.find(tmp, string.char(i))\r\n\t\t\t\tif(value == nil) then\r\n\t\t\t\t\ta = false\r\n\t\t\t\telse\r\n\t\t\t\t\tif(value == 1) then\r\n\t\t\t\t\t\ttmp = tmp:sub(2)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ttmp = tmp:sub(1, value - 1)..tmp:sub(value + 1)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tlocal ratio = tonumber(string.len(tmp)) / tonumber(string.len(msg))\r\n\t\tif(ratio < 0.2) then\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false, msg, ...\r\n\t\tend\r\n\r\n\tend\r\n\r\n\t--~ if db.ignore and msg == msg:upper() then\r\n\t\t--~ return true\r\n\t--~ end\r\n\t\r\n\tif db.verbose or msg == msg:upper() then\r\n\t\t-- Verbose Mode = all chat becomes lower case, regardless of original case\r\n\t\t-- else all ALL CAPS CHAT becomes lower case\r\n\t\tmsg = msg:lower()\r\n\r\n\t\t-- Fix links\r\n\t\tmsg = msg:gsub(\"|hitem\", \"|Hitem\")\r\n\t\tmsg = msg:gsub(\"|hquest\", \"|Hquest\")\r\n\t\tmsg = msg:gsub(\"|hspell\", \"|Hspell\")\r\n\t\tmsg = msg:gsub(\"|htalent\", \"|Htalent\")\r\n\t\tmsg = msg:gsub(\"|hachievement\", \"|Hachievement\")\r\n\t\tmsg = msg:gsub(\"|htrade\", \"|Htrade\")\r\n\t\tmsg = msg:gsub(\"|henchant\", \"|Henchant\")\r\n\t\tmsg = msg:gsub(\"|hglyph\", \"|Hglyph\")\r\n\t\tmsg = msg:gsub(\"|hurl\", \"|Hurl\") -- website links created by Chatter, Prat etc.\r\n\r\n\t\treturn false, msg, ...\r\n\tend\r\nend","number":1,"url":"https://api.github.com/repos/EthanCentaurai/BottleCap/issues/1","comments":0,"assignee":null},"action":"opened"}