Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F628607
responses.mattata
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
responses.mattata
View Options
--[[
Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com>
This code is licensed under the MIT. See LICENSE for details.
]]
local responses = {}
local mattata = require('mattata')
function responses:init()
responses.all = {
['night'] = {
'^go?o?d? ?night$',
'^g?night$',
'^gn$'
},
['morning'] = {
'^go?o?d ?morning?$',
'^morning?$',
'^just woken? up'
},
['yesno'] = {
'^' .. self.info.name .. ',? do .-%??$',
'^' .. self.info.name .. ',? [sc]h?ould .-%??$',
'^' .. self.info.name .. ',? are .-%??$',
'^' .. self.info.name .. ',? is .-%??$',
' y/n$'
},
['iam'] = {
'^[Ii][\'' .. utf8.char(8217) .. '%s]?[AaMm][Mm]?[\n ](%a+)$'
}
}
end
function responses:on_new_message(message)
if not message.text then return false end
for category, response in pairs(responses.all) do
for _, trigger in pairs(response) do
if message.text:lower():match(trigger) then
local yesno = {
'Yes',
'No',
'Maybe',
'Ask again later',
'Definitely',
'Definitely not',
'I don\'t know'
}
local output = yesno[math.random(#yesno)]
if category == 'night' then
output = 'Good night, ' .. message.from.first_name .. '!'
elseif category == 'morning' then
output = 'Good morning, ' .. message.from.first_name .. '!'
elseif category == 'iam' and message.text:len() < 50 then
output = 'Hello ' .. message.text:match(trigger) .. ', I\'m ' .. self.info.first_name
end
return mattata.send_reply(message, output)
end
end
end
if message.text:lower():match('feeling? sexy') then
return mattata.send_voice(message.chat.id, 'AwACAgQAAxkBAAIYwV7ZmESphxCW9E0ZSH4st2WY9ladAAJWOAACuxlkB_VheSVS_OpcGgQ', utf8.char(128521), nil, 9)
end
return false
end
return responses
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 4:34 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141554
Default Alt Text
responses.mattata (2 KB)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline