xkcd.lua: Working again, but no more queries (for now).
fortune.lua: The bad spacing annoyed me to no end. Monospaced now. patterns.lua: Error message upon malformed patterns. readme.md: outdated, notice
This commit is contained in:
@ -15,6 +15,16 @@ function patterns:action(msg)
|
||||
local output = msg.reply_to_message.text or ''
|
||||
local m1, m2 = msg.text:match('^/?s/(.-)/(.-)/?$')
|
||||
if not m2 then return true end
|
||||
local res, output = pcall(
|
||||
function()
|
||||
return output:gsub(m1, m2)
|
||||
end
|
||||
)
|
||||
if res == false then
|
||||
output = 'Malformed pattern!'
|
||||
bindings.sendReply(self, msg, output)
|
||||
return
|
||||
end
|
||||
output = output:gsub(m1, m2)
|
||||
output = 'Did you mean:\n"' .. output:sub(1, 4000) .. '"'
|
||||
bindings.sendReply(self, msg.reply_to_message, output)
|
||||
|
Reference in New Issue
Block a user