2016-02-25 10:08:27 -05:00
|
|
|
|
-- Never change this plugin. It was not meant to be changed.
|
|
|
|
|
-- You may add reactions. You must never remove reactions.
|
|
|
|
|
-- You must never restructure. You must never disable this plugin.
|
2016-05-15 08:22:31 -04:00
|
|
|
|
-- - Drew, creator, a year later.
|
|
|
|
|
|
|
|
|
|
-- Nevermind, Brayden changed it.
|
|
|
|
|
-- - Drew, just now.
|
2016-02-25 10:08:27 -05:00
|
|
|
|
|
2016-04-10 21:04:47 -07:00
|
|
|
|
local reactions = {}
|
|
|
|
|
|
2016-06-07 00:31:34 -04:00
|
|
|
|
local utilities = require('otouto.utilities')
|
2016-04-10 21:04:47 -07:00
|
|
|
|
|
|
|
|
|
reactions.command = 'reactions'
|
|
|
|
|
reactions.doc = '`Returns a list of "reaction" emoticon commands.`'
|
|
|
|
|
|
|
|
|
|
local mapping = {
|
|
|
|
|
['shrug'] = '¯\\_(ツ)_/¯',
|
|
|
|
|
['lenny'] = '( ͡° ͜ʖ ͡°)',
|
|
|
|
|
['flip'] = '(╯°□°)╯︵ ┻━┻',
|
|
|
|
|
['homo'] = '┌(┌ ^o^)┐',
|
|
|
|
|
['look'] = 'ಠ_ಠ',
|
2016-05-13 16:09:40 -04:00
|
|
|
|
['shots?'] = 'SHOTS FIRED',
|
|
|
|
|
['facepalm'] = '(-‸ლ)'
|
2015-11-24 21:22:04 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-10 21:04:47 -07:00
|
|
|
|
local help
|
|
|
|
|
|
2016-05-26 20:28:44 -07:00
|
|
|
|
function reactions:init(config)
|
2016-04-10 21:04:47 -07:00
|
|
|
|
-- Generate a "help" message triggered by "/reactions".
|
2016-04-28 21:36:35 -07:00
|
|
|
|
help = 'Reactions:\n'
|
2016-05-26 20:28:44 -07:00
|
|
|
|
reactions.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('reactions').table
|
2016-04-10 21:04:47 -07:00
|
|
|
|
for trigger,reaction in pairs(mapping) do
|
2016-05-26 20:28:44 -07:00
|
|
|
|
help = help .. '• ' .. config.cmd_pat .. trigger:gsub('.%?', '') .. ': ' .. reaction .. '\n'
|
|
|
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger)
|
|
|
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger..'@'..self.info.username:lower())
|
2016-04-10 21:04:47 -07:00
|
|
|
|
end
|
2015-11-24 21:22:04 -05:00
|
|
|
|
end
|
|
|
|
|
|
2016-05-26 20:28:44 -07:00
|
|
|
|
function reactions:action(msg, config)
|
|
|
|
|
if string.match(msg.text_lower, config.cmd_pat..'reactions') then
|
2016-05-29 13:08:39 -04:00
|
|
|
|
utilities.send_message(self, msg.chat.id, help)
|
2016-04-10 21:04:47 -07:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
for trigger,reaction in pairs(mapping) do
|
2016-05-26 20:28:44 -07:00
|
|
|
|
if string.match(msg.text_lower, config.cmd_pat..trigger) then
|
2016-05-29 13:08:39 -04:00
|
|
|
|
utilities.send_message(self, msg.chat.id, reaction)
|
2015-11-24 21:22:04 -05:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2016-04-10 21:04:47 -07:00
|
|
|
|
return reactions
|